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:Main.java

public static void setSoapEndpointUrl(Object wsProxy, String soapUrl) {
    javax.xml.ws.BindingProvider bp = (javax.xml.ws.BindingProvider) wsProxy /*port*/;
    Map<String, Object> context = bp.getRequestContext();
    context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, soapUrl);
}

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

public FileTransferServicePort setFTSMessageContext() throws EbayConnectorException {
    FileTransferServicePort port = null;
    FileTransferService service = new FileTransferService();

    try {//from ww  w.  j  av a  2  s . c o m

        port = service.getFileTransferServiceSOAP();
        BindingProvider bp = (BindingProvider) port;
        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, this.serverURL);
        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();
        // set http address
        if (this.serverURL == null) {
            throw new Exception(" serverURL can't be null ");

        }
        int timeout = 100;
        requestProperties.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serverURL);
        requestProperties.put(JAXWSProperties.CONNECT_TIMEOUT, timeout);

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

        requestProperties.put(MessageContext.HTTP_REQUEST_HEADERS, httpHeaders);

    } catch (Exception e) {
        throw new EbayConnectorException("Errore nel setup uplink: " + e.getMessage(), e);
    }

    return port;

}

From source file:com.fredhopper.core.connector.query.service.DefaultFasWebserviceFactory.java

private FASWebService createFasWebService() {
    final URL wsdlURL = getFredhopperWsdlUrl();
    final FASWebServiceService serviceService = new FASWebServiceService(wsdlURL, FH_SERVICE_QNAME);
    final FASWebService fasService = serviceService.getFASWebService();

    final Map<String, Object> rc = ((BindingProvider) fasService).getRequestContext();
    rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceUrl);
    rc.put(BindingProvider.USERNAME_PROPERTY, serviceUsername);
    rc.put(BindingProvider.PASSWORD_PROPERTY, servicePassword);
    LOG.info("Created FASWebService for url:" + serviceUrl + " serviceUsername:" + serviceUsername);
    return fasService;
}

From source file:com.amazon.webservices.awsecommerceservice._2007_07_16.AWSECommerceServiceSpringTest.java

@Test
public void testItemSearch() throws Exception {

    assertNotNull(this.awseCommerceServicePortType);

    for (String beanName : applicationContext.getBeanDefinitionNames()) {
        System.out.println("bean : " + beanName);
    }/*from w w  w.  j  a va2 s .  c o m*/
    Map<String, Object> requestContext = ((BindingProvider) awseCommerceServicePortType).getRequestContext();

    String endPointUrl = (String) requestContext.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);

    assertEquals("endpointUrl", "http://localhost:8080/cxf-demo/services/AWSECommerceService", endPointUrl);

    ItemSearchRequest itemSearchRequest = new ItemSearchRequest();
    itemSearchRequest.setSearchIndex("Books");
    itemSearchRequest.setPower("title");
    itemSearchRequest.setSort("salesrank");

    ItemSearch itemSearch = new ItemSearch();
    itemSearch.setSubscriptionId("0525E2PQ81DD7ZTWTK82");
    itemSearch.setShared(itemSearchRequest);

    ItemSearchResponse itemSearchResponse = awseCommerceServicePortType.itemSearch(itemSearch);
    System.out.println("RESPONSE : " + itemSearchResponse);

}

From source file:de.extra.extraClientLight.util.SendWebService.java

/**
 * /*from www. j ava  2  s  .  c o m*/
 * @param extraRequest
 * @param url
 * @param mtomActive
 * @return
 */
public TransportResponseType sendRequest(TransportRequestType extraRequest, String url, boolean mtomActive) {
    TransportResponseType response = new TransportResponseType();

    Extra_Service extraService = new Extra_Service(null, SERVICE_NAME);

    Extra extraPort = extraService.getPort(Extra.class);
    BindingProvider bp = (BindingProvider) extraPort;
    bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);

    SOAPBinding soapBinding = (SOAPBinding) bp.getBinding();
    soapBinding.setMTOMEnabled(mtomActive);

    try {
        LOGGER.debug("Versand gestartet...");
        response = extraPort.execute(extraRequest);
        LOGGER.debug("...Empfang Response");

        if (mtomActive) {
            Collection<Attachment> attachmentList = (Collection<Attachment>) bp.getResponseContext()
                    .get(Message.ATTACHMENTS);

            LOGGER.debug("Attachments: " + attachmentList.size());

        }
    } catch (SOAPFaultException e) {
        SOAPFault soapFault = e.getFault();

        LOGGER.error(soapFault.getTextContent(), e);

    } catch (ExtraFault e) {
        ExtraErrorHelper.printExtraError(e);
    }

    return response;

}

From source file:com.netsteadfast.greenstep.util.WsServiceUtils.java

public static Object getService(String wsClientBeanId, String wsdlAddress) throws Exception {
    if (StringUtils.isBlank(wsClientBeanId)) {
        throw new IllegalArgumentException("error, bean-Id is required!");
    }//  w  ww  .  ja v a2 s .  c om
    Object serviceObj = AppContext.getBean(wsClientBeanId);
    if (!StringUtils.isBlank(wsdlAddress)) { // wsdl?, ?xmlwsdl? 
        BindingProvider bindingProvider = (BindingProvider) serviceObj;
        bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsdlAddress);
    }
    return serviceObj;
}

From source file:be.e_contract.mycarenet.consent.ConsentClient.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);
    binding.setHandlerChain(handlerChain);
}

From source file:org.cloudml.connectors.FlexiantConnector.java

@SuppressWarnings("restriction")
public FlexiantConnector(String endPoint, String login, String secretKey) throws MalformedURLException {
    this.endpoint = endPoint;
    System.setProperty("jsse.enableSNIExtension", "false");

    journal.log(Level.INFO, ">> Connecting to Flexiant ...");

    URL url = ClassLoader.getSystemClassLoader().getResource("UserAdmin.wsdl");

    // Get the UserAPI
    UserAPI api = new UserAPI(url, new QName("http://extility.flexiant.net", "UserAPI"));

    // and set the service port on the service
    service = api.getUserServicePort();/*  w  w  w .  j a  va  2 s. c  om*/

    // Get the binding provider
    BindingProvider portBP = (BindingProvider) service;

    // and set the service endpoint
    portBP.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);

    journal.log(Level.INFO, ">> Authenticating ...");
    // and the caller's authentication details and password
    portBP.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, login);
    portBP.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, secretKey);

}

From source file:com.microsoft.exchange.ExchangeWebService.java

public ExchangeServicePortType getNtlmServicePort(String endpointUrl, String userName, String password,
        String domain) {/* ww w .j a  va2s . co  m*/
    ExchangeServicePortType port = getServicePort();
    Map<String, Object> requestContext = ((BindingProvider) port).getRequestContext();
    requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUrl);
    // setup NTLM authentication
    requestContext.put(Credentials.class.getName(), new NTCredentials(userName, password, "", domain));
    // force async conduit
    requestContext.put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE);
    // turn off chunking
    Client client = ClientProxy.getClient(port);
    initLogging(client);
    HTTPConduit conduit = (HTTPConduit) client.getConduit();
    HTTPClientPolicy clientPolicy = conduit.getClient();
    clientPolicy.setAllowChunking(false);
    clientPolicy.setAutoRedirect(true);
    clientPolicy.setConnectionTimeout(DEFAULT_TIMEOUT);
    clientPolicy.setReceiveTimeout(DEFAULT_TIMEOUT);
    clientPolicy.setAsyncExecuteTimeout(DEFAULT_TIMEOUT);
    return port;
}

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

private void handleOutboundMessage(SOAPMessageContext context) {
    String serviceRealm;/*from   w  w  w  . java 2 s  .c  o m*/
    if (null != this.serviceRealm) {
        serviceRealm = this.serviceRealm;
    } else {
        String location = (String) context.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
        serviceRealm = location;
    }
    LOG.debug("service realm: " + serviceRealm);

    SecurityToken securityToken = this.securityTokenProvider.getSecurityToken(serviceRealm);

    this.wsSecurityHandler.setKey(securityToken.getKey(), securityToken.getAttachedReference(),
            securityToken.getToken(), true);
}