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

The following examples show how to use org.apache.cxf.jaxws.EndpointImpl#setWsdlLocation() . 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: MDBActivationWork.java    From cxf with Apache License 2.0 5 votes vote down vote up
private Server createServerFromJaxwsEndpoint(JaxWsServerFactoryBean factory) {

        @SuppressWarnings("resource")
        EndpointImpl endpoint = new EndpointImpl(factory.getBus(), null, factory);

        endpoint.setWsdlLocation(factory.getWsdlURL());
        endpoint.setImplementorClass(factory.getServiceClass());
        endpoint.setEndpointName(factory.getEndpointName());
        endpoint.setServiceName(factory.getServiceName());
        endpoint.setInvoker(factory.getInvoker());
        endpoint.setSchemaLocations(factory.getSchemaLocations());

        return endpoint.getServer(factory.getAddress());
    }
 
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);
}