随手一写,记录过程,达人勿怪 ^_^
AXIS2一步一步
package com.yy.ws;
/**
* @author
* @date May 15, 2008 / 3:37:32 PM
*/
public interface MobileBoss {
public ServerResponse charge(ClientRequest req);
}
E:\tmp_doc\ax>java2wsdl Using AXIS2_HOME: D:\axis2-1.4 Using JAVA_HOME: D:\works\jdk1.5.0_06 Usage: java2wsdl [options] -cn <fully qualified class name> where [options] include: -o <output location> output directory -of <output file name> output file name for the WSDL -sn <service name> service name -l <soap address> address of the port for the WSDL -cp <class path uri> list of classpath entries - (urls) -tn <target namespace> target namespace for service -tp <target namespace prefix> target namespace prefix for service -stn <schema target namespace> target namespace for schema -stp <schema target namespace prefix> target namespace prefix for schema -st <binding style> style for the WSDL -u <binding use> use for the WSDL -nsg <class name> fully qualified name of a class that implements NamespaceGenerator -sg <class name> fully qualified name of a class that implements SchemaGenerator -p2n [<java package>,<namespace] [<java package>,<namespace]... java package to namespace mapping for argument and return types -p2n [all, <namespace>] to assign all types to a single namespace -efd <qualified/unqualified> setting for elementFormDefault (defaults to qualified) -afd <qualified/unqualified> setting for attributeFormDefault (defaults to qualified) -xc class1 -xc class2... extra class(es) for which schematype must be generated. -wv <1.1/2.0> wsdl version - defaults to 1.1 if not specified -dlb generate schemas conforming to doc/lit/bare style E:\tmp_doc\ax>java2wsdl -cp . -cn com.yy.ws.MobileBoss -of MobileBoss.wsdl Using AXIS2_HOME: D:\axis2-1.4 Using JAVA_HOME: D:\works\jdk1.5.0_06 [WARN] Unable to generate EPR for the transport : http
则生成wsdl文件:
<?xml version="1.0" encoding="UTF-8" ?> - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:ns="http://ws.yy.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://ws.yy.com"> <wsdl:documentation>mobile</wsdl:documentation> - <wsdl:types> - <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://ws.yy.com"> - <xs:element name="charge"> - <xs:complexType> - <xs:sequence> <xs:element minOccurs="0" name="charge" nillable="true" type="xs:anyType" /> </xs:sequence> </xs:complexType> </xs:element> - <xs:element name="chargeResponse"> - <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="chargeRequest"> <wsdl:part name="parameters" element="ns:charge" /> </wsdl:message> - <wsdl:message name="chargeResponse"> <wsdl:part name="parameters" element="ns:chargeResponse" /> </wsdl:message> - <wsdl:portType name="mobilePortType"> - <wsdl:operation name="charge"> <wsdl:input message="ns:chargeRequest" wsaw:Action="urn:charge" /> <wsdl:output message="ns:chargeResponse" wsaw:Action="urn:chargeResponse" /> </wsdl:operation> </wsdl:portType> - <wsdl:binding name="mobileSoap11Binding" type="ns:mobilePortType"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> - <wsdl:operation name="charge"> <soap:operation soapAction="urn:charge" 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="mobileSoap12Binding" type="ns:mobilePortType"> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> - <wsdl:operation name="charge"> <soap12:operation soapAction="urn:charge" 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="mobileHttpBinding" type="ns:mobilePortType"> <http:binding verb="POST" /> - <wsdl:operation name="charge"> <http:operation location="mobile/charge" /> - <wsdl:input> <mime:content type="text/xml" part="charge" /> </wsdl:input> - <wsdl:output> <mime:content type="text/xml" part="charge" /> </wsdl:output> </wsdl:operation> </wsdl:binding> - <wsdl:service name="mobile"> - <wsdl:port name="mobileHttpSoap11Endpoint" binding="ns:mobileSoap11Binding"> <soap:address location="http://192.168.2.187:8090/axix/services/mobile.mobileHttpSoap11Endpoint" /> </wsdl:port> - <wsdl:port name="mobileHttpSoap12Endpoint" binding="ns:mobileSoap12Binding"> <soap12:address location="http://192.168.2.187:8090/axix/services/mobile.mobileHttpSoap12Endpoint" /> </wsdl:port> - <wsdl:port name="mobileHttpEndpoint" binding="ns:mobileHttpBinding"> <http:address location="http://192.168.2.187:8090/axix/services/mobile.mobileHttpEndpoint" /> </wsdl:port> </wsdl:service> </wsdl:definitions>
wsdl2java
E:\tmp_doc\ax>wsdl2java -o . -sn MobileBoss com.yy.ws -uri MobileBoss.wsdl Using AXIS2_HOME: D:\axis2-1.4 Using JAVA_HOME: D:\works\jdk1.5.0_06 Retrieving document at 'MobileBoss.wsdl'.
则生成 build.xml及两个java类(目录自动建立):
com.yy.ws. MobileBossStub.java/MobileBossCallbackHandler.java