开发者

Calling a SOAP WebService that uses xsd:anyType

开发者 https://www.devze.com 2023-02-09 19:44 出处:网络
I need to call a WebService which has an argument that\'s defined as an array of xsd:anyType, defined like this:

I need to call a WebService which has an argument that's defined as an array of xsd:anyType, defined like this:

<complexType name='ArrayOfAnyType'>
   <complexContent>
      <restriction base='soapenc:Array'>
         <attribute ref='soapenc:arrayType' wsdl:arrayType ='xsd:anyType[]'/>
      </restriction>
   </complexContent>
</complexType>

and the return type is also of type xsd:anyType, like this:

<message name='RunTask.runTaskInput'>
   <part name='taskName' type='xsd:string'/>
   <part name='args' type='ns2:ArrayOfAnyType'/>
</message>
<message name='RunTask.runTaskOutput'>
   <part name='return' type='xsd:anyType'/>
</message>

The WebService is actually a server which can execute lots of different tasks, where the tasks can be configured by the user of the server (and each task has its own specific arguments).

Until now I could generate C# client proxies for this web service using Microsoft's WSDL utility. The generated C# code could easily be used, provided that I correctly cast all arguments to .Net 'object' type.

I now need to generate a Java client for this web service (and to be honest, I'm only a beginner in Java). There seem to be a utility called WSDL2JAVA, which I found at http://ws.apache.org/muse/docs/2.0.0/tutorial/01-install-muse.html. But if I run it, it gives me the following errors:

WARNING: [ID = 'NoWSRPSchema'] No WS-RP schema found. java.lang.RuntimeException: [ID = 'NotDocLiteral'] The WSDL operation 'runTask' is not doc-literal because it defines a message with more than one message part for its SOAP Body. The SOAP Body of a doc-literal message should contain one root request element ( with the operation name) with zero or more child elements (the parameters). at org.apache.muse.tools.inspector.ResourceInspector.getInputName(ResourceInspector.java:486) at org.apache.muse.tools.inspector.ResourceInspector.createJavaMethod(ResourceInspector.java:329) at org.apache.muse.tools.inspector.ResourceInspector.getOperations(ResourceInspector.java:570) at org.apache.muse.tools.inspector.ResourceInspector.run(ResourceInspector.java:888) at org.apache.muse.tools.generator.analyzer.SimpleAnalyzer.inspect(SimpleAnalyzer.java:409) at org.apache.muse.tools.generator.analyzer.SimpleAnalyzer.analyze(SimpleAnalyzer.java:348) at or开发者_JAVA技巧g.apache.muse.tools.generator.Wsdl2Java.run(Wsdl2Java.java:178) at org.apache.muse.tools.generator.Wsdl2Java.main(Wsdl2Java.java:270)

SEVERE: [ID = 'CodeGenFailed'] Code generation failed, see the exception information below.

An exception was caught: [ID = 'NotDocLiteral'] The WSDL operation 'runTask' is not doc-literal because it defines a message wi th more than one message part for its SOAP Body. The SOAP Body of a doc-literal message should contain one root request element (wit h the operation name) with zero or more child elements (the parameters).

I looks to me as the xsd:anyType is not supported here.

What is the easier way to generate a proxy-class for this web service? Preferably as easy as possible, just like WSDL created the C# proxy for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消