bea.com | products | dev2dev | support | askBEA
 Download Docs   Site Map   Glossary 
Search

Programming WebLogic Web Services

 Previous Next Contents View as PDF  

Using JMS Transport to Invoke a WebLogic Web Service

The following sections provide information about using JMS transport to invoke a WebLogic Web Service:

 


Overview of Using JMS Transport

By default, client applications use HTTP/S as the connection protocol when invoking a WebLogic Web Service. You can, however, configure your Web Service so that client applications can also use JMS as the transport when invoking the Web Service.

When a WebLogic Web Service is configured to also use JMS as the connection transport:

Note: You can use JMS transport to invoke only one-way operations.

 


Specifying JMS Tranport for a WebLogic Web Service: Main Steps

The following procedure assumes that you have already implemented and assembled a WebLogic Web Service and you want to update it to use JMS transport.

  1. Invoke the Administration Console in your browser, as described in Overview of Administering WebLogic Web Services.
  2. Use the Administration Console to create (if they do not already exist) and configure the following JMS components of WebLogic Server:
  3. Update the web-services.xml file of your WebLogic Web Service to specify that the generated WSDL of the WebLogic Web Service include a port that uses a JMS binding.

    For details, see Updating the web-services.xml File.

  4. Re-run the clientgen Ant task to create new stubs that contain the getPort() methods that return a port with a JMS transport binding.

    For details, see Running the clientgen Ant Task.

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

Updating the web-services.xml File

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 JMS transport, follow these steps:

  1. Open the file in your favorite editor.
  2. Add the jmsUri attribute to the <web-service> element that describes your Web Service and set the attribute to the following value:
    connection-factory-name/queue-name 

    where connection-factory-name and queue-name are the JNDI names of the JMS connection factory and JMS queues, respectively, that you previously created. For example:

    <web-service
    name="myJMSTransportWebService"
    jmsUri="JMSTransportFactory/JMSTransportQueue"
    ...>
    ...
    </web-service>
  3. Ensure that every operation of your Web Service is one-way.

    This means that every <operation> child element of this <web-service> element must specify the invocation-style="one-way" attribute. For example:

    <operation  name="sendQuote"
    component="simpleStockQuoteBean"
    invocation-style="one-way">
    </operation>

 


Invoking a Web Service Using JMS Transport

Invoking a WebLogic Web Service using the JMS transport is very similar to using HTTP/S, as described in Invoking Web Services, but with the following restrictions:

When writing your client appliction to invoke the JMS-transport-enabled 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 of your Web Service that contains two getPort() methods: the standard one for HTTP/S, called getServiceNamePort(), and a second one for using JMS transport, called getServiceNamePortJMS(), 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 JMS Transport.

The following example of a simple client application shows how to invoke the postWorld operation of the MyService Web Service using both the HTTP/S transport (via the getMyservicePort() method) and the JMS transport (via the getMyServicePortJMS() method):

package examples.jms.client;
import java.io.IOException;
public class Main{
  public static void main( String[] args ) throws Exception{
    MyService service = new MyService_Impl();
    { //using HTTP transport
MyServicePort port = service.getMyServicePort();
port.postWorld( "using HTTP" );
}
    { //using JMS transport
MyServicePort port = service.getMyServicePortJMS();
port.postWorld( "using JMS" );
}
}
}

 

Back to Top Previous Next