Using JMS Transport as the Connection Protocol 8-7
serviceName=JMSTransportService, targetNamespace=http:example.org
SOAPBindingstyle=SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL,
parameterStyle=SOAPBinding.ParameterStyle.WRAPPED
WebLogic-specific JWS annotation that specifies the context path and service URI used to build the URI of the Web Service is
transportsJMSTransport
WLJmsTransportcontextPath=transports, serviceUri=JMSTransport, queue=JMSTransportQueue, portName=JMSTransportServicePort,
connectionFactory=JMSTransportConnectionFactory
This JWS file forms the basis of simple Java-class implemented WebLogic Web Service with a single operation: sayHello
public class JMSTransportImpl { WebMethod
public String sayHelloString message { System.out.printlnsayHello: + message;
return Here is the message: + message + ; }
}
8.6 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: target name=build-service
jwsc srcdir=src
destdir={ear-dir} jws file=exampleswebservicesjmstransportJMSTransportImpl.java
WLJmsTransport contextPath=transports
serviceUri=JMSTransport portName=JMSTransportServicePort
queue=JMSTransportQueue
8-8 Programming Advanced Features of JAX-RPC Web Services for Oracle WebLogic Server
connectionFactory=JMSTransportConnectionFactory jws
jwsc target
The preceding example shows how to specify the same values for the URL and JMS queue as were specified in the JWS file shown in
Section 8.5, Using the WLJmsTransport JWS Annotation
. For more information about using the jwsc Ant task, see jwsc in WebLogic Web
Services Reference for Oracle WebLogic Server.
8.7 Updating the WSDL to Use JMS Transport
To update the WSDL to use JMS transport, you need to add wsdl:binding and wsdl:service
definitions that define JMS transport information. You can add the definitions in one of the following ways:
■
Edit the existing HTTP wsdl:binding and wsdl:service definitions.
■
To specify multiple transport options in the WSDL, copy the existing HTTP wsdl:binding
and wsdl:service definitions and edit them to use JMS transport.
In either case, you must modify the wsdl:binding and wsdl:service definitions to use JMS transport as follows:
■
Set the transport attribute of the soapwsdl:binding child element of the wsdl:binding
element to http:www.openuri.org200204soapjms
. For example: binding name=JmsTransportServiceSoapBindingjms
type=tns:JmsTransportPortType soap:binding style=document
transport=http:www.openuri.org200204soapjms
■
Specify a JMS-style endpoint URL for the location attribute of the soapwsdl:address
child element of the wsdl:service. For example: s0:service name=JmsTransportService
s0:port binding=s1:JmsTransportServiceSoapBindingjms name=JmsTransportServicePort
s2:address location=jms:localhost:7001transportsJmsTransport?URI=JMSTransportQueue
s0:port s0:service
8.8 Invoking a WebLogic Web Service Using JMS Transport