Java integration

Previous Topic

Next Topic

Book Contents

Java integration

For Java applications, set the MTOMFeature for your web service. Also set up WS SECURITY and the username token policy by defining the SecurityPoliciesFeature for your web service.

The following example demonstrates how to connect to the Topics web service for each call:

// Instantiate the Topics web service proxy

EmpiricaTopicsService topicsService = new EmpiricaTopicsService(

new URL("https://<hostname>:<port number>/TopicsService/ws/topicsService?wsdl"), new QName("http://oracle.hsgbu.topics.com", "EmpiricaTopicsService"));

BindingProvider bindingProvider = (BindingProvider)topicsService;

// Set the endpoint address for the Topics web service

bindingProvider.getRequestContext().put( BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "https://<hostname>:<port number>/TopicsService/ws/topicsService");

// Set the username token policy

SecurityPoliciesFeature securityFeatures = new SecurityPoliciesFeature( new String[]{"oracle/wss_username_token_over_ssl_client_policy"});

// Include MTOM if this API call sends attachments

topicsService.getEmpiricaTopicsPort(new MTOMFeature(), securityFeatures);

// Set the topics user name and password

bindingProvider.getRequestContext().put( BindingProvider.USERNAME_PROPERTY, <topics service username>);

bindingProvider.getRequestContext().put( BindingProvider.PASSWORD_PROPERTY, <topics service password>);

// Set a maximum chunk size when calling an API that streams attachments

bindingProvider.getRequestContext().put( "com.sun.xml.ws.transport.http.client.streaming.chunk.size", 8192);

Substitute your environment's values for <hostname>, <port number>, <topics service username>, and <topics service password>.

Send Feedback