Example usage for javax.xml.ws BindingProvider ENDPOINT_ADDRESS_PROPERTY

List of usage examples for javax.xml.ws BindingProvider ENDPOINT_ADDRESS_PROPERTY

Introduction

In this page you can find the example usage for javax.xml.ws BindingProvider ENDPOINT_ADDRESS_PROPERTY.

Prototype

String ENDPOINT_ADDRESS_PROPERTY

To view the source code for javax.xml.ws BindingProvider ENDPOINT_ADDRESS_PROPERTY.

Click Source Link

Document

Standard property: Target service endpoint address.

Usage

From source file:ebay.dts.client.BulkDataExchangeCall.java

public BulkDataExchangeServicePort setRequestContext(String callName) throws EbayConnectorException {

    if (this.serverURL == null && this.serverURL.length() == 0) {
        logger.error("BulkDataExchangeService endpoint URL is not set");
        return null;
    }/*w ww.j  av  a 2  s.c o  m*/

    BulkDataExchangeServicePort port = null;
    try { // Call Web Service Operation
        BulkDataExchangeService service = new BulkDataExchangeService();
        port = service.getBulkDataExchangeServiceSOAP();
        bp = (BindingProvider) port;
        // Add the logging handler
        List handlerList = bp.getBinding().getHandlerChain();
        if (handlerList == null) {
            handlerList = new ArrayList();
        }
        LoggingHandler loggingHandler = new LoggingHandler();
        handlerList.add(loggingHandler);
        // register the handerList
        bp.getBinding().setHandlerChain(handlerList);
        // initialize WS operation arguments here
        Map requestProperties = bp.getRequestContext();
        requestProperties.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, this.serverURL);
        if (this.userToken == null) {
            throw new Exception(" userToken can't be null ");
        }
        Map<String, List<String>> httpHeaders = new HashMap<String, List<String>>();
        httpHeaders.put("X-EBAY-SOA-MESSAGE-PROTOCOL", Collections.singletonList("SOAP11"));
        httpHeaders.put("X-EBAY-SOA-OPERATION-NAME", Collections.singletonList(callName));
        httpHeaders.put("X-EBAY-SOA-SECURITY-TOKEN", Collections.singletonList(this.userToken));
        requestProperties.put(MessageContext.HTTP_REQUEST_HEADERS, httpHeaders);
        //http://developer.ebay.com/DevZone/bulk-data-exchange/CallRef/createUploadJob.html#Request.uploadJobType

    } catch (Exception ex) {
        logger.error(ex.getMessage());
        throw new EbayConnectorException(ex.getMessage(), ex);
    }

    return port;

}

From source file:be.e_contract.mycarenet.xkms.XKMSClient.java

/**
 * Main constructor.//from   www. j  a  v  a  2s  . co m
 * 
 * @param location
 *            the URL of the MyCareNet XKMS web service.
 */
public XKMSClient(String location) {
    XMLKeyManagementService service = XKMSServiceFactory.newInstance();
    this.port = service.getKeyServiceSoapPort();
    BindingProvider bindingProvider = (BindingProvider) this.port;
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);

    Binding binding = bindingProvider.getBinding();
    @SuppressWarnings("rawtypes")
    List<Handler> handlerChain = binding.getHandlerChain();
    handlerChain.add(new LoggingHandler());
    this.proofOfPossessionSignatureSOAPHandler = new ProofOfPossessionSignatureSOAPHandler();
    handlerChain.add(this.proofOfPossessionSignatureSOAPHandler);
    handlerChain.add(new LoggingHandler());
    binding.setHandlerChain(handlerChain);

    this.objectFactory = new ObjectFactory();
    this.xmldsigObjectFactory = new be.e_contract.mycarenet.jaxb.xmldsig.ObjectFactory();
}

From source file:be.fedict.eid.idp.sp.protocol.ws_federation.sts.SecurityTokenServiceClient.java

/**
 * Main constructor./*ww w  . j a v  a 2 s.com*/
 * 
 * @param location
 *            the location of the STS service.
 */
public SecurityTokenServiceClient(String location) {
    SecurityTokenService securityTokenService = SecurityTokenServiceFactory.getInstance();

    this.port = securityTokenService.getSecurityTokenServicePort();
    BindingProvider bindingProvider = (BindingProvider) this.port;
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);

    Binding binding = bindingProvider.getBinding();
    List<Handler> handlerChain = binding.getHandlerChain();
    handlerChain.add(new WSSecuritySoapHandler());
    handlerChain.add(new LoggingSoapHandler());
    binding.setHandlerChain(handlerChain);

    this.objectFactory = new ObjectFactory();
    this.policyObjectFactory = new be.fedict.eid.idp.wstrust.jaxb.wspolicy.ObjectFactory();
    this.addrObjectFactory = new be.fedict.eid.idp.wstrust.jaxb.wsaddr.ObjectFactory();
    this.wsseObjectFactory = new be.fedict.eid.idp.wstrust.jaxb.wsse.ObjectFactory();
}

From source file:be.agiv.security.handler.SecureConversationHandler.java

private void handleOutboundMessage(SOAPMessageContext context) {
    String location = (String) context.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
    LOG.debug("location: " + location);

    String serviceRealm;/*ww  w  .jav  a2s .  c o m*/
    if (null != this.serviceRealm) {
        serviceRealm = this.serviceRealm;
    } else {
        serviceRealm = location;
    }
    LOG.debug("service realm: " + serviceRealm);

    SecurityToken secureConversationToken = this.securityTokenProvider.getSecureConversationToken(location,
            serviceRealm);

    this.wsSecurityHandler.setKey(secureConversationToken.getKey(),
            secureConversationToken.getAttachedReference(), secureConversationToken.getToken(), false);
}

From source file:be.e_contract.mycarenet.certra.CertRAClient.java

public CertRAClient(String location) {
    CertRaService certRaService = CertRaServiceFactory.newInstance();
    this.port = certRaService.getCertRaPort();

    BindingProvider bindingProvider = (BindingProvider) this.port;
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);

    Binding binding = bindingProvider.getBinding();
    List<Handler> handlerChain = binding.getHandlerChain();
    handlerChain.add(new LoggingHandler());
    // LoggingHandler makes CXF fail on the attachments.
    // https://issues.apache.org/jira/browse/CXF-5496
    binding.setHandlerChain(handlerChain);

    this.protocolObjectFactory = new be.e_contract.mycarenet.certra.jaxb.protocol.ObjectFactory();
}

From source file:be.agiv.security.client.RSTSClient.java

/**
 * Main constructor.//from  w ww.  j ava2 s  .  co m
 * 
 * @param location
 *            the location of the R-STS WS-Trust web service.
 */
public RSTSClient(String location) {
    this.location = location;
    SecurityTokenService_Service service = SecurityTokenServiceFactory.getInstance();
    this.port = service.getSecurityTokenServicePort();
    BindingProvider bindingProvider = (BindingProvider) this.port;
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);

    Binding binding = bindingProvider.getBinding();
    List<Handler> handlerChain = binding.getHandlerChain();
    this.wsTrustHandler = new WSTrustHandler();
    handlerChain.add(this.wsTrustHandler);
    this.wsAddressingHandler = new WSAddressingHandler();
    handlerChain.add(this.wsAddressingHandler);
    this.wsSecurityHandler = new WSSecurityHandler();
    handlerChain.add(this.wsSecurityHandler);
    handlerChain.add(new LoggingHandler());
    binding.setHandlerChain(handlerChain);

    this.objectFactory = new ObjectFactory();
    this.policyObjectFactory = new be.agiv.security.jaxb.wspolicy.ObjectFactory();
    this.addrObjectFactory = new be.agiv.security.jaxb.wsaddr.ObjectFactory();

}

From source file:be.agiv.security.client.SecureConversationClient.java

/**
 * Main constructor. The given location is the same as where the actual
 * business web service is running./*  w w w  .j a  va2s .c  o  m*/
 * 
 * @param location
 *            the location of the WS-SecureConversation enabled web service.
 */
public SecureConversationClient(String location) {
    this.location = location;
    SecurityTokenService_Service service = SecurityTokenServiceFactory.getInstance();
    this.port = service.getSecurityTokenServicePort();
    BindingProvider bindingProvider = (BindingProvider) this.port;
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);

    Binding binding = bindingProvider.getBinding();
    List<Handler> handlerChain = binding.getHandlerChain();
    this.wsTrustHandler = new WSTrustHandler();
    handlerChain.add(this.wsTrustHandler);
    this.wsAddressingHandler = new WSAddressingHandler();
    handlerChain.add(this.wsAddressingHandler);
    this.wsSecurityHandler = new WSSecurityHandler();
    handlerChain.add(this.wsSecurityHandler);
    handlerChain.add(new LoggingHandler());
    binding.setHandlerChain(handlerChain);

    this.objectFactory = new ObjectFactory();
    this.wssObjectFactory = new be.agiv.security.jaxb.wsse.ObjectFactory();

    this.secureRandom = new SecureRandom();
    this.secureRandom.setSeed(System.currentTimeMillis());
}

From source file:com.evolveum.midpoint.cli.ninja.action.Action.java

protected ModelPortType createModelPort() {
    ModelService modelService = new ModelService();
    ModelPortType port = modelService.getModelPort();
    BindingProvider bp = (BindingProvider) port;

    Client client = ClientProxy.getClient(port);
    Endpoint endpoint = client.getEndpoint();
    HTTPConduit http = (HTTPConduit) client.getConduit();
    HTTPClientPolicy httpClientPolicy = http.getClient();
    if (httpClientPolicy == null) {
        httpClientPolicy = new HTTPClientPolicy();
        http.setClient(httpClientPolicy);
    }//w  w w.  j  ava2  s. c  o  m

    httpClientPolicy.setConnectionTimeout(10000);

    Map<String, Object> requestContext = bp.getRequestContext();
    requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, params.getUrl().toString());

    requestContext.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
    requestContext.put(WSHandlerConstants.USER, params.getUsername());
    requestContext.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);

    ClientPasswordHandler handler = new ClientPasswordHandler();
    handler.setPassword(params.getInsertedPassword());
    requestContext.put(WSHandlerConstants.PW_CALLBACK_REF, handler);

    WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(requestContext);
    endpoint.getOutInterceptors().add(wssOut);
    if (params.isVerbose()) {
        endpoint.getOutInterceptors().add(new LoggingOutInterceptor());
        endpoint.getInInterceptors().add(new LoggingInInterceptor());
    }

    return port;
}

From source file:org.callistasoftware.netcare.mvk.authentication.service.impl.MvkAuthenticationServiceImpl.java

private ValidateToken getService(final String address) {

    try {/*from   www .j  av a  2  s. c  o m*/
        final ClassLoader loader = Thread.currentThread().getContextClassLoader();
        final URL wsdl = loader
                .getResource("schemas/ValidateID/wsdl/interactions/MvkAsb_ValidateID_ValidateToken.wsdl");

        final ValidateTokenValidateTokenHttpService service = new ValidateTokenValidateTokenHttpService(wsdl);
        final ValidateToken serviceInterface = service.getExportsValidateTokenValidateTokenHttpPort();

        ((BindingProvider) serviceInterface).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                address);

        return serviceInterface;
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:ch.astina.hesperid.agentbundle.Agent.java

private void initializeAgentFeedbackPort() throws MalformedURLException {
    logger.info("Initializing agent feedback port form service...");
    String wsdlLocation = xmlConfiguration.getString("hostBaseURL") + "/soap?wsdl";
    logger.info("Using wsdl location: " + wsdlLocation);

    AgentFeedbackService service = new AgentFeedbackService(new URL(wsdlLocation),
            new QName(GlobalConstants.WEBSERVICE_NAMESPACE, "AgentFeedbackService"));
    agentFeedbackPort = service.getAgentFeedbackPort();

    ((BindingProvider) agentFeedbackPort).getRequestContext().put("com.sun.xml.internal.ws.request.timeout",
            1000);//from   w w w  .  jav  a2  s .c  om
    ((BindingProvider) agentFeedbackPort).getRequestContext().put("com.sun.xml.internal.ws.connect.timeout",
            1000);

    ((BindingProvider) agentFeedbackPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            xmlConfiguration.getString("hostBaseURL") + "/soap");

    //((BindingProvider) agentFeedbackPort).getRequestContext().put(JAXWSProperties.CONNECT_TIMEOUT, 1000);
    //((BindingProvider) agentFeedbackPort).getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, 1000);      
}