User:Lindenb/Notebook/UMR915/20101018

=axis2= download from http://apache.crihan.fr/dist//ws/axis2/1_5_1/axis2-1.5.1-bin.zip

cd axis2-1.5.1/webapp ant mv axis2-1.5.1/dist/axis2.war /srv/apache-tomcat-6.0.26/webapps/


 * 1) check: http://localhost:8080/axis2/ : OK

export AXIS2_HOME=${HOME}/package/axis2-1.5.1

generating wsdl
the source:

public class HelloAxis {       public int getTwice(int value) {               return value*2; }        }

command:

axis2-1.5.1/bin/java2wsdl.sh -cp ~/workspace/SANDBOX/bin -cn HelloAxis -of helloAxis.wsdl

                </xs:complexType> </xs:element> </xs:schema> </wsdl:types> <wsdl:message name="getTwiceRequest"> <wsdl:part name="parameters" element="ns:getTwice"/> </wsdl:message> <wsdl:message name="getTwiceResponse"> <wsdl:part name="parameters" element="ns:getTwiceResponse"/> </wsdl:message> <wsdl:portType name="HelloAxisPortType"> <wsdl:operation name="getTwice"> <wsdl:input message="ns:getTwiceRequest" wsaw:Action="urn:getTwice"/> <wsdl:output message="ns:getTwiceResponse" wsaw:Action="urn:getTwiceResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="HelloAxisSoap11Binding" type="ns:HelloAxisPortType"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> <wsdl:operation name="getTwice"> <soap:operation soapAction="urn:getTwice" 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="HelloAxisSoap12Binding" type="ns:HelloAxisPortType"> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> <wsdl:operation name="getTwice"> <soap12:operation soapAction="urn:getTwice" 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="HelloAxisHttpBinding" type="ns:HelloAxisPortType"> <http:binding verb="POST"/> <wsdl:operation name="getTwice"> <http:operation location="HelloAxis/getTwice"/> <wsdl:input> <mime:content type="text/xml" part="getTwice"/> </wsdl:input> <wsdl:output> <mime:content type="text/xml" part="getTwice"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="HelloAxis"> <wsdl:port name="HelloAxisHttpSoap11Endpoint" binding="ns:HelloAxisSoap11Binding"> <soap:address location="http://localhost:8080/axis2/services/HelloAxis"/> </wsdl:port> <wsdl:port name="HelloAxisHttpSoap12Endpoint" binding="ns:HelloAxisSoap12Binding"> <soap12:address location="http://localhost:8080/axis2/services/HelloAxis"/> </wsdl:port> <wsdl:port name="HelloAxisHttpEndpoint" binding="ns:HelloAxisHttpBinding"> <http:address location="http://localhost:8080/axis2/services/HelloAxis"/> </wsdl:port> </wsdl:service> </wsdl:definitions>

generating service
services.xml:

<service name="HelloAxisService"> <messageReceivers> <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/> <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> </messageReceivers> <parameter name="ServiceClass">HelloAxis

all: rm -rf myaxisservice mkdir myaxisservice mkdir myaxisservice/META-INF cp services.xml myaxisservice/META-INF cp bin/HelloAxis.class myaxisservice jar cvf apache-tomcat-6.0.26/webapps/axis2/WEB-INF/services/myaxisservice.aar -C myaxisservice. rm -rf myaxisservice

testing
ok check at
 * http://localhost:8080/axis2/services/listServices
 * http://localhost:8080/axis2/services/HelloAxisService?wsdl
 * http://localhost:8080/axis2/services/HelloAxisService/getTwice?value=256

<ns:getTwiceResponse xmlns:ns="http://ws.apache.org/axis2"> <ns:return>512</ns:return> </ns:getTwiceResponse>

http://localhost:8080/axis2/services/HelloAxisService/getTwice?value=XXX <soapenv:Reason xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"> <soapenv:Text xml:lang="en-US">For input string: "XXX"</soapenv:Text> </soapenv:Reason>