天翎MyApps技术社区 - 低代码平台 | 流程管理系统 | BPM软件

 找回密码
 注册成为天翎用户
查看: 3482|回复: 11

如何调用外部web service

[复制链接]
xy_aoxiang 发表于 2012-2-22 14:49:16 | 显示全部楼层 |阅读模式
本帖最后由 xy_aoxiang 于 2012-2-27 12:09 编辑

在表单中增加一个操作,想调用外部程序写的web service,请问如何写“动作执行脚本”,谢谢。
purple 发表于 2012-2-22 16:41:31 | 显示全部楼层
您好,您可先参考这个帖子:http://www.teemlink.com/bbs/view ... 7&highlight=web有问题,我们再沟通。
 楼主| xy_aoxiang 发表于 2012-2-22 17:01:04 | 显示全部楼层
本帖最后由 xy_aoxiang 于 2012-2-22 17:05 编辑

回复 2# purple


    谢谢,不过,我是想调用外部的,别的程序写的web service,比如PHP或别的,不是平台提供的。再具体一点,调用外部web service的function。
 楼主| xy_aoxiang 发表于 2012-2-22 17:02:36 | 显示全部楼层
回复 2# purple


    并且,是在平台上对表单设置操作的时候,添加一个操作时,写脚本调用,谢谢。
purple 发表于 2012-2-22 18:26:14 | 显示全部楼层
您好,您需要把webserver文件,加入到工程,用eclipse自动生成客户端代码,然后自己在方法调用即可,具体的调用方法请参考这个帖子:http://www.teemlink.com/bbs/viewthread.php?tid=160138&extra=.有问题,我们再沟通。
 楼主| xy_aoxiang 发表于 2012-2-23 16:20:12 | 显示全部楼层
本帖最后由 xy_aoxiang 于 2012-2-23 16:26 编辑

回复 5# purple


    我用myeclipse创建一个工程,把WSDL文件放入工程目录中,创建一个web service client,并生成了5个 TestServer*.class 文件,把文件放到平台目录下 bin\apache-tomcat-6.0.14\webapps\obpm\WEB-INF\classes\cn\myapps\webservice\client 中,在 “操作”的脚本编辑里,写入脚本

var wstest = new Packages.cn.myapps.webservice.client.TestServer();
var arrayObj = wstest.testWS();//方法名称
$PRINTER.println(arrayObj);

但是调用的时候报错: 调用PHP Web ServiceafterActionScript]: TypeError: [JavaPackage cn.myapps.webservice.client.TestServer] is not a function, it is org.mozilla.javascript.NativeJavaPackage 。 请问我哪里做错了吗?
purple 发表于 2012-2-23 17:30:41 | 显示全部楼层
您好,根据错误提示,是没有您调用的方法哦,请检查您调用的TestServe类中,是否确实存在testWS()方法。
 楼主| xy_aoxiang 发表于 2012-2-24 09:29:35 | 显示全部楼层
回复 7# purple


    TestServer.class中确实没有testWS(),但是TestServerBindingStub.class中有testWS(),是否我应该用TestServerBindingStub这个类呢?
   另外我是用myeclipse自动生成的web service client。
 楼主| xy_aoxiang 发表于 2012-2-24 10:03:49 | 显示全部楼层
回复 7# purple


    另外,我想请问一下,创建client的时候的正确方式是 :
   1. new->other->myeclipse->web service->web service client.
    2. new->other->web service->web service client ?
 楼主| xy_aoxiang 发表于 2012-2-24 10:07:41 | 显示全部楼层
本帖最后由 xy_aoxiang 于 2012-2-24 10:09 编辑

回复 7# purple
以下是我的wsdl文件信息,如有需要,请参考,谢谢。
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://192.168.0.129/soap/testServer" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://192.168.0.129/soap/testServer">
  3. <types>
  4. <xsd:schema targetNamespace="http://192.168.0.129/soap/testServer"
  5. >
  6. <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
  7. <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
  8. </xsd:schema>
  9. </types>
  10. <message name="testWSRequest">
  11.   <part name="string" type="xsd:string" /></message>
  12. <message name="testWSResponse">
  13.   <part name="return" type="xsd:string" /></message>
  14. <portType name="testServerPortType">
  15.   <operation name="testWS">
  16.     <input message="tns:testWSRequest"/>
  17.     <output message="tns:testWSResponse"/>
  18.   </operation>
  19. </portType>
  20. <binding name="testServerBinding" type="tns:testServerPortType">
  21.   <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
  22.   <operation name="testWS">
  23.     <soap:operation soapAction="http://192.168.0.129/testServer.php/testWS" style="rpc"/>
  24.     <input><soap:body use="encoded" namespace="" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
  25.     <output><soap:body use="encoded" namespace="" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
  26.   </operation>
  27. </binding>
  28. <service name="testServer">
  29.   <port name="testServerPort" binding="tns:testServerBinding">
  30.     <soap:address location="http://192.168.0.129:86/testServer.php"/>
  31.   </port>
  32. </service>
  33. </definitions>
复制代码

本版积分规则

QQ|手机版|天翎MyApps技术社区 ( 粤ICP备11093750号 )

GMT+8, 2026-8-12 21:28

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表