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.FileTransferCall.java

public FileTransferServicePort setFTSMessageContext(String callName) throws EbayConnectorException {

    logger.trace("FileTransferActions.setFTSMessageContext(String callName ) ...... ");

    FileTransferServicePort port = null;
    FileTransferService service = new FileTransferService();

    port = service.getFileTransferServiceSOAP();
    BindingProvider bp = (BindingProvider) port;

    bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serverURL);
    List handlerList = bp.getBinding().getHandlerChain();
    if (handlerList == null) {
        handlerList = new ArrayList();
    }/*  w  w  w .  jav  a2s  . c om*/
    LoggingHandler loggingHandler = new LoggingHandler();
    handlerList.add(loggingHandler);
    // register the handerList
    bp.getBinding().setHandlerChain(handlerList);
    // initialize WS operation arguments here
    Map requestProperties = bp.getRequestContext();

    // set http address
    logger.trace("serverURL :" + this.serverURL);

    if (this.serverURL == null) {
        throw new EbayConnectorException(" serverURL can't be null ");
    }
    if (this.userToken == null) {
        throw new EbayConnectorException(" User Token can't be null ");
    }

    requestProperties.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serverURL);
    Map<String, List<String>> httpHeaders = new HashMap<String, List<String>>();
    httpHeaders.put("X-EBAY-SOA-MESSAGE-PROTOCOL", Collections.singletonList("SOAP12"));
    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);

    return port;

}

From source file:be.e_contract.mycarenet.xkms2.XKMS2Client.java

/**
 * Main constructor.// ww  w. j av a 2 s.  c om
 * 
 * @param location
 *            the URL of the MyCareNet XKMS 2.0 web service.
 */
public XKMS2Client(String location) {
    XMLKeyManagementService service = XKMS2ServiceFactory.newInstance();
    this.keyServicePort = service.getKeyServiceSoapPort();
    BindingProvider bindingProvider = (BindingProvider) this.keyServicePort;
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);

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

    this.objectFactory = new ObjectFactory();
    this.xmldsigObjectFactory = new be.e_contract.mycarenet.jaxb.xmldsig.ObjectFactory();
    try {
        this.datatypeFactory = DatatypeFactory.newInstance();
    } catch (DatatypeConfigurationException e) {
        throw new RuntimeException("DatatypeFactory error: " + e.getMessage(), e);
    }

}

From source file:org.apache.cxf.systest.http_jetty.JettyDigestAuthTest.java

private HTTPConduit setupClient(boolean async) throws Exception {
    URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
    greeter = new SOAPService(wsdl, SERVICE_NAME).getPort(Greeter.class);
    BindingProvider bp = (BindingProvider) greeter;
    ClientProxy.getClient(greeter).getInInterceptors().add(new LoggingInInterceptor());
    ClientProxy.getClient(greeter).getOutInterceptors().add(new LoggingOutInterceptor());
    bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS);
    HTTPConduit cond = (HTTPConduit) ClientProxy.getClient(greeter).getConduit();
    HTTPClientPolicy client = new HTTPClientPolicy();
    cond.setClient(client);//from  w  ww .  java  2  s  .  c o m
    if (async) {
        if (cond instanceof AsyncHTTPConduit) {
            UsernamePasswordCredentials creds = new UsernamePasswordCredentials("ffang", "pswd");
            bp.getRequestContext().put(Credentials.class.getName(), creds);
            bp.getRequestContext().put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE);
            client.setAutoRedirect(true);
        } else {
            fail("Not an async conduit");
        }
    } else {
        bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "ffang");
        bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "pswd");
        cond.setAuthSupplier(new DigestAuthSupplier());
    }

    ClientProxy.getClient(greeter).getOutInterceptors()
            .add(new AbstractPhaseInterceptor<Message>(Phase.PRE_STREAM_ENDING) {

                public void handleMessage(Message message) throws Fault {
                    Map<String, ?> headers = CastUtils.cast((Map<?, ?>) message.get(Message.PROTOCOL_HEADERS));
                    if (headers.containsKey("Proxy-Authorization")) {
                        throw new RuntimeException("Should not have Proxy-Authorization");
                    }
                }
            });
    client.setAllowChunking(false);
    return cond;
}

From source file:org.apache.cxf.systest.http_undertow.UndertowDigestAuthTest.java

private HTTPConduit setupClient(boolean async) throws Exception {
    URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
    greeter = new SOAPService(wsdl, SERVICE_NAME).getPort(Greeter.class);
    BindingProvider bp = (BindingProvider) greeter;
    ClientProxy.getClient(greeter).getInInterceptors().add(new LoggingInInterceptor());
    ClientProxy.getClient(greeter).getOutInterceptors().add(new LoggingOutInterceptor());
    bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS);
    HTTPConduit cond = (HTTPConduit) ClientProxy.getClient(greeter).getConduit();
    HTTPClientPolicy client = new HTTPClientPolicy();
    client.setConnectionTimeout(600000);
    client.setReceiveTimeout(600000);//from  w ww. ja va  2 s  . co m
    cond.setClient(client);
    if (async) {
        if (cond instanceof AsyncHTTPConduit) {
            UsernamePasswordCredentials creds = new UsernamePasswordCredentials("ffang", "pswd");
            bp.getRequestContext().put(Credentials.class.getName(), creds);
            bp.getRequestContext().put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE);
            client.setAutoRedirect(true);
        } else {
            fail("Not an async conduit");
        }
    } else {
        bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "ffang");
        bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "pswd");
        cond.setAuthSupplier(new DigestAuthSupplier());
    }

    ClientProxy.getClient(greeter).getOutInterceptors()
            .add(new AbstractPhaseInterceptor<Message>(Phase.PRE_STREAM_ENDING) {

                public void handleMessage(Message message) throws Fault {
                    Map<String, ?> headers = CastUtils.cast((Map<?, ?>) message.get(Message.PROTOCOL_HEADERS));
                    if (headers.containsKey("Proxy-Authorization")) {
                        throw new RuntimeException("Should not have Proxy-Authorization");
                    }
                }
            });
    client.setAllowChunking(false);
    return cond;
}

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

private PushIdInterface getService(final String address) {

    try {/*from w w w . ja va2 s  .  c  om*/
        final ClassLoader loader = Thread.currentThread().getContextClassLoader();
        final URL wsdl = loader
                .getResource("schemas/SSO/interactions/pushid/Mvk_SSOService_CertAuth_PushId_Cert_Facade.wsdl");

        final ExportsPushIdCertFacadePushIdInterfaceHttpService service = new ExportsPushIdCertFacadePushIdInterfaceHttpService(
                wsdl);
        final PushIdInterface serviceInterface = service.getExportsPushIdCertFacadePushIdInterfaceHttpPort();

        ((BindingProvider) serviceInterface).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                address);
        return serviceInterface;
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:be.fedict.hsm.client.HSMProxyClient.java

/**
 * Main constructor. To access the HSM Proxy web service, you need to have a
 * valid credential./* w  w w. j  a va2s.  c o m*/
 * 
 * @param endpointAddress
 *            the HSM Proxy web service endpoint address.
 * @param credentialPrivateKey
 *            the credential private key.
 * @param credentialCertificate
 *            the corresponding credential X509 certificate.
 */
public HSMProxyClient(String endpointAddress, PrivateKey credentialPrivateKey,
        X509Certificate credentialCertificate) {
    this.endpointAddress = endpointAddress;

    DigitalSignatureService digitalSignatureService = DigitalSignatureServiceFactory.getInstance();
    this.dssPort = digitalSignatureService.getDigitalSignatureServicePort();

    BindingProvider bindingProvider = (BindingProvider) this.dssPort;
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);

    this.dssObjectFactory = new ObjectFactory();
    this.dsObjectFactory = new be.fedict.hsm.ws.jaxb.xmldsig.ObjectFactory();
    this.hsmObjectFactory = new be.fedict.hsm.ws.jaxb.hsm.ObjectFactory();

    try {
        this.certificateFactory = CertificateFactory.getInstance("X.509");
    } catch (CertificateException e) {
        throw new RuntimeException("X509 certificate factory error: " + e.getMessage(), e);
    }

    Binding binding = bindingProvider.getBinding();
    List<Handler> handlerChain = binding.getHandlerChain();
    handlerChain.add(new WSSecuritySOAPHandler(credentialPrivateKey, credentialCertificate));
    binding.setHandlerChain(handlerChain);
}

From source file:be.e_contract.mycarenet.ehbox.EHealthBoxPublicationClient.java

@SuppressWarnings("unchecked")
private void configureBindingProvider(BindingProvider bindingProvider, String location) {
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);

    Binding binding = bindingProvider.getBinding();
    @SuppressWarnings("rawtypes")
    List handlerChain = binding.getHandlerChain();
    handlerChain.add(this.wsSecuritySOAPHandler);
    handlerChain.add(new LoggingHandler());
    handlerChain.add(this.payloadLogicalHandler);
    binding.setHandlerChain(handlerChain);
}

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

public BulkDataExchangeServicePort setRequestContext() throws EbayConnectorException {
    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();
        }// w  ww .  j  a v  a 2s  .  c  o m
        LoggingHandler loggingHandler = new LoggingHandler();
        handlerList.add(loggingHandler);
        // register the handerList
        bp.getBinding().setHandlerChain(handlerList);
        // initialize WS operation arguments here
        Map requestProperties = bp.getRequestContext();
        // set http address
        if (this.serverURL == null) {
            throw new Exception(" serverURL can't be null ");
        }
        requestProperties.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serverURL);

        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(this.callName));
        httpHeaders.put("X-EBAY-SOA-SECURITY-TOKEN", Collections.singletonList(this.userToken));

        requestProperties.put(MessageContext.HTTP_REQUEST_HEADERS, httpHeaders);
        retrieveHttpHeaders(bp, "Response");
    } catch (Exception ex) {
        logger.error(ex.getMessage());
        throw new EbayConnectorException(ex.getMessage(), ex);
    }
    return port;
}

From source file:it.govpay.ejb.ndp.util.wsclient.NodoPerPa.java

public PagamentiTelematiciRPT configuraClient(String azione) {
    PagamentiTelematiciRPT port = service.getPagamentiTelematiciRPTPort();

    if (ishttpBasicEnabled) {
        ((BindingProvider) port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, httpBasicUser);
        ((BindingProvider) port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, httpBasicPassword);
    }/*from   ww  w.  j  a  v a 2  s .c om*/

    if (isSslEnabled) {
        ((BindingProvider) port).getRequestContext().put(
                "com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory",
                sslContext.getSocketFactory());
    }

    String urlString = url.toExternalForm();
    if (this.isConnettoreServizioRPTAzioneInUrl) {
        if (!urlString.endsWith("/"))
            urlString = urlString.concat("/");
        ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                urlString.concat(azione));
    } else {
        ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, urlString);
    }
    return port;
}

From source file:com.nttdata.depend.util.OAuthUtil.java

public void reconfigureBindingProvider(BindingProvider bindingProvider) {
    String defaultEndpointURL = (String) bindingProvider.getRequestContext()
            .get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
    String actualEndpointURL = getInstanceURL()
            + defaultEndpointURL.substring(defaultEndpointURL.indexOf(URL_PATTERN));
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, actualEndpointURL);
}