The generated client stub has and addition enclosing request object
--------------------------------------------------------------------
Key: AXIS2-4875
URL: https://issues.apache.org/jira/browse/AXIS2-4875
Project: Axis2
Issue Type: Bug
Components: codegen
Affects Versions: 1.5.2
Environment: Client stubs generated has an additional enclosing object
surrounding the actual request Objects.
Reporter: vivek BN
Hi,
Client stubs generated has an additional enclosing object surrounding the
actual request Objects.
Is there a way to avoid this.
Example:
Service to add two int's :
---------------Java Service ---------------
package com.add;
public class Add
{
public int addTest(int a, int b)
{
return a+b;
}
}
----------------------------------------------------WSDL generated ------
−
<wsdl:definitions targetNamespace="http://add.com">
<wsdl:documentation>
Please Type your service description here
</wsdl:documentation>
−
<wsdl:types>
−
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://add.com">
−
<xs:element name="addTest">
−
<xs:complexType>
−
<xs:sequence>
<xs:element minOccurs="0" name="a" type="xs:int"/>
<xs:element minOccurs="0" name="b" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
−
<xs:element name="addTestResponse">
−
<xs:complexType>
−
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
−
<wsdl:message name="addTestRequest">
<wsdl:part name="parameters" element="ns:addTest"/>
</wsdl:message>
−
<wsdl:message name="addTestResponse">
<wsdl:part name="parameters" element="ns:addTestResponse"/>
</wsdl:message>
−
<wsdl:portType name="AddPortType">
−
<wsdl:operation name="addTest">
<wsdl:input message="ns:addTestRequest" wsaw:Action="urn:addTest"/>
<wsdl:output message="ns:addTestResponse" wsaw:Action="urn:addTestResponse"/>
</wsdl:operation>
</wsdl:portType>
−
<wsdl:binding name="AddSoap11Binding" type="ns:AddPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
−
<wsdl:operation name="addTest">
<soap:operation soapAction="urn:addTest" style="document"/>
−
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
−
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
−
<wsdl:binding name="AddSoap12Binding" type="ns:AddPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
−
<wsdl:operation name="addTest">
<soap12:operation soapAction="urn:addTest" style="document"/>
−
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
−
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
−
<wsdl:binding name="AddHttpBinding" type="ns:AddPortType">
<http:binding verb="POST"/>
−
<wsdl:operation name="addTest">
<http:operation location="Add/addTest"/>
−
<wsdl:input>
<mime:content type="text/xml" part="addTest"/>
</wsdl:input>
−
<wsdl:output>
<mime:content type="text/xml" part="addTest"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
−
<wsdl:service name="Add">
−
<wsdl:port name="AddHttpSoap11Endpoint" binding="ns:AddSoap11Binding">
<soap:address
location="http://localhost:8080/AddWS/services/Add.AddHttpSoap11Endpoint/"/>
</wsdl:port>
−
<wsdl:port name="AddHttpSoap12Endpoint" binding="ns:AddSoap12Binding">
<soap12:address
location="http://localhost:8080/AddWS/services/Add.AddHttpSoap12Endpoint/"/>
</wsdl:port>
−
<wsdl:port name="AddHttpEndpoint" binding="ns:AddHttpBinding">
<http:address
location="http://localhost:8080/AddWS/services/Add.AddHttpEndpoint/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
------------------------------------------
------------------------------Client Call --------------
package com.add;
import java.rmi.RemoteException;
import org.apache.axis2.AxisFault;
import com.add.AddStub.AddTest;
import com.add.AddStub.AddTestResponse;
public class AddClient
{
public static void main(String[] args)
{
try
{
AddStub addStub = new AddStub();
AddTest addTest = new AddTest();
addTest.setA(2);
addTest.setB(3);
// AddTest, a new object is generated.
// can't we have addStub.addTest(a,b); the same method signature as
the actual service
try
{
AddTestResponse atr = addStub.addTest(addTest);
System.out.println(atr.get_return());
}
catch (RemoteException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
catch (AxisFault e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]