I seem to be having difficulty generating the correct tag-name for the
status type element in our response. Here is the WSDL fragment:
 
 <message name="RunTransform">
  <part name="source" type="tns:IoSpec"/>
  <part name="sink" type="tns:IoSpec"/>
  <part name="engine" type="xsd:string"/>
  <part name="outputFormat" type="xsd:string"/>
  <part name="options" type="tns:ArrayOfOption"/>
  <part name="transformID" type="xsd:string"/>
 </message>
 
 <message name="RunTransformResponse">
  <part name="transformID" type="xsd:string"/>
  <part name="result" type="tns:Status"/>
 </message>

WSDL2Java generates:

public samurai.ws.Status runTransform(samurai.ws.IoSpec source,
samurai.ws.IoSpec sink, java.lang.String engine, java.lang.String
outputFormat, samurai.ws.Option[] options,
javax.xml.rpc.holders.StringHolder transformID) throws
java.rmi.RemoteException;

A couple of things to note here: WSDL2Java realizes that "transformID"
is an in/out parameter, so the code generated uses a StringHolder type
to contain this variable. Just like an RPC method signature should look
like. Since there is only one other out parameter, the method signature
for the generated RunTransform Java method returns a Status object. My
issue is that when I look at the SOAP response message, it becomes this:
 
  <ns1:runTransformResponse
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:ns1="http://localhost/.../";>
   <runTransformResult xsi:nil="true"/>
   <transformID
xsi:type="xsd:string">JavaStubSimpleExample1015862607566</transformID>
  </ns1:runTransformResponse>

I can't seem to get a <result> tag as defined in the WSDL. Even if I
change the name from "result" to something else like "stat", the Axis
engine doesn't care and generates a <runTransformResult> tag to hold the
result of the RPC call.
 
 
 
Just for kicks, I created 2 out parameters of type Status to see what
would happen. The Java RPC-style method generated returns void, and has
StatusHolder types for each Status object.
 
 <message name="RunTransformResponse">
  <part name="transformID" type="xsd:string"/>
  <part name="stat1" type="tns:Status"/>
  <part name="stat2" type="tns:Status"/>
  <part name="result" type="tns:Status"/>
 </message>

public void runTransform(samurai.ws.IoSpec source, samurai.ws.IoSpec
sink, java.lang.String engine, java.lang.String outputFormat,
samurai.ws.Option[] options, javax.xml.rpc.holders.StringHolder
transformID, samurai.ws.StatusHolder stat1, samurai.ws.StatusHolder
stat2, samurai.ws.StatusHolder result) throws java.rmi.RemoteException;

  <ns1:runTransformResponse
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:ns1="http://localhost/.../";>
   <transformID
xsi:type="xsd:string">JavaStubSimpleExample1015864465776</transformID>
   <stat1 xsi:type="ns1:Status">
    <errCode xsi:type="xsd:long">0</errCode>
    <errText xsi:nil="true"/>
   </stat1>
   <stat2 xsi:type="ns1:Status">
    <errCode xsi:type="xsd:long">0</errCode>
    <errText xsi:nil="true"/>
   </stat2>
   <result xsi:type="ns1:Status">
    <errCode xsi:type="xsd:long">0</errCode>
    <errText xsi:nil="true"/>
   </result>
  </ns1:runTransformResponse>


Success! But only because I had more than one out-only parameter in the
response by the looks of it. I remember when I looked at an RPC schema
somewhere, it contained only a single <result> element in a response.
Looks like WSDL2Java is deciding itself whether to use a return value
(name generated from the message name), or to use object holders for
output-only parameters.


cheers,
    Simon

Reply via email to