activiti designer源码的研究(三) 之servicetask调用除Java之后的其他语言发布的webservice
2015-02-01 16:11
633 查看
按照上一篇文章的配置,ServiceTask已经可以调用带有@webParam和@webResult发布的webservice了,但是怎么调用这些不带这些参数的发布的webservice了,因为其他语言并没有@webParam这些参数,请看下面的例子:
Counter.java
返回值的默认名为return
于是我在bpmn20.xml中进行了下面的配置
部署之后,然后运行,会发现会报如下错误
于是我在activiti-cxf的CxfWSDLImport中测试SimpleStructureDefinition中存的是什么东西,结果发现return读入之后变成了_return,所以只要把return改为_return就OK了
Counter.java
<span style="font-size:14px;">@WebService public interface Counter { /** * Increase the counter in 1 */ void inc(); /** * Returns the current count * * @return the count */ @WebResult(name="count") int getCount(); /** * Resets the counter to 0 */ void reset(); /** * Sets the counter to value * * @param value the value of the new counter */ void setTo(@WebParam(name="value") int value); <em> String prettyPrintCount(String prefix, String suffix); <strong> </strong>String prettyPrintCountTwo(String suffixTwo, String prefixTwo);</em> }</span>发布之后,wsdl文件如下(关键内容):
<xs:complexType name="prettyPrintCountTwo"> <xs:sequence> <xs:element minOccurs="0" name="arg0" type="xs:string"/> <xs:element minOccurs="0" name="arg1" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="prettyPrintCountTwoResponse"> <xs:sequence> <xs:element minOccurs="0" name="return" type="xs:string"/> </xs:sequence> </xs:complexType>我们会发现prettyPrintCountTwo方法的第一个参数名默认为arg0,第二个参数名默认为arg1
返回值的默认名为return
于是我在bpmn20.xml中进行了下面的配置
<span style="font-size:18px;"><serviceTask id="servicetask3" name="Service Task" implementation="##WebService" operationRef="tns:prettyPrintCountTwoOperation"> <dataInputAssociation> <sourceRef>PrettyPrintResult</sourceRef> <targetRef>arg0</targetRef> </dataInputAssociation> <dataInputAssociation> <sourceRef>PrefixTwoVariable</sourceRef> <targetRef>arg1</targetRef> </dataInputAssociation> <dataOutputAssociation> <sourceRef>return</sourceRef> <targetRef>PrettyPrintTwoResult</targetRef> </dataOutputAssociation> </serviceTask></span>
部署之后,然后运行,会发现会报如下错误
<span style="font-size:18px;">junit.framework.ComparisonFailure: expected:<The counter has the value -1. Good news 0 append What news> but was:<null> at junit.framework.Assert.assertEquals(Assert.java:100) at junit.framework.Assert.assertEquals(Assert.java:107) at junit.framework.TestCase.assertEquals(TestCase.java:269) at org.activiti.engine.test.bpmn.servicetask.WebServiceSimplisticTwoTest.testWebServiceInvocationWithSimplisticDataFlow(WebServiceSimplisticTwoTest.java:46) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at junit.framework.TestCase.runTest(TestCase.java:176) at org.activiti.engine.impl.test.PvmTestCase.runTest(PvmTestCase.java:65) at junit.framework.TestCase.runBare(TestCase.java:141) at org.activiti.engine.impl.test.AbstractActivitiTestCase.runBare(AbstractActivitiTestCase.java:102) at junit.framework.TestResult$1.protect(TestResult.java:122) at junit.framework.TestResult.runProtected(TestResult.java:142) at junit.framework.TestResult.run(TestResult.java:125) at junit.framework.TestCase.run(TestCase.java:129) at junit.framework.TestSuite.runTest(TestSuite.java:255) at junit.framework.TestSuite.run(TestSuite.java:250) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) </span>会发现return并不存在,明明在wsdl中是return,怎么会不存在了?
于是我在activiti-cxf的CxfWSDLImport中测试SimpleStructureDefinition中存的是什么东西,结果发现return读入之后变成了_return,所以只要把return改为_return就OK了
相关文章推荐
- activiti designer源码的研究(四) 之servicetask调用webservice(example)
- activiti designer源码的研究(一) 采用Axis2调用Webservice
- Java Web 跨平台 - 使用Apache Axis2引擎发布基于Java语言的WebService并跨平台调用实例
- 程序调用飞信API发送免费短信(JAVA例子,其他语言一样用)
- 程序调用飞信API发送免费短信(JAVA例子,其他语言一样用)
- SAP&Java WebService(二) ----ABAP调用SAP生成的WebService
- OpenJDK源码研究笔记(十六):在Java中使用JavaScript脚本语言
- JAVA调用C#发布的webservice简单例子,java.lang.NoSuchMethodError: org.apache.ws.commons.schema.XmlSchemaComplexType.getAttributes()解决
- java调用DoNet发布的WebService
- java 调用 BO(报表)发布的 Webservice 返回没有东西 怎么回事?
- SAP&Java WebService(三) ----JAVA调用SAP生成的WebService
- php调用java发布的webservice
- Java调用IIS发布的WebService
- Java实现的简单的WebService服务发布和Client调用例子
- 基于JAVA中使用Axis发布/调用Webservice的方法详解
- Java 调用其他开发语言开发的动态链接库文件(一)
- Java 调用C 或者其他语言的方法-JNI
- 我用纯C语言开发的中英文混合分词服务器3.0正式发布,词库190多万词,每秒切分5万+,同时提供 c、java、C#、delphi、js调用范例
- .NET动态调用WebService并生成程序集 兼容集成java发布的webserive
- Java调用IIS发布的WebService