Using JMS Transport as the Connection Protocol 8-9
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:porttransportsJMSTransport?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:porttransportsJMSTransport?URI=JMSTransportQueue
For general information about invoking a Web service, see Invoking Web Services in Getting Started With JAX-RPC Web Services for Oracle WebLogic Server.
8.8.1 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:
package examples.webservices.jmstransport.client;
import weblogic.wsee.jaxrpc.WLStub;
import java.rmi.RemoteException; import javax.xml.rpc.ServiceException;
import javax.xml.rpc.Stub; This is a simple standalone client application that invokes the
the codesayHellocode operation of the JMSTransport Web service.
public class Main { public static void mainString[] args
Note: 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.
8-10 Programming Advanced Features of JAX-RPC Web Services for Oracle WebLogic Server
throws ServiceException, RemoteException{ JMSTransportService service = new JMSTransportService_Implargs[0] + ?WSDL
; JMSTransportPortType port = service.getJMSTransportServicePort;
Stub stub = Stub port; stub._setPropertyWLStub.JMS_TRANSPORT_JNDI_URL,
t3:shackell01.amer.com:7001; try {
String result = null;
result = port.sayHelloHi there ; System.out.println Got JMS result: + result ;
} catch RemoteException e { throw e;
} }
}
See WLStub in Oracle WebLogic Server API Reference for additional stub properties.
8.8.2 Using JMS BytesMessage Rather Than the Default TextMessage