Java Code Examples for org.apache.cxf.jaxws.EndpointImpl#setAddress()

The following examples show how to use org.apache.cxf.jaxws.EndpointImpl#setAddress() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JMSTransactionTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void startServers() throws Exception {
    startBusAndJMS(JMSTransactionTest.class);
    //startBusAndJMS("tcp://localhost:61616");

    endpoint = new EndpointImpl(bus, new GreeterImplWithTransaction());
    endpoint.setAddress(SERVICE_ADDRESS);
    endpoint.setFeatures(Collections.singletonList(cff));
    endpoint.publish();
}
 
Example 2
Source File: SecurityPolicyTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testCXF4122() throws Exception {
    Bus epBus = BusFactory.newInstance().createBus();
    BusFactory.setDefaultBus(epBus);
    URL wsdl = SecurityPolicyTest.class.getResource("DoubleIt.wsdl");
    EndpointImpl ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
    ep.setEndpointName(
        new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortCXF4122")
    );
    ep.setWsdlLocation(wsdl.getPath());
    ep.setAddress(POLICY_CXF4122_ADDRESS);
    ep.publish();
    EndpointInfo ei = ep.getServer().getEndpoint().getEndpointInfo();
    setCryptoProperties(ei, "bob.properties", "revocation.properties");
    ei.setProperty(SecurityConstants.ENABLE_REVOCATION, Boolean.TRUE);

    SpringBusFactory bf = new SpringBusFactory();

    Bus bus = bf.createBus();
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    Service service = Service.create(wsdl, SERVICE_QNAME);

    QName portQName = new QName(NAMESPACE, "DoubleItPortCXF4122");
    DoubleItPortType pt = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(pt, PORT);
    ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER,
                                                  new KeystorePasswordCallback());
    ((BindingProvider)pt).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES,
                                                  "revocation.properties");
    ((BindingProvider)pt).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES,
                                                  "bob.properties");
    // DOM
    try {
        pt.doubleIt(5);
        fail("should fail on server side when do signature validation due the revoked certificates");
    } catch (Exception ex) {
        // expected
    }

    // TODO See WSS-464
    /*
    SecurityTestUtil.enableStreaming(pt);
    try {
        pt.doubleIt(5);
        fail("should fail on server side when do signature validation due the revoked certificates");
    } catch (Exception ex) {
        String errorMessage = ex.getMessage();
        // Different errors using different JDKs...
        System.out.println("ERR1: " + errorMessage);
    }
    */
    ((java.io.Closeable)pt).close();
    ep.stop();
    epBus.shutdown(true);
    bus.shutdown(true);
}