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:com.evolveum.midpoint.testing.model.client.sample.TestExchangeConnector.java

public ModelPortType createModelPort(String[] args) {
    String endpointUrl = DEFAULT_ENDPOINT_URL;

    if (args.length > 0) {
        endpointUrl = args[0];/*from   w w w  .  jav a  2s. c  o  m*/
    }

    System.out.println("Endpoint URL: " + endpointUrl);

    // uncomment this if you want to use Fiddler or any other proxy
    //ProxySelector.setDefault(new MyProxySelector("127.0.0.1", 8888));

    ModelService modelService = new ModelService();
    ModelPortType modelPort = modelService.getModelPort();
    BindingProvider bp = (BindingProvider) modelPort;
    Map<String, Object> requestContext = bp.getRequestContext();
    requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUrl);

    org.apache.cxf.endpoint.Client client = ClientProxy.getClient(modelPort);
    org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();

    Map<String, Object> outProps = new HashMap<String, Object>();

    outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
    outProps.put(WSHandlerConstants.USER, ADM_USERNAME);
    outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
    outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientPasswordHandler.class.getName());

    WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
    cxfEndpoint.getOutInterceptors().add(wssOut);
    // enable the following to get client-side logging of outgoing requests and incoming responses
    //cxfEndpoint.getOutInterceptors().add(new LoggingOutInterceptor());
    //cxfEndpoint.getInInterceptors().add(new LoggingInInterceptor());

    return modelPort;
}

From source file:org.apache.cxf.systest.coloc.AbstractColocTest.java

/**
 * Create client and return the port/*  w  ww .  ja  v a  2s .  co m*/
 * @return port for a interface represented by cls.
 */
protected <T> T getPort(QName serviceName, QName portName, String wsdlLocation, Class<T> cls) {
    Service srv = Service.create(AbstractColocTest.class.getResource(wsdlLocation), serviceName);
    T t = srv.getPort(portName, cls);
    ((BindingProvider) t).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getTransportURI());
    return t;
}

From source file:org.apache.juddi.api.runtime.CLIServerTest.java

@Test
public void testGetReplicationConfig() throws Exception {

    JUDDIApiPortType juddiApiService = new JUDDIApiService().getJUDDIApiImplPort();
    ((BindingProvider) juddiApiService).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            juddiUrl);/*  ww w. j av  a  2 s .co m*/
    juddiApiService.getReplicationNodes(null);
    Assert.assertTrue(sink);
    sink = false;
}

From source file:org.apache.juddi.api.runtime.CLIServerTest.java

@Test
public void testSetReplicationConfig() throws Exception {

    JUDDIApiPortType juddiApiService = new JUDDIApiService().getJUDDIApiImplPort();
    ((BindingProvider) juddiApiService).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            juddiUrl);//  w  w w . j  av  a  2 s. c om
    ReplicationConfiguration replicationConfiguration = new ReplicationConfiguration();
    replicationConfiguration.setCommunicationGraph(new CommunicationGraph());
    replicationConfiguration.setRegistryContact(new ReplicationConfiguration.RegistryContact());
    replicationConfiguration.getRegistryContact().setContact(new Contact());
    replicationConfiguration.getRegistryContact().getContact().getPersonName()
            .add(new PersonName("name", null));

    juddiApiService.setReplicationNodes(null, replicationConfiguration);
    Assert.assertTrue(sink);
    sink = false;
}

From source file:org.apache.juddi.api.runtime.CLIServerTest.java

@Test
public void testReplicationGetChanges() throws Exception {

    UDDIReplicationPortType juddiApiService = new UDDIService().getUDDIReplicationPort();
    ((BindingProvider) juddiApiService).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            replUrl);/*from www.j av a 2 s.c o  m*/
    juddiApiService.getChangeRecords(new GetChangeRecords());
    Assert.assertTrue(sink);
    sink = false;
}

From source file:org.apache.juddi.api.runtime.CLIServerTest.java

@Test
public void testReplicationPing() throws Exception {

    UDDIReplicationPortType juddiApiService = new UDDIService().getUDDIReplicationPort();
    ((BindingProvider) juddiApiService).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            replUrl);/*from w ww . java  2 s. c  o  m*/
    juddiApiService.doPing(new DoPing());//null, new HighWaterMarkVectorType(), BigInteger.ONE, new HighWaterMarkVectorType());
    Assert.assertTrue(sink);
    sink = false;
}

From source file:org.apache.juddi.replication.ReplicationNotifier.java

/**
 * return true if successful/*from w  w  w  .  java 2  s  .  c o m*/
 *
 * @param x
 * @param s
 * @param req
 * @return
 */
private boolean SendNotification(UDDIReplicationPortType x, String s, NotifyChangeRecordsAvailable req) {
    ((BindingProvider) x).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, s);
    try {
        x.notifyChangeRecordsAvailable(req);
        log.info("Successfully sent change record available message to " + s + " this node: " + node);
        return true;
    } catch (Exception ex) {
        log.warn("Unable to send change notification to " + s + " this node: " + node + " reason: "
                + ex.getMessage());
        log.debug("Unable to send change notification to " + s, ex);
    }
    return false;
}

From source file:org.apache.juddi.samples.JuddiAdminService.java

void printStatus(Transport transport, String authtoken) throws Exception {

    JUDDIApiPortType juddiApiService = transport.getJUDDIApiService();
    System.out.println("fetching...");

    ReplicationConfiguration replicationNodes = null;
    try {//from   www . java2s.c  om
        replicationNodes = juddiApiService.getReplicationNodes(authtoken);
    } catch (Exception ex) {
        System.out.println("Error getting replication config");
        ex.printStackTrace();
        replicationNodes = new ReplicationConfiguration();

    }
    UDDIReplicationPortType uddiReplicationPort = new UDDIService().getUDDIReplicationPort();

    for (Operator o : replicationNodes.getOperator()) {
        System.out.println("*******************\n\rstats for node " + o.getOperatorNodeID());
        ((BindingProvider) uddiReplicationPort).getRequestContext()
                .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, o.getSoapReplicationURL());

        List<ChangeRecordIDType> highWaterMarks = uddiReplicationPort.getHighWaterMarks();
        for (ChangeRecordIDType cr : highWaterMarks) {
            JAXB.marshal(cr, System.out);
        }
    }
}

From source file:org.apache.juddi.samples.JuddiAdminService.java

void printStatus() throws Exception {

    //List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
    Transport transport = clerkManager.getTransport("default");
    String authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root"))
            .getAuthInfo();//  w w  w  . j a  v a2  s  .  co  m

    JUDDIApiPortType juddiApiService = transport.getJUDDIApiService();
    System.out.println("fetching...");

    ReplicationConfiguration replicationNodes = null;
    try {
        replicationNodes = juddiApiService.getReplicationNodes(authtoken);
    } catch (Exception ex) {
        System.out.println("Error getting replication config");
        ex.printStackTrace();
        replicationNodes = new ReplicationConfiguration();

    }
    UDDIReplicationPortType uddiReplicationPort = new UDDIService().getUDDIReplicationPort();

    for (Operator o : replicationNodes.getOperator()) {
        System.out.println("*******************\n\rstats for node " + o.getOperatorNodeID());
        ((BindingProvider) uddiReplicationPort).getRequestContext()
                .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, o.getSoapReplicationURL());

        List<ChangeRecordIDType> highWaterMarks = uddiReplicationPort.getHighWaterMarks();
        for (ChangeRecordIDType cr : highWaterMarks) {
            JAXB.marshal(cr, System.out);
        }
    }

}

From source file:org.apache.juddi.samples.JuddiAdminService.java

void printStatusSingleNode(Transport transport, String authtoken) throws Exception {
    String replicationUrl = clerkManager.getClientConfig().getUDDINode(curentnode).getReplicationUrl();

    SSLContext sc = SSLContext.getInstance("SSLv3");

    KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());

    KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
    ks.load(new FileInputStream(System.getProperty("javax.net.ssl.keyStore")),
            System.getProperty("javax.net.ssl.keyStorePassword").toCharArray());

    kmf.init(ks, System.getProperty("javax.net.ssl.keyStorePassword").toCharArray());

    sc.init(kmf.getKeyManagers(), null, null);

    UDDIReplicationPortType uddiReplicationPort = new UDDIService().getUDDIReplicationPort();
    ((BindingProvider) uddiReplicationPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            replicationUrl);//  w  w w  . java  2 s . c  o m
    ((BindingProvider) uddiReplicationPort).getRequestContext()
            .put("com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory", sc.getSocketFactory());
    /*((BindingProvider) uddiReplicationPort).getRequestContext()
     .put(
     JAXWSProperties.SSL_SOCKET_FACTORY,
     sc.getSocketFactory());*/

    String doPing = uddiReplicationPort.doPing(new DoPing());
    System.out.println(doPing + ".., success");

}