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.apache.juddi.v3.client.transport.SAPRegistryJAXWSTransport.java

public UDDICustodyTransferPortType getUDDICustodyTransferService(String endpointURL) throws TransportException {
    if (custodyTransferService == null) {
        try {/*from ww  w  .j  ava  2s  .  c  o  m*/
            if (endpointURL == null) {
                UDDIClerkManager manager = UDDIClientContainer.getUDDIClerkManager(managerName);
                endpointURL = manager.getClientConfig().getUDDINode(nodeName).getCustodyTransferUrl();
            }
            UDDIService service = new UDDIService();
            custodyTransferService = service.getUDDICustodyPort();
            Map<String, Object> requestContext = ((BindingProvider) custodyTransferService).getRequestContext();
            requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);
            setCredentials(requestContext);

            XMLDeclarationWritingInterceptor xmldwi = new XMLDeclarationWritingInterceptor();
            Client cxfClient = ClientProxy.getClient(custodyTransferService);
            cxfClient.getInInterceptors().add(xmldwi);

        } catch (Exception e) {
            throw new TransportException(e.getMessage(), e);
        }
    }
    return custodyTransferService;
}

From source file:org.apache.juddi.v3.client.transport.SAPRegistryJAXWSTransport.java

/**
 * This is a jUDDI specific API//from w ww.j av a2s  .  c  om
 */
public JUDDIApiPortType getJUDDIApiService(String endpointURL) throws TransportException {
    if (publisherService == null) {
        try {
            if (endpointURL == null) {
                UDDIClerkManager manager = UDDIClientContainer.getUDDIClerkManager(managerName);
                endpointURL = manager.getClientConfig().getUDDINode(nodeName).getJuddiApiUrl();
            }
            JUDDIApiService service = new JUDDIApiService();
            publisherService = (JUDDIApiPortType) service.getPort(JUDDIApiPortType.class);
            Map<String, Object> requestContext = ((BindingProvider) publisherService).getRequestContext();
            requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);
            setCredentials(requestContext);
        } catch (Exception e) {
            throw new TransportException(e.getMessage(), e);
        }
    }
    return publisherService;
}

From source file:org.apache.juddi.v3.tck.JUDDI_300_MultiNodeIntegrationTest.java

public static void testSetupReplicationConfig() {
    //this only runs if it is JUDDI and Replication is enabled
    if (!TckPublisher.isReplicationEnabled() || !TckPublisher.isJUDDI()) {
        logger.info("TCK says that replication is disabled...skipping replication config...");
        return;//  ww  w.jav  a  2 s  . c  o  m
    }
    try {
        init();
        refreshTokens();
        logger.info("fetching current replication config...");

        ReplicationConfiguration replicationNode1 = null;
        try {
            replicationNode1 = juddiApiServiceNode1.getReplicationNodes(rootNode1Token);
        } catch (Exception ex) {
            System.out.println("Error getting replication config");
            ex.printStackTrace();
            Assert.fail(ex.getMessage());

        }
        //if (replicationNode1.getCommunicationGraph() == null) {
        replicationNode1.setCommunicationGraph(new CommunicationGraph());
        //}

        replicationNode1.getOperator().clear();
        replicationNode1.getSignature().clear();

        Operator op = new Operator();
        op.setOperatorNodeID("uddi:juddi.apache.org:node1");
        op.setSoapReplicationURL(manager.getClientConfig().getUDDINode(CFG_node1_MARY).getReplicationUrl());
        op.setOperatorStatus(OperatorStatusType.NORMAL);
        op.getContact().add(new Contact());
        op.getContact().get(0).getPersonName().add(new PersonName("bob", "en"));
        op.getContact().get(0).setUseType("admin");
        //if (!Contains(replicationNode1.getOperator(), op)) {
        replicationNode1.getOperator().add(op);
        //}

        op = new Operator();
        op.setOperatorNodeID("uddi:another.juddi.apache.org:node2");
        op.setSoapReplicationURL(manager.getClientConfig().getUDDINode(CFG_node2_SAM).getReplicationUrl());
        op.setOperatorStatus(OperatorStatusType.NORMAL);
        op.getContact().add(new Contact());
        op.getContact().get(0).getPersonName().add(new PersonName("mary", "en"));
        op.getContact().get(0).setUseType("admin");
        //if (!Contains(replicationNode1.getOperator(), op)) 
        {
            replicationNode1.getOperator().add(op);
        }
        //if (!replicationNode1.getCommunicationGraph().getNode().contains("uddi:another.juddi.apache.org:node2")) {
        replicationNode1.getCommunicationGraph().getNode().add("uddi:another.juddi.apache.org:node2");
        //}
        //if (!replicationNode1.getCommunicationGraph().getNode().contains("uddi:juddi.apache.org:node1")) {
        replicationNode1.getCommunicationGraph().getNode().add("uddi:juddi.apache.org:node1");
        //}
        replicationNode1.setSerialNumber(0L);
        replicationNode1.setTimeOfConfigurationUpdate("");
        replicationNode1.setMaximumTimeToGetChanges(BigInteger.ONE);
        replicationNode1.setMaximumTimeToSyncRegistry(BigInteger.ONE);

        if (replicationNode1.getRegistryContact().getContact() == null) {
            replicationNode1.getRegistryContact().setContact(new Contact());
            replicationNode1.getRegistryContact().getContact().getPersonName()
                    .add(new PersonName("unknown", null));
        }

        if (TckCommon.isDebug()) {
            JAXB.marshal(replicationNode1, System.out);
        }

        logger.info(manager.getClientConfig().getConfigurationFile()
                + " Setting replication config on Node 1...@" + ((BindingProvider) juddiApiServiceNode1)
                        .getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY));
        logger.info("Setting replication url on Node 1...@"
                + manager.getClientConfig().getUDDINode(CFG_node1_MARY).getReplicationUrl());
        juddiApiServiceNode1.setReplicationNodes(rootNode1Token, replicationNode1);
        logger.info("Setting replication config on Node 2...@" + ((BindingProvider) juddiApiServiceNode2)
                .getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY));
        logger.info("Setting replication url on Node 2...@"
                + manager.getClientConfig().getUDDINode(CFG_node2_SAM).getReplicationUrl());
        juddiApiServiceNode2.setReplicationNodes(rootNode2Token, replicationNode1);

    } catch (Exception ex) {
        TckCommon.PrintMarker();
        ex.printStackTrace();
        TckCommon.PrintMarker();
    }
}

From source file:org.apache.juddi.validation.ValidateValuesFromWebService.java

private static UDDIValueSetValidationPortType getPort(String url) throws ValueNotAllowedException {
    UDDIService svc = new UDDIService();
    UDDIValueSetValidationPortType vsv = svc.getUDDIValueSetValidationPort();

    if (url == null || url.trim().length() == 0) {
        log.error("VSV Validation Failed: Calling Url is null");
        ValueNotAllowedException x = new ValueNotAllowedException(
                new ErrorMessage("errors.valuesetvalidation.invalidurl"));
        throw x;/* www.  j av a2s  .  c  om*/
    } else if (url.startsWith(Property.DEFAULT_BASE_URL) || url.startsWith(Property.DEFAULT_BASE_URL_SECURE)) {
        vsv = new UDDIValueSetValidationImpl();

    } else if (url.startsWith("classpath:/")) {
        try {
            String clz = url.substring(11);
            Class<UDDIValueSetValidationPortType> forName = (Class<UDDIValueSetValidationPortType>) Class
                    .forName(clz);
            vsv = forName.newInstance();
        } catch (Exception ex) {
            log.error("VSV Validation Failed: Cannot locate class from url " + url, ex);
        }
    } else if (url.toLowerCase().startsWith("http")) {
        //external service, stick with 
        log.info("Calling External VSV Service");
        ((BindingProvider) vsv).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
    } else {
        log.warn("Unable to figure out how to use the URL " + url
                + " as a Value Set Validation Service transport mechanism.");
        ValueNotAllowedException x = new ValueNotAllowedException(
                new ErrorMessage("errors.valuesetvalidation.invalidurl", url));
        throw x;
    }

    return vsv;
}

From source file:org.apache.metamodel.sugarcrm.SugarCrmDataContext.java

/**
 * //from  ww w.j  a  v a 2  s .  c o m
 * @param sugarCrmBaseUrl
 *            the base URL of the SugarCRM system, e.g.
 *            http://127.0.0.1:9090/sugarcrm
 * @param username
 * @param password
 * @param applicationName
 */
public SugarCrmDataContext(String sugarCrmBaseUrl, final String username, String password,
        final String applicationName) {
    if (sugarCrmBaseUrl.endsWith("/")) {
        // remove trailing slashes
        sugarCrmBaseUrl = sugarCrmBaseUrl.substring(0, sugarCrmBaseUrl.length() - 1);
    }

    final String endpointAddress = sugarCrmBaseUrl + "/service/v4/soap.php";
    final String wsdlAddress = endpointAddress + "?wsdl";

    logger.info("Connecting to SugarCRM SOAP service using WSDL URL: {}", wsdlAddress);

    final URL wsdlUrl;
    try {
        wsdlUrl = new URL(wsdlAddress);
    } catch (Exception e) {
        throw new IllegalArgumentException("Invalid SugarCRM base URL: " + e.getMessage(), e);
    }

    final Sugarsoap soap = new Sugarsoap(wsdlUrl, new QName("http://www.sugarcrm.com/sugarcrm", "sugarsoap"));
    _service = soap.getSugarsoapPort();

    assert _service instanceof BindingProvider;
    final BindingProvider bindingProvider = (BindingProvider) _service;
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);

    final String md5password = DigestUtils.md5Hex(password);
    _sessionId = new LazyRef<String>() {
        @Override
        protected String fetch() {
            UserAuth userAuth = new UserAuth();
            userAuth.setUserName(username);
            userAuth.setPassword(md5password);
            logger.debug("Logging in as '{}', with application name '{}'", username, applicationName);
            EntryValue response = _service.login(userAuth, applicationName, new NameValueList());
            String sessionId = response.getId();
            logger.info("Started session with SugarCRM. Session ID: {}", sessionId);
            return sessionId;
        }
    };
}

From source file:org.hspconsortium.cwfdemo.api.eps.EPSService.java

public void init() {
    if (!serviceEndpoint.endsWith("/")) {
        serviceEndpoint += "/";
    }/*  w ww  .j  a va 2s.c o m*/

    PublicationServiceSE ps = new PublicationServiceSE();
    publisherPort = ps.getPublicationPort();
    ((BindingProvider) publisherPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            serviceEndpoint + "publication");

    SubscriptionServiceSE ss = new SubscriptionServiceSE();
    subscriberPort = ss.getSubscriptionPort();
    ((BindingProvider) subscriberPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            serviceEndpoint + "subscriptionService");

    BrokerServiceSE bs = new BrokerServiceSE();
    brokerPort = bs.getBrokerPort();
    ((BindingProvider) brokerPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            serviceEndpoint + "broker");

    ThreadUtil.startThread(eventPoller);
}

From source file:org.josso.gateway.jaxws.JAXWSWebserviceGatewayServiceLocator.java

private void setEndpointAddress(Object port, String newAddress) {

    assert port instanceof BindingProvider : "Doesn't appear to be a valid port";
    assert newAddress != null : "Doesn't appear to be a valid address";

    BindingProvider bp = (BindingProvider) port;

    Map<String, Object> context = bp.getRequestContext();

    Object oldAddress = context.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);

    context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, newAddress);

}

From source file:org.miloss.fgsms.presentation.Helper.java

public static String ShowOpStat(SecurityWrapper c,
            org.miloss.fgsms.services.interfaces.status.OpStatusService ss, String url) {
        StringBuilder out = new StringBuilder();
        String[] urls = url.split("|");
        for (int i = 0; i < urls.length; i++) {
            try {

                BindingProvider bp = (BindingProvider) ss;
                bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, urls[i]);

                GetOperatingStatusRequestMessage req = new GetOperatingStatusRequestMessage();
                req.setClassification(c);
                GetOperatingStatusResponseMessage res = ss.getOperatingStatus(req);
                if (res.isStatus()) {
                    out.append("<h2>OK</h2>");

                } else {
                    out.append("<h2>BAD</h2>");
                }//  w ww . j  a  va2 s. c  o  m
                out.append("Started at: ").append(res.getStartedAt().toString()).append("<br>");
                out.append("Status Message:").append(Utility.encodeHTML(res.getStatusMessage())).append("<br>");
                out.append("Version Data: ").append(Utility.encodeHTML(res.getVersionInfo().getVersionData()))
                        .append("<br>");
                out.append("Version Source: ").append(Utility.encodeHTML(res.getVersionInfo().getVersionSource()))
                        .append("<br>");
                out.append("Data Sent Failure: ").append(res.getDataNotSentSuccessfully()).append("<br>");
                out.append("Data Sent Success: ").append(res.getDataSentSuccessfully()).append("<br>");
            } catch (Exception ex) {
                out.append("Error caught checking stats on ").append(urls[i]).append(" ").append(ex.getMessage());
            }
        }
        return out.toString();
    }

From source file:org.miloss.fgsms.tests.ManualLoadTests.java

public void init(String url, String username, String password, boolean moreOutput) {
    this.moreOutput = moreOutput;
    if (url != null) {
        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
    } else {//from   w w w  .  j  av a2 s .c  o m
        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, cfg.getPCS_URLS().get(0));
    }

    if (username != null) {
        bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, username);
    } else {
        bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, cfg.getUsername());
    }

    if (password != null) {
        bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
    } else {
        bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, Utility.DE(cfg.getPassword()));
    }

}

From source file:org.mule.modules.taleo.client.TaleoCxfClientImpl.java

@Override
public void connect(String username, String password, String companyCode) throws ConnectionException {

    try {/*from w ww .j  av a  2  s.com*/
        endpoint = this.getUrl(companyCode);
    } catch (TaleoException e) {
        throw new ConnectionException(null, e.getLocalizedMessage(), e.getMessage(), e);
    }
    rpc = serviceClient.getPort(IWebAPI.class);

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

    Client cxfClient = ClientProxy.getClient(rpc);
    cxfClient.getInInterceptors().add(new CustomMessageReaderInterceptor());
    String loginResult;
    try {
        loginResult = this.rpc.login(companyCode, username, password);
    } catch (WebServicesException_Exception e) {
        throw new ConnectionException(null, e.getLocalizedMessage(), e.getMessage(), e);
    }

    sessionId = loginResult;

    bindingProvider.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, sessionId);

    sessionId = loginResult;

}