JAX-WS Example Document Style
Like RPC style, we can create JAX-WS example in document style. To do so, you need to change only one line in service interface.
You need to use Style.DOCUMENT for @SOAPBinding annotation in place of Style.RPC. Let's have a quick look at this:
Now Let's see the full example of JAX-WS in document style.
There are created 4 files for hello world JAX-WS document style example:
The first 3 files are created for server side and 1 application for client side.
JAX-WS Server Code
If you run the publisher class, it may generate following error:
Wrapper class com.javatpoint.GetHelloWorldAsString is not found. Have you run APT to generate them?
To solve the problem, go to bin directory of your current project in command prompt and run the following command:
wsgen -keep -cp . com.javatpoint.HelloWorldImpl
Now, it will generator 2 files:
Paste these files in com.javatpoint directory and then run the publisher class.
How to view generated WSDL
After running the publisher code, you can see the generated WSDL file by visiting the URL:
JAX-WS Client Code
Hello World JAX-WS javatpoint document
Click me to download JAX-WS server example Document style (eclipse)
Click me to download JAX-WS client example Document style (eclipse)