Use JAX-WS tools to generate the Java™ artifacts that are needed to develop JAX-WS Web services when starting with a Web Services Description Language (WSDL) file.
When using a top-down development approach to developing Java API for XML-Based Web Services (JAX-WS) Web services by starting with a Web Services Description Language (WSDL) file, you must obtain the Uniform Resource Locator (URL) of the WSDL file.
If the WSDL file is
a local file, the URL looks like this example: file:drive:\path\file_name.wsdl.
If the WSDL file is a local file,
the URL looks like this example: file:/path/file_name.wsdl.
You can also specify local files using the absolute or relative file system path.
app_server_root\bin\wsimport.bat wsdl_URL
app_server_root/bin/wsimport.sh wsdl_URL
app_server_root/bin/wsimport wsdl_URL
wsimport -keep -wsdllocation=META-INF/wsdl/MyService.wsdl
bpracYou can customize the bindings in your WSDL file to enable asynchronous mappings or attachments. To generate asynchronous interfaces, add the client-side only customization enableAsyncMapping binding declaration to the wsdl:definitions element or in an external binding file that is defined in the WSDL file. Use the enableMIMEContent binding declaration in your custom client or server binding file to enable or disable the default mime:content mapping rules. For additional information on custom binding declarations, see chapter 8 the JAX-WS specification.
Read about the wsimport command to learn more about this command and additional options that you can specify.
<?xml version="1.0" encoding="UTF-8"?> <!-- * This program can be used, run, copied, modified and distributed * without royalty for the purpose of developing, using, marketing, or distributing. --> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://com/ibm/was/wssample/sei/ping/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PingService" targetNamespace="http://com/ibm/was/wssample/sei/ping/"> <wsdl:types> <xsd:schema targetNamespace="http://com/ibm/was/wssample/sei/ping/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="pingStringInput"> <xsd:complexType> <xsd:sequence> <xsd:element name="pingInput" type="xsd:string" /> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </wsdl:types> <wsdl:message name="pingOperationRequest"> <wsdl:part element="tns:pingStringInput" name="parameter" /> </wsdl:message> <wsdl:portType name="PingServicePortType"> <wsdl:operation name="pingOperation"> <wsdl:input message="tns:pingOperationRequest" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="PingSOAP" type="tns:PingServicePortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="pingOperation"> <soap:operation soapAction="pingOperation" style="document" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> </wsdl:operation> </wsdl:binding> <wsdl:service name="PingService"> <wsdl:port binding="tns:PingSOAP" name="PingServicePort"> <soap:address location="http://localhost:9080/WSSampleSei/PingService" /> </wsdl:port> </wsdl:service> </wsdl:definitions>
app_server_root\bin\wsimport.bat -keep -verbose ping.wsdl
. ./setupCmdLine.sh (Notice the space between the periods.)from the . /app_server_root>/bin directory. Run the wsimport command,
app_server_root/bin/wsimport.sh -keep -verbose ping.wsdl
app_server_root/bin/wsimport -keep -verbose ping.wsdl
com\ibm\was\wssample\sei\ping\ObjectFactory.java com\ibm\was\wssample\sei\ping\package-info.java com\ibm\was\wssample\sei\ping\PingServicePortType.java com\ibm\was\wssample\sei\ping\PingStringInput.java com\ibm\was\wssample\sei\ping\PingService.java
The ObjectFactory.java file contains factory methods for each Java content interface and Java element interface generated in the associated ping package. The package-info.java file takes the targetNamespace value and creates the directory structure. The PingServicePortType.java file is the generated service endpoint interface (SEI) class that contains the ping method definition. The PinStringInput.java file contains the JAXB generated type values which are Java classes mapped from XML schema types. The PingService.java file is the generated service provider class file that is used by the JAX-WS client.
In this information ...Subtopics
| IBM Redbooks, demos, education, and more(Index) |