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:org.mule.modules.zuora.zuora.api.CxfZuoraClient.java

public CxfZuoraClient(@NotNull String username, @NotNull String password, @NotNull String endpoint)
        throws UnexpectedErrorFault, LoginFault {
    Validate.notNull(username);//from   www . j  ava2s.  co m
    Validate.notNull(password);
    Validate.notNull(endpoint);
    this.username = username;
    this.password = password;
    this.endpoint = endpoint;

    // @EL if multiple clients are created at the same time this JAXB code can
    // generate race condiitons on the ClassLoader when it searches for the
    // ObjectFactory:
    //
    // 1. Could not create a validated object, cause: loader (instance of
    // org/mule/module/launcher/MuleApplicationClassLoader): attempted  duplicate class
    // definition for name: "com/zuora/api/object/ObjectFactory" (java.util.NoSuchElementException)
    //
    // So I'm locking it so it can happen only one at a time
    synchronized (CxfZuoraClient.class) {
        try {
            jSessionDataBinding = new JAXBDataBinding(SessionHeader.class);
        } catch (JAXBException e) {
            throw new AssertionError(e);
        }
    }

    ZuoraService serviceLocator = new ZuoraService(getClass().getResource("/zuora-32.wsdl"));
    this.soap = serviceLocator.getPort(Soap.class);

    BindingProvider bindingProvider = ((BindingProvider) this.soap);
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);

    LoginResult loginResult;
    loginResult = this.soap.login(username, password);

    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            loginResult.getServerUrl());
    bindingProvider.getRequestContext().put(MessageContext.HTTP_REQUEST_HEADERS,
            new HashMap<String, List<String>>());

    sessionId = loginResult.getSession();

    SessionHeader sh = new SessionHeader();
    sh.setSession(loginResult.getSession());

    bindingProvider.getRequestContext().put(Header.HEADER_LIST, Arrays.asList(
            new Header(new QName("urn:partner.soap.sforce.com", "SessionHeader"), sh, jSessionDataBinding)));

}

From source file:org.nuxeo.adullact.service.AdullactServiceImpl.java

private InterfaceParapheur serviceSOAPFactory() throws ClientException {
    // in wsdl definitions target name space
    QName qname = new QName("http://www.adullact.org/spring-ws/iparapheur/1.0", "InterfaceParapheurService");
    URL wsdlUrl = AdullactServiceImpl.class.getResource("/wsdl/iparapheur.xml.wsdl");
    Service service = Service.create(wsdlUrl, qname);

    InterfaceParapheurService ifParapheurService = new InterfaceParapheurService(wsdlUrl, qname);

    InterfaceParapheur ifParapheur = ifParapheurService.getInterfaceParapheurSoap11();

    Map<String, Object> requestContext = ((BindingProvider) ifParapheur).getRequestContext();

    requestContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
    requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, webServiceBaseURL.toString());
    requestContext.put(BindingProvider.USERNAME_PROPERTY, login);
    requestContext.put(BindingProvider.PASSWORD_PROPERTY, password);
    return ifParapheur;
}

From source file:org.olat.modules.vitero.manager.ViteroManager.java

public boolean checkConnection(final String url, final String login, final String password,
        final int customerId) throws VmsNotAvailableException {
    try {//from www  .j av  a  2 s  .co m
        LicenceService ss = new LicenceService();
        ss.setHandlerResolver(new HandlerResolver() {
            @SuppressWarnings("rawtypes")
            @Override
            public List<Handler> getHandlerChain(PortInfo portInfo) {
                List<Handler> handlerList = new ArrayList<Handler>();
                handlerList.add(new ViteroSecurityHandler(login, password));
                return handlerList;
            }

        });
        Licence port = ss.getLicenceSoap11();
        String endPoint = UriBuilder.fromUri(url).path("services").path("LicenseService").build().toString();
        ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);
        GetModulesForCustomerRequest request = new GetModulesForCustomerRequest();
        request.setCustomerid(customerId);
        Modulestype modulesType = port.getModulesForCustomer(request);
        return modulesType != null;
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch (code) {
        case unsufficientRights:
            logError("Unsufficient rights", f);
            break;
        default:
            logAxisError("Cannot check connection", f);
        }
        return false;
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        logWarn("Error checking connection", e);
        return false;
    }
}

From source file:org.olat.modules.vitero.manager.ViteroManager.java

private final Booking getBookingWebService() {
    BookingService ss = new BookingService();
    ss.setHandlerResolver(new VmsSecurityHandlerResolver());
    Booking port = ss.getBookingSoap11();
    String endPoint = getVmsEndPoint("BookingService");
    ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);
    return port;//from ww  w . ja v a  2  s  . com
}

From source file:org.olat.modules.vitero.manager.ViteroManager.java

private final Licence getLicenceWebService() {
    LicenceService ss = new LicenceService();
    ss.setHandlerResolver(new VmsSecurityHandlerResolver());
    Licence port = ss.getLicenceSoap11();
    String endPoint = getVmsEndPoint("LicenceService");
    ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);
    return port;//from w w w. java2 s  .  c  om
}

From source file:org.olat.modules.vitero.manager.ViteroManager.java

private final Group getGroupWebService() {
    GroupService ss = new GroupService();
    ss.setHandlerResolver(new VmsSecurityHandlerResolver());
    Group port = ss.getGroupSoap11();
    String endPoint = getVmsEndPoint("GroupService");
    ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);
    return port;/*  w w  w . j  av a2  s  .  c  o m*/
}

From source file:org.olat.modules.vitero.manager.ViteroManager.java

private final de.vitero.schema.user.User getUserWebService() {
    UserService ss = new UserService();
    ss.setHandlerResolver(new VmsSecurityHandlerResolver());
    de.vitero.schema.user.User port = ss.getUserSoap11();
    String endPoint = getVmsEndPoint("UserService");
    ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);
    return port;//from w w  w  .  j  a  v a2 s  . c om
}

From source file:org.olat.modules.vitero.manager.ViteroManager.java

private final Mtom getMtomWebService() {
    MtomService ss = new MtomService();
    ss.setHandlerResolver(new VmsSecurityHandlerResolver());
    Mtom port = ss.getMtomSoap11();/*from   ww w . j a  v  a2s .  c  o  m*/
    String endPoint = getVmsEndPoint("MtomService");
    ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);
    return port;
}

From source file:org.olat.modules.vitero.manager.ViteroManager.java

private final SessionCode getSessionCodeWebService() {
    SessionCodeService ss = new SessionCodeService();
    ss.setHandlerResolver(new VmsSecurityHandlerResolver());
    SessionCode port = ss.getSessionCodeSoap11();
    String endPoint = getVmsEndPoint("SessionCodeService");
    ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);
    return port;//from   w w w .  j a  v  a2  s . c o  m
}

From source file:org.openehealth.ipf.commons.ihe.ws.JaxWsClientFactory.java

/**
 * Configures SOAP binding of the given SOAP port.
 *///from  ww w  . jav  a2s  .co m
private void configureBinding(Object port) {
    BindingProvider bindingProvider = (BindingProvider) port;

    Map<String, Object> reqContext = bindingProvider.getRequestContext();
    reqContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceUrl);

    Binding binding = bindingProvider.getBinding();
    SOAPBinding soapBinding = (SOAPBinding) binding;
    soapBinding.setMTOMEnabled(wsTransactionConfiguration.isMtom());
}