hi, please read the user guide[1]. thanks, Amila.
[1]http://ws.apache.org/axis2/1_5/toc.html On Wed, Oct 21, 2009 at 2:16 AM, mule_user <[email protected]> wrote: > > I am using the post below for learning purses: > > https://www.wso2.org/library/90 > > I would like to know how to write client code using the stubs etc. that get > created WITHOUT using AXIOM API. I am familiar with Axis1. > > My questions: > > 1. Can I write client code similar to Axis1 that does not require using > AXIOM API? > > 2. Could anyone provide some example of doing so? > > 3. In Axis1, I can write client without importing any Axis1 specific class. > An example of client code in Axis1 is similar to the following: > > MyService service = new MyServiceLocator(); > MyObject obj = service.getMyObj(); > int ret = obj.add(1, 2); > > In the client code above for Axis1, I only need to call the corresponding > Service and ServiceLocator class. I do not need to know any other class > specific to Axis1. > > Could you please provide similar example of doing so without using the > AXIOM > API? > > I tried coding something similar to the following for Axis2 client: > > CalculatorService service = new CalculatorServiceLocator(); > Call call= (Call) service.createCall(); > String > endpoint="http://localhost:9081/Axis2WebWs/services/CalculatorService" ; > call.setTargetEndpointAddress( new java.net.URL(endpoint) ); > QName operationName = new QName("add"); > call.setOperationName(operationName); > Integer ret = (Integer) call.invoke( new Object[] { 1, 2} ); > > It threw exception in invoke method as: > > The ServiceClass object does not implement the required method in the > following form: OMElement add(OMElement e) > at > > org.apache.axis2.receivers.RawXMLINOutMessageReceiver.invokeBusinessLogic(RawXMLINOutMessageReceiver.java:93) > at > > org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42) > > My services.xml is: > > <service name="CalculatorService" scope="application"> > <description> > Simple Calculator Service > </description> > > <parameter name="ServiceClass">org.server.Calculator</parameter> > > <operation name="add"> > <messageReceiver > class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> > </operation> > > </service> > > The method add is: > > Integer add(int i, int j) > > Is there any way to write client code (similar to Axis1) that does not > involve AXIOM API? Please provide an example. > > 4. In the generated wsdl, I see soapbinding11 and soapbing12. Where are > there two different bindings generated? > > The generated wsdl is: > > </xs:complexType> > </xs:element> > <xs:element name="addResponse"> > <xs:complexType> > <xs:sequence> > <xs:element minOccurs="0" name="return" nillable="true" type="xs:anyType" > /> > </xs:sequence> > </xs:complexType> > </xs:element> > </xs:schema> > </wsdl:types> > <wsdl:message name="addRequest"> > <wsdl:part name="parameters" element="ns:add" /> > </wsdl:message> > <wsdl:message name="addResponse"> > <wsdl:part name="parameters" element="ns:addResponse" /> > </wsdl:message> > <wsdl:portType name="CalculatorServicePortType"> > <wsdl:operation name="add"> > <wsdl:input message="ns:addRequest" wsaw:Action="urn:add" /> > <wsdl:output message="ns:addResponse" wsaw:Action="urn:addResponse" /> > </wsdl:operation> > </wsdl:portType> > <wsdl:binding name="CalculatorServiceSoap11Binding" > type="ns:CalculatorServicePortType"> > <soap:binding transport="http://schemas.xmlsoap.org/soap/http" > style="document" /> > <wsdl:operation name="add"> > <soap:operation soapAction="urn:add" 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="CalculatorServiceSoap12Binding" > type="ns:CalculatorServicePortType"> > <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" > style="document" /> > <wsdl:operation name="add"> > <soap12:operation soapAction="urn:add" 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="CalculatorServiceHttpBinding" > type="ns:CalculatorServicePortType"> > <http:binding verb="POST" /> > <wsdl:operation name="add"> > <http:operation location="CalculatorService/add" /> > <wsdl:input> > <mime:content type="text/xml" part="add" /> > </wsdl:input> > <wsdl:output> > <mime:content type="text/xml" part="add" /> > </wsdl:output> > </wsdl:operation> > </wsdl:binding> > <wsdl:service name="CalculatorService"> > <wsdl:port name="CalculatorServiceHttpSoap11Endpoint" > binding="ns:CalculatorServiceSoap11Binding"> > <soap:address > location=" > http://localhost:9081/Axis2WebWs/services/CalculatorService.CalculatorServiceHttpSoap11Endpoint/ > " > /> > </wsdl:port> > <wsdl:port name="CalculatorServiceHttpSoap12Endpoint" > binding="ns:CalculatorServiceSoap12Binding"> > <soap12:address > location=" > http://localhost:9081/Axis2WebWs/services/CalculatorService.CalculatorServiceHttpSoap12Endpoint/ > " > /> > </wsdl:port> > <wsdl:port name="CalculatorServiceHttpEndpoint" > binding="ns:CalculatorServiceHttpBinding"> > <http:address > location=" > http://localhost:9081/Axis2WebWs/services/CalculatorService.CalculatorServiceHttpEndpoint/ > " > /> > </wsdl:port> > </wsdl:service> > </wsdl:definitions> > > -- > View this message in context: > http://www.nabble.com/Axis2---How-to-write-client-without-using-AXIOM-API%2C-similar-to-Axis1-tp25982259p25982259.html > Sent from the Axis - User mailing list archive at Nabble.com. > > -- Amila Suriarachchi WSO2 Inc. blog: http://amilachinthaka.blogspot.com/
