This discussion is archived
0 Replies Latest reply: Feb 29, 2012 2:42 PM by 920952 RSS

Inconsistent code generation with wsdl2java tool

920952 Newbie
Currently Being Moderated
I am creating web service using axis2 , with top down approach. Initially thought of using the SOAP based webservices and created the wsdl like below.
<wsdl:message name="CreateObjInput">
     <wsdl:part name="CreateObjRequest" element="tns:CreateObjectRequest">
</wsdl:part>
</wsdl:message>

<wsdl:message name="CreateObjOutput">
     <wsdl:part name="CreateObjResponse" element="tns:CreateObjectResponse">
</wsdl:part>
</wsdl:message>

<wsdl:operation name="CreateObjectOperation">
     <wsdl:input name="CreateObjInput" message="tns:CreateObjInput" />
     <wsdl:output name="CreateObjOutput" message="tns:CreateObjOutput" />
</wsdl:operation>


<wsdl:operation name="CreateObjectOperation">
     <soap:operation soapAction="http://xyz.com/CreateObject" style="document" />
     <wsdl:input>
     <soap:body use="literal" />
</wsdl:input>
<wsdl:output>
     <soap:body use="literal" />
</wsdl:output>
</wsdl:operation>

Wsdl2java generated the service interface like below (Using Axis data bindings)

public CreateObjectResponse createObjectOperation(CreateObjectRequest request)


Now at the closure of project decided to convert the service as RESTful service. So I changed the wsdl like below very minimal change.

<wsdl:message name="CreateObjInput">
     <wsdl:part name="CreateObjRequest" element="tns:CreateObjectRequest">
     </wsdl:part>
</wsdl:message>

<wsdl:message name="CreateObjOutput">
     <wsdl:part name="CreateObjResponse" element="tns:CreateObjectResponse">
     </wsdl:part>
</wsdl:message>

<wsdl:operation name="CreateObjectOperation">
     <wsdl:input name="CreateObjInput" message="tns:CreateObjInput" wsaw:Action="urn:createObjectRequest"/>
     <wsdl:output name="CreateObjOutput" message="tns:CreateObjOutput" wsaw:Action="urn:createObjectOperationResponse"/>
</wsdl:operation>

<wsdl:operation name="CreateObjectOperation">
     <http:operation location="createObjectOperation" />
     <wsdl:input>
          <mime: type="text/xml" part="CreateObjRequest" />
     </wsdl:input>
     <wsdl:output>
          <mime: type="text/xml" part="CreateObjResponse" />
     </wsdl:output>
</wsdl:operation>

and the wsdl2java command generated the interface like below.

public CreateObjectResponse createObjectOperation(CreateObjectOperation createObjectOperation)

I tried many ways to get the interface definition like in the firstcase but didn't succeeded. This is causing the classname changes in the entire project.
Didn't understand why its generating interface like this though the wsdl is the same except wsaw actions included.

Can any one help me the get the inteface generated in compatible with the first case..

Thanks,
Sridhar

Edited by: 917949 on Feb 29, 2012 2:42 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points