C Sample Java Policy B Consumer Using OWSM Client Policy
package com.oracle.retail.rms.integration.client;
import java.net.URL;
import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import oracle.webservices.ClientConstants;
import weblogic.wsee.jws.jaxws.owsm.SecurityPoliciesFeature;
import com.oracle.retail.integration.base.bo.supplierdesc.v1.SupplierDesc;
import com.oracle.retail.integration.base.bo.supplierref.v1.SupplierRef;
import com.oracle.retail.rms.integration.services.supplierservice.v1.SupplierPortType;
import com.oracle.retail.rms.integration.services.supplierservice.v1.SupplierService;
public class SupplierClient {
private void callOsbService() {
try {
String hostName = getHostName();
QName qName = new QName ("http://www.oracle.com/retail/rms/integration/services/SupplierService/v1", "SupplierService");
URL url = new URL("http://rsbhost:7007/rmsSupplierAppServiceDecorator/ProxyService/SupplierAppServiceProxy?wsdl");
SecurityPoliciesFeature securityFeatures = new SecurityPoliciesFeature(
new String[] {
"oracle/wss11_username_token_with_message_protection_client_policy" });
SupplierService myService = new SupplierService(url, qName);
SupplierPortType myServicePort =
myService.getSupplierPort(securityFeatures);
Map<String, Object> reqContext = ((BindingProvider)
myServicePort).getRequestContext();
reqContext.put(
oracle.wsm.security.util.SecurityConstants.ClientConstants.WSS_KEYSTORE_TYPE,
"JKS");
reqContext.put(ClientConstants.WSSEC_KEYSTORE_LOCATION,
"/u01/rrtswls/Oracle1036/Middleware/user_projects/domains/base_domain/config/" + hostName + "-keystore.jks");
}
}