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

The following examples show how to use org.apache.cxf.jaxws.EndpointImpl#setEndpointName() . 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: ManualNumberFactoryImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected void initDefaultServant() {
    servant = new ManualNumberImpl();

    String wsdlLocation = "wsdl/factory_pattern.wsdl";
    String bindingId = null;
    EndpointImpl ep =
        new EndpointImpl(bus, servant, bindingId, wsdlLocation);
    ep.setEndpointName(new QName(NUMBER_SERVICE_QNAME.getNamespaceURI(), "NumberPort"));
    ep.publish(getServantAddressRoot());
    endpoints.add(ep);
    templateEpr = ep.getServer().getDestination().getAddress();
}
 
Example 3
Source File: HttpNumberFactoryImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected void initDefaultServant() {
    servant = new HttpNumberImpl();

    String wsdlLocation = "wsdl/factory_pattern.wsdl";
    String bindingId = null;
    EndpointImpl ep =
        new EndpointImpl(bus, servant, bindingId, wsdlLocation);
    ep.setEndpointName(new QName(NUMBER_SERVICE_QNAME.getNamespaceURI(), "NumberPort"));
    ep.publish(getServantAddressRoot());
    endpoints.add(ep);
    templateEpr = ep.getServer().getDestination().getAddress();
}
 
Example 4
Source File: Server.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected void run()  {
    // We use a null binding id in the call to EndpointImpl
    // constructor. Why?
    final String nullBindingID = null;

    // We need to specify to use defaults on constructing the
    // bus, because our configuration file doesn't have
    // everything needed.
    final boolean useDefaults = true;

    // We configure a new bus for this server.
    setBus(new SpringBusFactory().createBus(configFileURL, useDefaults));

    // This impl class must have the appropriate annotations
    // to match the WSDL file that we are using.
    Object implementor = new GreeterImpl(name);

    // I don't know why this works.
    ep =
        new EndpointImpl(
                getBus(),
                implementor,
                nullBindingID,
                this.getClass().getResource("greeting.wsdl").toString());
    // How the hell do I know what the name of the
    // http-destination is from using this call?
    ep.setEndpointName(new QName("http://apache.org/hello_world", name));
    ep.publish(address);
}
 
Example 5
Source File: Server.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected void run()  {
    // We use a null binding id in the call to EndpointImpl
    // constructor. Why?
    final String nullBindingID = null;

    // We need to specify to use defaults on constructing the
    // bus, because our configuration file doesn't have
    // everything needed.
    final boolean useDefaults = true;

    // We configure a new bus for this server.
    setBus(new SpringBusFactory().createBus(configFileURL, useDefaults));

    // This impl class must have the appropriate annotations
    // to match the WSDL file that we are using.
    Object implementor = new GreeterImpl(name);

    // I don't know why this works.
    ep =
        new EndpointImpl(
                getBus(),
                implementor,
                nullBindingID,
                this.getClass().getResource("greeting.wsdl").toString());
    // How the hell do I know what the name of the
    // http-destination is from using this call?
    ep.setEndpointName(new QName("http://apache.org/hello_world", name));
    ep.publish(address);
}
 
Example 6
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);
}