First let us look at the imports statements used in the above java class:

Below imports are required to use the Weblogic specific annotations to make this class as a web service class and to create the username token provider(weblogic.wsee.security.unt.ClientUNTCredentialProvider) to be added to the generated port.

import javax.jws.WebService;

import javax.jws.WebMethod;

import weblogic.xml.crypto.wss.provider.CredentialProvider;

import weblogic.wsee.security.unt.ClientUNTCredentialProvider;

import weblogic.xml.crypto.wss.WSSecurityContext;

import javax.xml.ws.BindingProvider;

import java.util.List;

import java.util.ArrayList;

import java.util.Map;

below imports are used to get the web service object and the port object:

import demo.HelloService;

import demo.Hello;

Now after creating the above Class we will use the below JWSC ant of Weblogic to make the web service artifacts from the above class:

2: Create a dir : sample and place the above mentioned build.xml file in this sample dir:

3: create another dir inside sample dir : JAXWSWebServiceClient and place the JaxWSClient.java class in this dir:

4: Now open a command prompt and run the setDomainEnv.cmd file on this command prompt to set the necessary classpath and other environment variables. setDomainEnv.cmd file is available in the domain_home/bin dir:

5: Then on the command prompt opened above move to the sample dir created above:

6: from the command prompt run the following task:

ant JAXWS-build-client-service

this task is going to build the web service war for the current java class and the clientgen child ant task used within this task is going to create the necessary client artifacts from the WSDL url:

7: After successful completion of the above task run the below task to deploy the created war file:

ant JAXWSdeploy

8: After the deployment is successful you can log in to the Weblogic Admin Server Console and go to the Deployments Summary to see the deployed Web Service.

9: When you will open the Weblogic Web Service Client for this deployed Web Service with name: JAXWSClientEar then you will see the below window:

10: Just Clicking on the callJAXWS button available on the Weblogic web service Client window will invoke this client web service which in turn will call the Secured Web Service and you can see the below output on the Weblogic Server Standard output: