Tutorial: Build a JAX-WS web services with message level security in Weblogic 10.3

In this example I will show you how to build a JAX-WS web services with message level security in Weblogic 10.3 step by step. This demo is based on weblogic example jaxws/wsdl2service you can find it in your {weblogic_folder}\samples\server\examples\src\examples\webservices\jaxws\wsdl2service.
And, I am using MyEclipse 8.0,  you can choose your perfer IDEs.

1. Create a web service project.

2. Create web services from WSDL, specify the WSDL file, point to WarehouseService.wsdl.


Client next, then Finish. You will see the web services are created.

3. Modify the impl class (WarehouseShipmentsPortImpl.java)


4. Setup server key stores. Go to weblogic console, in the "Setting of {name}Domain", tab "Web Services Security", create the default configuration "default_wss".
4.1 Create Credential Provider
4.2 Add Provider properties
4.3 Add Token Handler
4.4 Add Token Handler properties

5. Setup authentication. The security policy we have chosen will using the CN from the client certificate to verify the authentication. So we need create a user with a name same as the CN. Here I have created a user "ws_clientdev" same as my client cert CN.


6. Generate and modify web service client.
6.1 Use MyEclipse generate web service client from WSDL and modify the client service -- WarehouseService.java, as

6.2 Modify the client to use proper URL,

7. Deploy the web service to weblogic server and run the client.
Note, you may need add weblogic.jar into the build path, but make sure you remove it from the deployment package, otherwise an error "The web service defined by the class weblogic.wsee.async.AsyncResponseBean does not contain any valid WebMethods." or if you do not using any Asynchronous feature add "-Dweblogic.wsee.skip.async.response=true" when you start weblogic.
8. Debug the test
Add "-Dweblogic.wsee.verbose=*" into JVM to start weblogic server, then you will be able to have very detail information to help you debug your web services.


Also please check my new web site Scan2D QR Code Mobile Solution