Skip navigation.

Programming WebLogic Web Services

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader

Using SOAP 1.2

The following sections provide information about using SOAP 1.2 as the message format:


Overview of Using SOAP 1.2

By default, a WebLogic Web Service uses SOAP 1.1 as the message format when a client application invokes one of its operations. You can, however, use SOAP 1.2 as the message format by updating the web-services.xml file and specifying a particular attribute in clientgen when you generate the client stubs.

Warning: BEA's SOAP 1.2 implementation is based on the W3C Working Draft specification (June 26, 2002). Because this specification is not yet a W3C Recommendation, BEA's current implementation is subject to change. BEA highly recommends that you use the SOAP 1.2 feature included in this version of WebLogic Server in a development environment only.

When a WebLogic Web Service is configured to use SOAP 1.2 as the message format:


Specifying SOAP 1.2 for a WebLogic Web Service: Main Steps

The following procedure assumes that you are familiar with the servicegen Ant task, and you want to update the Web Service to use SOAP 1.2 as the message format. For an example of using servicegen, see Creating a WebLogic Web Service: A Simple Example.

  1. Update the build.xml file that contains the call to the servicegen Ant task, adding the attribute useSOAP12="True" to the <service> element that builds your Web Service, as shown in the following example:
contextURI="web_services" >
useSOAP12="True" >

Note: If you are not using servicegen, you can update the web-services.xml file of your WebLogic Web Service manually. For details, see Updating the web-services.xml File Manually.

  1. Re-run the servicegen Ant task to regenerate your Web Service to use SOAP 1.2.
  2. For general details about the servicegen Ant task, see Creating the Build File That Specifies the servicegen Ant Task.

  3. Re-run the clientgen Ant task.
  4. Because the WSDL of the Web Service has been updated to include an additional port with a SOAP 1.2 binding, the clientgen Ant task automatically creates new stubs that contains these SOAP 1.2-specific getPort() methods.

    For details, see Generating the Client JAR File by Running the clientgen Ant Task.

See Invoking a Web Service Using SOAP 1.2 for details about writing a Java client application that invokes your Web Service.


Updating the web-services.xml File Manually

The web-services.xml file is located in the WEB-INF directory of the Web application of the Web Services EAR file. See The Web Service EAR File Package for more information on locating the file.

To update the web-services.xml file to specify SOAP 1.2:

  1. Open the file in your favorite editor.
  2. Add the useSOAP12="True" attribute to the <web-service> element that describes your Web Service. For example:
  3. <web-service


Invoking a Web Service Using SOAP 1.2

When writing your client application to invoke the SOAP 1.2-enabled WebLogic Web Service, you first use the clientgen Ant task to generate the Web Service-specific client JAR file that contains the generated stubs, as usual. The clientgen Ant task in this case generates a JAX-RPC Service implementation that contains two getPort() methods: the standard one for SOAP 1.1, called getServiceNamePort(), and a second one for SOAP 1.2, called getServiceNamePortSoap12(), where ServiceName refers to the name of your Web Service. These two getPort() methods correspond to the two port definitions in the generated WSDL of the Web Service, as described in Overview of Using SOAP 1.2.

The following example of a simple client application shows how to invoke the helloWorld operation of the MyService Web Service using both SOAP 1.1 (via the getMyservicePort() method) and SOAP 1.2 (via the getMyServicePortSoap12() method):

public class Main{
  public static void main( String[] args ) throws Exception{
    MyService service = new MyService_Impl();
    MyServicePort port = service.getMyServicePort();
System.out.println( port.helloWorld() );
    port = service.getMyServicePortSoap12();
System.out.println( port.helloWorld() );


Skip navigation bar  Back to Top Previous Next