Research on the source code of Activiti Designer (iii) Servicetask calls published in other languages except Java WebService

Source: Internet
Author: User
Tags wsdl

According to the previous article's configuration, Servicetask has been able to invoke WebService with @webparam and @webresult releases, but how to invoke the webservice of these publications without these parameters, Because other languages do not @webparam these parameters, consider the following example:

Counter.java

<span style= "FONT-SIZE:14PX;" > @WebServicepublic 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 (@WebP Aram (name= "value") int value); <em> string Prettyprintcount (string prefix, string suffix);   <strong> </strong>string prettyprintcounttwo (String suffixtwo, String prefixtwo); </em>}</span >
After publishing, the WSDL file is as follows (key content):

<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>
We will find that the first parameter name of the Prettyprintcounttwo method defaults to arg0, and the second parameter name defaults to Arg1

The default name of the return value is return

So I made the following configuration in the 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>

After deployment, and then run, you will find that the following error is reported

<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> 
will find that return does not exist, clearly in the WSDL is return, how can not exist?

So I activiti-cxf in the Cxfwsdlimport test of what is in the simplestructuredefinition, the results found that return read into the _return, so as long as the return to _ Return is OK.




Research on the source code of Activiti Designer (iii) Servicetask calls published in other languages except Java WebService

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.