This feature can be implemented only for a JAX-RPC 1.1-based Web Service; you cannot implement it for a JAX-WS 2.0 Web Service.

Overview of Using JMS Transport

Typically, client applications use HTTP/S as the connection protocol when invoking a WebLogic Web Service. You can, however, configure a WebLogic Web Service so that client applications use JMS as the transport instead. You configure transports using either JWS annotations or child elements of the jwsc Ant task, as described in later sections.

When a WebLogic Web Service is configured to use JMS as the connection transport, the endpoint address specified for the corresponding port in the generated WSDL of the Web Service uses jms:// in its URL rather than http://. An example of a JMS endpoint address is as follows:

jms://myHost:7001/transports/JMSTransport?URI=JMSTransportQueue

The URI=JMSTransportQueue section of the URL specifies the JMS queue that has been configured for the JMS transport feature. Although you cannot invoke the Web Service using HTTP, you can view its WSDL using HTTP, which is how the clientgen is still able to generate JAX-RPC stubs for the Web Service.

For each transport that you specify, WebLogic Server generates an additional port in the WSDL. For this reason, if you want to give client applications a choice of transports they can use when they invoke the Web Service (JMS, HTTP, or HTTPS), you should explicitly add the transports using the appropriate JWS annotations or child elements of jwsc.

Caution:

Using JMS transport is an added-value WebLogic feature; non-WebLogic client applications, such as a.NET client, may not be able to invoke the Web Service using the JMS port.

Using JMS Transport Starting From Java: Main Steps

To use JMS transport when starting from Java, you must peform at least one of the following tasks:

Add the @WLJmsTransport annotation to your JWS file.

Add a <WLJmsTransport> child element to the jwsc Ant task. This setting overrides the transports defined in the JWS file.

Note:

Because you might not know at the time that you are coding the JWS file which transport best suits your needs, it is often better to specify the transport at build-time using the <WLJmsTransport> child element.

The following procedure describes the complete set of steps required so that your Web Service can be invoked using the JMS transport when starting from Java.

Note:

It is assumed that you have already created a basic JWS file that implements a Web Service and that you want to configure the Web Service to be invoked using JMS. It is also assumed that you have set up an Ant-based development environment and that you have a working build.xml file that includes targets for running the jwsc Ant task and deploying the service. For more information, see:

You can either configure these resources yourself, or you can use the Configuration Wizard to extend the WebLogic Server domain using a Web Services-specific extension template. Using the Configuration Wizard greatly simplifies the required configuration steps; for details, see Configuring Your Domain For Web Services Features.

If, however, you prefer to configure the resources yourself, follow these steps:

JMS Queue, contained within the preceding JMS module. You can either specify the JNDI name of the JMS queue that WebLogic Web Services listen to by default (weblogic.wsee.DefaultQueue) or specify a different name. If you specify a different JNDI name, you later pass this name to the Web Service itself. When you configure the queue, be sure you specify that this JMS queue is local, typically by setting the local JNDI name.See Create queues in a system module.

Except for the JNDI name of the JMS queue, you can name the other components anything you want.

Add the @WLJmsTransport annotation to your JWS file.

This step is optional. If you do not add the @WLJmsTransport annotation to your JWS file, then you must add a <WLJmsTransport> child element to the jwsc Ant task, as described in Step 3. See Using the @WLJmsTransport JWS Annotation.

Add a <WLJmsTransport> child element to the jwsc Ant task.

Use the <WLJmsTransport> child element to override the transports defined in the JWS file. This step is required if you did not add the @WLJmsTransport annotation to your JWS file in Step 2. Otherwise, this step is optional.

Add a <WLJmsTransport> child element to the jwsc Ant task used to build the JWS implementation file. This setting overrides the transports defined in the JWS file.

Note:

Because you might not know at the time that you are coding the JWS file which transport best suits your needs, it is often better to specify the transport at build-time using the <WLJmsTransport> child element.

The following procedure describes the complete set of steps required so that your Web Service can be invoked using the JMS transport when starting from WSDL.

Note:

It is assumed in this procedure that you have an existing WSDL file.

Configure the WebLogic Server domain for the required JMS components.

You can either configure these resources yourself, or you can use the Configuration Wizard to extend the WebLogic Server domain using a Web Services-specific extension template. Using the Configuration Wizard greatly simplifies the required configuration steps; for details, see Configuring Your Domain For Web Services Features.

If, however, you prefer to configure the resources yourself, follow these steps:

JMS Queue, contained within the preceding JMS module. You can either specify the JNDI name of the JMS queue that WebLogic Web Services listen to by default (weblogic.wsee.DefaultQueue) or specify a different name. If you specify a different JNDI name, you later pass this name to the Web Service itself. When you configure the queue, be sure you specify that this JMS queue is local, typically by setting the local JNDI name.See Create queues in a system module.

Except for the JNDI name of the JMS queue, you can name the other components anything you want.

Update the WSDL to use JMS transport.

This step is optional. If you do not update the WSDL to use JMS transport, then you must do at least one of the following:

Edit the stubbed out JWS file to add the @WLJmsTransport annotation to your JWS file, as described in Step 4.

Add a <WLJmsTransport> child element to the jwsc Ant task, as described in Step 5.

For example, if the target that calls the wsdlc Ant task is called generate-from-wsdl, then you would run:

prompt> ant generate-from-wsdl

Update the stubbed-out JWS file.

The wsdlc Ant task generates a stubbed-out JWS file. You need to add your business code to the Web Service so it behaves as you want.

If you updated the WSDL to use the JMS transport in Step 2, the JWS file includes the @WLJmsTransport annotation that defines the JMS transport. If the @WLJmsTransport annotation is not included in the JWS file, you must do at least one of the following:

Using the @WLJmsTransport JWS Annotation

If you know at the time that you program the JWS file that you want client applications to use JMS transport (instead of HTTP/S) to invoke the Web Service, you can use the @WLJmsTransport to specify the details of the invoke. Later, at build-time, you can override the one in the JWS file and add additional JMS transport specifications, by specifying the <WLJmsTransport> child element of the jwsc Ant task, as described in Using the <WLJmsTransport> Child Element of the jwsc Ant Task.

Follow these guidelines when using the @WLJmsTranport annotation:

You can include only one@WLJmsTransport annotation in a JWS file.

Use the queue attribute to specify the JNDI name of the JMS queue you configured earlier in the section. If you want to use the default Web Services queue (weblogic.wsee.DefaultQueue) then you do not have to specify the queue attribute.

The following example shows a simple JWS file that uses the @WLJmsTransport annotation, with the relevant code in bold:

Using the <WLJmsTransport> Child Element of the jwsc Ant Task

You can also specify the JMS transport at build-time by using the <WLJmsTransport> child element of the <jws> element of the jwsc Ant task. Reasons for specifying the transport at build-time include:

You need to override the attribute values specified in the JWS file.

The JWS file specifies a different transport, and at build-time you decide that JMS should be the transport.

The JWS file does not include a @WLXXXTransport annotation; thus by default the HTTP transport is used, but at build-time you decide you want to clients to use the JMS transport to invoke the Web Service.

If you specify a transport to the jwsc Ant task, it takes precedence over any transport annotation in the JWS file.

The following example shows how to specify a transport to the jwsc Ant task:

Although you cannot invoke a JMS-transport-configured Web Service using HTTP, you can view its WSDL using HTTP, which is how the clientgen Ant task is still able to create the JAX-RPC stubs for the Web Service. For example, the URL for the WSDL of the Web Service shown in this section would be:

http://host:port/transports/JMSTransport?WSDL

However, because the endpoint address in the WSDL of the deployed Web Service uses jms:// instead of http://, and the address includes the qualifier ?URI=JMS_QUEUE, the clientgen Ant task automatically creates the stubs needed to use the JMS transport when invoking the Web Service, and your client application need not do anything different than normal. An example of a JMS endpoint address is as follows:

jms://host:port/transports/JMSTransport?URI=JMSTransportQueue

WARNING:

If you have specified that the Web Service you invoke using JMS transport also runs within the context of a transaction (in other words, the JWS file includes the @weblogic.jws.Transactional annotation), you must use asynchronous request-response when invoking the service. If you do not, a deadlock will occur and the invocation will fail.

Overriding the Default Service Address URL

When you write a client application that uses the clientgen-generated JAX-RPC stubs to invoke a Web Service, the default service address URL of the Web Service is the one specified in the <address> element of the WSDL file argument of the Service constructor.

Sometimes, however, you might need to override this address, in particular when invoking a WebLogic Web Service that is deployed to a cluster and you want to specify the cluster address or a list of addresses of the managed servers in the cluster. You might also want to use the t3 protocol to invoke the Web Service. To override this service endpoint URL when using JMS transport, use the weblogic.wsee.jaxrpc.WLStub.JMS_TRANSPORT_JNDI_URL stub property as shown in the following example:

Using JMS BytesMessage Rather Than the Default TextMessage

When you use JMS transport, the Web Services runtime uses, by default, the javax.jms.TextMessage object to send the message. This is usually adequate for most client applications, but sometimes you might need to send binary data rather than ordinary text; in this case you must request that the Web Services runtime use javax.jms.BytesMessage instead. To do this, use the WLStub.JMS_TRANSPORT_MESSAGE_TYPE stub property in your client application and set it to the value WLStub.JMS_BYTESMESSAGE, as shown in the following example:

The Web Services runtime sends back the response using the same message data type as the request.

See
“Overriding the Default Service Address URL” on page 1-7 for a full example of a client application in which you can set this property. See WLStub reference documentation for additional stub properties.

Disabling HTTP Access to the WSDL File

As described in
“Invoking a WebLogic Web Service Using JMS Transport” on page 1-6, the WSDL of the deployed Web Service is, by default, still accessible using HTTP. If you want to disable access to the WSDL file, in particular if your Web Service can be accessed outside of a firewall, then you can do one of the following:

Use the weblogic.jws.WSDL annotation in your JWS file to programmatically disable access. For details, see weblogic.jws.WSDL.

Use the Administration Console to disable access to the WSDL file after the Web Service has been deployed. In this case, the configuration information will be stored in the deployment plan rather than through the annotation.

To use the Administration Console to perform this task, go to the Configuration -> General page of the deployed Web Service and uncheck the View Dynamic WSDL Enabled checkbox. After saving the configuration to the deployment plan, you must redeploy (update) the Web Service, or Enterprise Application which contains it, for the change to take effect.