Programming WebLogic Web Services
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
The following sections provide information about using JMS transport to invoke a WebLogic Web Service:
By default, 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 can also use JMS as the transport when invoking the Web Service.
When a WebLogic Web Service is configured to use JMS as the connection transport:
Warning: Non-WebLogic client applications, such as a .NET client, will not be able to invoke the Web Service using the JMS binding.
clientgen
Ant task creates a Service
implementation that contains two getPortXXX()
methods, one for HTTP/S and one for JMS.Note: You can configure any WebLogic Web Service to include a JMS binding in its WSDL. This feature is independent of JMS-implemented WebLogic Web Services.
In the following procedure, it is assumed that you are familiar with the servicegen
Ant task and you want to update the Web Service to use JMS transport. For an example of using servicegen
, see Creating a WebLogic Web Service: A Simple Example.
Some of the main steps include configuring JMS resources using the Administration Console.
When creating the JMS Server, or configuring an existing one, be sure that you specify the JMS Template you already created for the Temporary Template attribute.
For details about creating all these components, see JMS: Configuring.
See Invoking a Web Service Using JMS Transport for details about writing a Java client application that invokes your Web Service.
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:
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
Invoking a WebLogic Web Service using the JMS transport is very similar to using HTTP/S, as described in Invoking Web Services from Client Applications and WebLogic Server, but with a few differences, as described in the following procedure.
Because the WSDL of the Web Service has been updated to include an additional port with a JMS binding, the clientgen
Ant task automatically creates new stubs that contains these JMS-specific getPortXXX()
methods.
For details, see Generating the Client JAR File by Running the clientgen Ant Task.
WL_HOME
/server/lib/wlclient.jarWL_HOME
/server/lib/wljmsclient.jar
where WL_HOME
refers to the main WebLogic Server installation directory.
For more information on JMS client JAR files, see Programming WebLogic JMS.
getPortXXX()
method of the JAX-RPC Service
class generated by the clientgen
Ant task. The standard getPortXXX()
method for HTTP/S is called get
ServiceName
Port()
; the new method to use the JMS transport is called get
ServiceName
PortJMS()
, where ServiceName
refers to the name of your Web Service. These two gerPortXXX()
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" );
}
}
}
![]() ![]() |
![]() |
![]() |