Skip Headers
Oracle® Retail Service Backbone Security Guide
14.0
E49442-01
  Go To Table Of Contents
Contents

Previous
Previous
 
Next
Next
 

A Sample Java Policy A Client Program

package com.oracle.retail.oms.integration.client;
import java.net.URL;
import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
 
import com.oracle.retail.integration.base.bo.custorderref.v1.CustOrderRef;
import com.oracle.retail.integration.base.bo.nothing.v1.Nothing;
import com.oracle.retail.oms.integration.services.customerorderservice.v1.CustomerOrderPortType;
import com.oracle.retail.oms.integration.services.customerorderservice.v1.CustomerOrderService;
 
import java.util.ArrayList;
import java.util.List;
 
import weblogic.wsee.security.unt.ClientUNTCredentialProvider;
import weblogic.xml.crypto.wss.WSSecurityContext;
import weblogic.xml.crypto.wss.provider.CredentialProvider;
 
public class CustomerClient {
 private void invokeHttpsService(){
  try {
   QName qName = new QName("http://www.oracle.com/retail/oms/integration/services/CustomerOrderService/v1",
        "CustomerOrderService");
   URL url = new URL("https://rsbhost:22004/oms-CustomerOrder-AppServiceDecorator/ProxyService/CustomerOrderAppServiceProxy?wsdl");
   CustomerOrderService myService = new CustomerOrderService(url, qName);
   CustomerOrderPortType myServicePort = myService.getCustomerOrderPort();
   List<CredentialProvider> credProviders =
                new ArrayList<CredentialProvider>();
   // These should come from wallet in production code.
   String username = "rsbuser";
   String password = <rsbuser password>;                   
   CredentialProvider cp =
                new ClientUNTCredentialProvider(username.getBytes(),
                        password.getBytes());
   credProviders.add(cp);       
   BindingProvider bindingProvider = (BindingProvider) myServicePort;
   Map<String, Object> requestContext = bindingProvider.getRequestContext();
   requestContext.put(WSSecurityContext.CREDENTIAL_PROVIDER_LIST,
                       credProviders);
   Nothing nothing = new Nothing();
   nothing.setDescription("nothing");
   CustOrderRef d =  myServicePort.requestNewCustomerOrderId(nothing);
   System.out.println("Got Response : " + d.getOrderId());
  } catch(Exception e) {
        e.printStackTrace();
  }               
 }
}