Search in sources :

Example 46 with EndpointImpl

use of org.apache.cxf.jaxws.EndpointImpl in project cxf by apache.

the class ClientMtomXopWithJMSTest method startServers.

@BeforeClass
public static void startServers() throws Exception {
    Object implementor = new TestMtomJMSImpl();
    bus = BusFactory.getDefaultBus();
    ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
    PooledConnectionFactory cfp = new PooledConnectionFactory(cf);
    cff = new ConnectionFactoryFeature(cfp);
    EndpointImpl ep = (EndpointImpl) Endpoint.create(implementor);
    ep.getFeatures().add(cff);
    ep.getInInterceptors().add(new TestMultipartMessageInterceptor());
    ep.getOutInterceptors().add(new TestAttachmentOutInterceptor());
    // ep.getInInterceptors().add(new LoggingInInterceptor());
    // ep.getOutInterceptors().add(new LoggingOutInterceptor());
    SOAPBinding jaxWsSoapBinding = (SOAPBinding) ep.getBinding();
    jaxWsSoapBinding.setMTOMEnabled(true);
    ep.publish();
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) ConnectionFactoryFeature(org.apache.cxf.transport.jms.ConnectionFactoryFeature) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) PooledConnectionFactory(org.apache.activemq.pool.PooledConnectionFactory) SOAPBinding(javax.xml.ws.soap.SOAPBinding) BeforeClass(org.junit.BeforeClass)

Example 47 with EndpointImpl

use of org.apache.cxf.jaxws.EndpointImpl in project cxf by apache.

the class Server method run.

protected void run() {
    TestProvider implementor = new TestProvider();
    Endpoint ep = Endpoint.create(implementor);
    ((EndpointImpl) ep).setWsdlLocation("wsdl_systest/mtom_provider_validate.wsdl");
    ep.publish("http://localhost:" + PORT + "/mtom/provider");
}
Also used : Endpoint(javax.xml.ws.Endpoint) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl)

Example 48 with EndpointImpl

use of org.apache.cxf.jaxws.EndpointImpl in project cxf by apache.

the class ManualNumberFactoryImpl method initDefaultServant.

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();
}
Also used : QName(javax.xml.namespace.QName) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl)

Example 49 with EndpointImpl

use of org.apache.cxf.jaxws.EndpointImpl in project cxf by apache.

the class SecurityPolicyTest method testCXF4122.

@Test
public void testCXF4122() throws Exception {
    Bus epBus = BusFactory.newInstance().createBus();
    BusFactory.setDefaultBus(epBus);
    URL wsdl = SecurityPolicyTest.class.getResource("DoubleIt.wsdl");
    DoubleItPortTypeImpl implementor = new DoubleItPortTypeImpl();
    implementor.setEnforcePrincipal(false);
    EndpointImpl ep = (EndpointImpl) Endpoint.create(implementor);
    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);
}
Also used : Bus(org.apache.cxf.Bus) DoubleItPortTypeImpl(org.apache.cxf.systest.ws.common.DoubleItPortTypeImpl) QName(javax.xml.namespace.QName) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) Service(javax.xml.ws.Service) URL(java.net.URL) UnsupportedCallbackException(javax.security.auth.callback.UnsupportedCallbackException) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) IOException(java.io.IOException) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) DoubleItPortType(org.example.contract.doubleit.DoubleItPortType) KeystorePasswordCallback(org.apache.cxf.systest.ws.common.KeystorePasswordCallback) Test(org.junit.Test)

Example 50 with EndpointImpl

use of org.apache.cxf.jaxws.EndpointImpl in project cxf by apache.

the class WSDiscoveryServiceImpl method startup.

public synchronized boolean startup(boolean optional) {
    String preferIPv4StackValue = System.getProperty("java.net.preferIPv4Stack");
    String preferIPv6AddressesValue = System.getProperty("java.net.preferIPv6Addresses");
    if (!started && client.isAdHoc()) {
        Bus b = BusFactory.getAndSetThreadDefaultBus(bus);
        try {
            udpEndpoint = new EndpointImpl(bus, new WSDiscoveryProvider());
            Map<String, Object> props = new HashMap<>();
            props.put("jaxws.provider.interpretNullAsOneway", "true");
            udpEndpoint.setProperties(props);
            if ("true".equals(preferIPv6AddressesValue) && "false".equals(preferIPv4StackValue)) {
                try {
                    udpEndpoint.publish("soap.udp://[FF02::C]:3702");
                    started = true;
                } catch (Exception e) {
                    LOG.log(Level.WARNING, "Could not start WS-Discovery Service with ipv6 address", e);
                }
            }
            if (!started) {
                udpEndpoint.publish("soap.udp://239.255.255.250:3702");
                started = true;
            }
        } catch (RuntimeException ex) {
            if (!optional) {
                throw ex;
            }
            LOG.log(Level.WARNING, "Could not start WS-Discovery Service.", ex);
        } finally {
            if (b != bus) {
                BusFactory.setThreadDefaultBus(b);
            }
        }
    }
    return true;
}
Also used : Bus(org.apache.cxf.Bus) HashMap(java.util.HashMap) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) XMLStreamException(javax.xml.stream.XMLStreamException) JAXBException(javax.xml.bind.JAXBException) IOException(java.io.IOException)

Aggregations

EndpointImpl (org.apache.cxf.jaxws.EndpointImpl)66 QName (javax.xml.namespace.QName)14 Bean (org.springframework.context.annotation.Bean)10 Bus (org.apache.cxf.Bus)9 Test (org.junit.Test)9 BeforeClass (org.junit.BeforeClass)7 Endpoint (javax.xml.ws.Endpoint)5 URL (java.net.URL)4 HashMap (java.util.HashMap)4 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)4 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)4 Feature (org.apache.cxf.feature.Feature)4 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)4 SOAPBinding (javax.xml.ws.soap.SOAPBinding)3 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)3 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 JAXBException (javax.xml.bind.JAXBException)2 XMLStreamException (javax.xml.stream.XMLStreamException)2