Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
14.4. JAX-WS Web service Clients
14.4.1. Consume and Access a JAX-WS Web Service Link kopierenLink in die Zwischenablage kopiert!
- Create the client artifacts.
- Construct a service stub.
- Access the endpoint.
Before you can create client artifacts, you need to create your WSDL contract. The following WSDL contract is used for the examples presented in the rest of this topic.
Example 14.16. Example WSDL Contract
Note
wsconsume.sh
or wsconsume.bat
tool is used to consume the abstract contract (WSDL) and produce annotated Java classes and optional sources that define it. The command is located in the EAP_HOME/bin/
directory of the JBoss EAP 6 installation.
Example 14.17. Syntax of the wsconsume.sh
Command
.java
files listed in the output, from the ProfileMgmtService.wsdl
file. The sources use the directory structure of the package, which is specified with the -p
switch.
.java
source files and compiled .class
files are generated into the output/
directory within the directory where you run the command.
File | Description |
---|---|
ProfileMgmt.java
|
Service endpoint interface.
|
Customer.java
|
Custom data type.
|
Discount*.java
|
Custom data types.
|
ObjectFactory.java
|
JAXB XML registry.
|
package-info.java
|
JAXB package annotations.
|
ProfileMgmtService.java
|
Service factory.
|
wsconsume.sh
command generates all custom data types (JAXB annotated classes), the service endpoint interface and a service factory class. These artifacts are used the build web service client implementations.
Web service clients use service stubs to abstract the details of a remote web service invocation. To a client application, a WS invocation looks like an invocation of any other business component. In this case the service endpoint interface acts as the business interface, and a service factory class is not used to construct it as a service stub.
Example 14.18. Constructing a Service Stub and Accessing the Endpoint
wsconsume.sh
command to build the service stub. Finally, the stub can be used just as any other business interface would be.