Package org.apache.cxf.jaxws

Examples of org.apache.cxf.jaxws.EndpointImpl


    public Endpoint createEndpoint(String bindingId, Object implementor) {

        Endpoint ep = null;
        if (EndpointUtils.isValidImplementor(implementor)) {
            Bus bus = BusFactory.getDefaultBus();
            ep = new EndpointImpl(bus, implementor, bindingId);
            return ep;
        } else {
            throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString());
        }
    }
View Full Code Here


        int readCount;
        while ((readCount = r.read(buffer, 0, 1024)) > 0) {
            writer.write(buffer, 0, readCount);
        }
        String xml = writer.toString();
        EndpointImpl endpoint = this.getBean(EndpointImpl.class, "greeter-service-endpoint");
        JsSimpleDomNode xmlResponse =
            testUtilities.rhinoCallConvert("testSyncXml",
                                           JsSimpleDomNode.class,
                                           testUtilities.javaToJS(endpoint.getAddress()),
                                           testUtilities.javaToJS(xml));
        assertNotNull(xmlResponse);
        Document doc = (Document)xmlResponse.getWrappedNode();
        XPath echoStringPath = new DOMXPath("//t:responseType/text()");
        echoStringPath.addNamespace("t", "http://apache.org/hello_world_xml_http/wrapped/types");
View Full Code Here

        assertTrue(logWriter.toString().contains("BeepBeep:"));
    }


    private void testInterceptors(ClassPathXmlApplicationContext ctx) {
        EndpointImpl ep;
        ep = (EndpointImpl) ctx.getBean("epWithInterceptors");
        assertNotNull(ep);
        List<Interceptor> inInterceptors = ep.getInInterceptors();
        boolean saaj = false;
        boolean logging = false;
        for (Interceptor<?> i : inInterceptors) {
            if (i instanceof SAAJInInterceptor) {
                saaj = true;
            } else if (i instanceof LoggingInInterceptor) {
                logging = true;
            }
        }
        assertTrue(saaj);
        assertTrue(logging);

        saaj = false;
        logging = false;
        for (Interceptor<?> i : ep.getOutInterceptors()) {
            if (i instanceof SAAJOutInterceptor) {
                saaj = true;
            } else if (i instanceof LoggingOutInterceptor) {
                logging = true;
            }
View Full Code Here

    public Endpoint createEndpoint(String bindingId, Object implementor) {

        Endpoint ep = null;
        if (EndpointUtils.isValidImplementor(implementor)) {
            Bus bus = BusFactory.getThreadDefaultBus();
            ep = new EndpointImpl(bus, implementor, bindingId);
            return ep;
        } else {
            throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString());
        }
    }
View Full Code Here

                Class<?> clz = classes.iterator().next();
                serviceImplementation = clz.newInstance();
                if (EndpointUtils.isValidImplementor(serviceImplementation)) {
                    createProviderConfiguration();
                   
                    endpoint = new EndpointImpl(bus, serviceImplementation, "null");
                    //dummy endpoint to publish on
                    endpoint.publish("http://foo/bar/baz");
                   
                }
               
View Full Code Here

            new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/jaxws/spring/endpoints.xml"});

        Object bean = ctx.getBean("simple");
        assertNotNull(bean);

        EndpointImpl ep = (EndpointImpl) bean;
        assertNotNull(ep.getImplementor());
        assertNotNull(ep.getServer());

        bean = ctx.getBean("simpleWithAddress");
        assertNotNull(bean);

        ep = (EndpointImpl) bean;
        if (!(ep.getImplementor() instanceof org.apache.hello_world_soap_http.GreeterImpl)) {
            fail("can't get the right implementor object");
        }
        assertEquals("http://localhost:8080/simpleWithAddress",
                     ep.getServer().getEndpoint().getEndpointInfo().getAddress());

        bean = ctx.getBean("inlineImplementor");
        assertNotNull(bean);

        ep = (EndpointImpl) bean;
        if (!(ep.getImplementor() instanceof org.apache.hello_world_soap_http.GreeterImpl)) {
            fail("can't get the right implementor object");
        }
        org.apache.hello_world_soap_http.GreeterImpl impl =
            (org.apache.hello_world_soap_http.GreeterImpl)ep.getImplementor();
        assertEquals("The property was not injected rightly", impl.getPrefix(), "hello");
        assertNotNull(ep.getServer());


        bean = ctx.getBean("inlineInvoker");
        assertNotNull(bean);
        ep = (EndpointImpl) bean;
        assertTrue(ep.getInvoker() instanceof NullInvoker);
        assertTrue(ep.getService().getInvoker() instanceof NullInvoker);

        bean = ctx.getBean("simpleWithBindingUri");
        assertNotNull(bean);
        ep = (EndpointImpl) bean;
        assertEquals("get the wrong bindingId",
                     ep.getBindingUri(),
                     "http://cxf.apache.org/bindings/xformat");

        bean = ctx.getBean("simpleWithBinding");
        assertNotNull(bean);
        ep = (EndpointImpl) bean;
        BindingConfiguration bc = ep.getBindingConfig();
        assertTrue(bc instanceof SoapBindingConfiguration);
        SoapBindingConfiguration sbc = (SoapBindingConfiguration) bc;
        assertTrue(sbc.getVersion() instanceof Soap12);
        assertTrue("the soap configure should set isMtomEnabled to be true",
                   sbc.isMtomEnabled());

        bean = ctx.getBean("implementorClass");
        assertNotNull(bean);
        ep = (EndpointImpl) bean;
        assertEquals(Hello.class, ep.getImplementorClass());
        assertTrue(ep.getImplementor().getClass() == Object.class);

        bean = ctx.getBean("epWithProps");
        assertNotNull(bean);

        ep = (EndpointImpl) bean;
        assertEquals("bar", ep.getProperties().get("foo"));

        bean = ctx.getBean("classImpl");
        assertNotNull(bean);

        ep = (EndpointImpl) bean;
        assertTrue(ep.getImplementor() instanceof Hello);

        QName name = ep.getServer().getEndpoint().getService().getName();
        assertEquals("http://service.jaxws.cxf.apache.org/service", name.getNamespaceURI());
        assertEquals("HelloServiceCustomized", name.getLocalPart());

        name = ep.getServer().getEndpoint().getEndpointInfo().getName();
        assertEquals("http://service.jaxws.cxf.apache.org/endpoint", name.getNamespaceURI());
        assertEquals("HelloEndpointCustomized", name.getLocalPart());

        bean = ctx.getBean("wsdlLocation");
        assertNotNull(bean);

        bean = ctx.getBean("publishedEndpointUrl");
        assertNotNull(bean);
        String expectedEndpointUrl = "http://cxf.apache.org/Greeter";
        ep = (EndpointImpl) bean;
        assertEquals(expectedEndpointUrl, ep.getPublishedEndpointUrl());

        // test for existence of Endpoint without an id element
        boolean found = false;
        String[] names = ctx.getBeanNamesForType(EndpointImpl.class);
        for (String n : names) {
View Full Code Here

    protected void run() {
        Object implementor = new SwAServiceImpl();
        String address = "http://localhost:9036/swa";
        try {
            EndpointImpl ep = (EndpointImpl) Endpoint.create(implementor);
            ep.setWsdlLocation("classpath:wsdl/swa-mime.wsdl");
            ep.publish(address);
        } catch (Exception e) {
            e.printStackTrace();
            Thread.currentThread().interrupt();
        }
    }
View Full Code Here

        int readCount;
        while ((readCount = r.read(buffer, 0, 1024)) > 0) {
            writer.write(buffer, 0, readCount);
        }
        String xml = writer.toString();
        EndpointImpl endpoint = this.getBean(EndpointImpl.class, "greeter-service-endpoint");
        JsSimpleDomNode xmlResponse =
            testUtilities.rhinoCallConvert("testSyncXml",
                                           JsSimpleDomNode.class,
                                           testUtilities.javaToJS(endpoint.getAddress()),
                                           testUtilities.javaToJS(xml));
        assertNotNull(xmlResponse);
        Document doc = (Document)xmlResponse.getWrappedNode();
        testUtilities.addNamespace("t", "http://apache.org/hello_world_xml_http/wrapped/types");
        XPath textPath = XPathAssert.createXPath(testUtilities.getNamespaces());
View Full Code Here

       
        createStaticBus(SecurityPolicyTest.class.getResource("https_config.xml").toString())
            .getExtension(PolicyEngine.class).setEnabled(true);
        getStaticBus().getOutInterceptors().add(new LoggingOutInterceptor());
       
        EndpointImpl ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
        ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortHttps"));
        ep.setWsdlLocation(wsdl.getPath());
        ep.setAddress(POLICY_HTTPS_ADDRESS);
        ep.publish();
        ep.getServer().getEndpoint().getEndpointInfo().setProperty(SecurityConstants.CALLBACK_HANDLER,
                                                                   new ServerPasswordCallback());
        Endpoint.publish(POLICY_ADDRESS, new DoubleItImpl());
       
        ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
        ep.setEndpointName(
            new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortEncryptThenSign")
        );
        ep.setWsdlLocation(wsdl.getPath());
        ep.setAddress(POLICY_ENCSIGN_ADDRESS);
        ep.publish();
        EndpointInfo ei = ep.getServer().getEndpoint().getEndpointInfo();
        setCryptoProperties(ei, "bob.properties", "alice.properties");

        ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
        ep.setEndpointName(
            new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortSignThenEncrypt")
        );
        ep.setWsdlLocation(wsdl.getPath());
        ep.setAddress(POLICY_SIGNENC_ADDRESS);
        ep.publish();
        ei = ep.getServer().getEndpoint().getEndpointInfo();
        setCryptoProperties(ei, "bob.properties", "alice.properties");

        ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
        ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortSign"));
        ep.setWsdlLocation(wsdl.getPath());
        ep.setAddress(POLICY_SIGN_ADDRESS);
        ep.publish();
        ei = ep.getServer().getEndpoint().getEndpointInfo();
        setCryptoProperties(ei, "bob.properties", "alice.properties");

        ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
        ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortXPath"));
        ep.setWsdlLocation(wsdl.getPath());
        ep.setAddress(POLICY_XPATH_ADDRESS);
        ep.publish();
        ei = ep.getServer().getEndpoint().getEndpointInfo();
        setCryptoProperties(ei, "alice.properties", "bob.properties");
       
        ep = (EndpointImpl)Endpoint.publish(POLICY_SIGNENC_PROVIDER_ADDRESS,
                                            new DoubleItProvider());
       
        ei = ep.getServer().getEndpoint().getEndpointInfo();
        setCryptoProperties(ei, "bob.properties", "alice.properties");
       
        ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
        ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortSignedOnly"));
        ep.setWsdlLocation(wsdl.getPath());
        ep.setAddress(POLICY_SIGNONLY_ADDRESS);
        ep.publish();
        ei = ep.getServer().getEndpoint().getEndpointInfo();
        setCryptoProperties(ei, "bob.properties", "alice.properties");
       
        ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
        ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortCXF3041"));
        ep.setWsdlLocation(wsdl.getPath());
        ep.setAddress(POLICY_CXF3041_ADDRESS);
        ep.publish();
        ei = ep.getServer().getEndpoint().getEndpointInfo();
        setCryptoProperties(ei, "bob.properties", "alice.properties");
       
        ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
        ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortCXF3042"));
        ep.setWsdlLocation(wsdl.getPath());
        ep.setAddress(POLICY_CXF3042_ADDRESS);
        ep.publish();
        ei = ep.getServer().getEndpoint().getEndpointInfo();
        setCryptoProperties(ei, "alice.properties", "alice.properties");

        ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
        ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortCXF3452"));
        ep.setWsdlLocation(wsdl.getPath());
        ep.setAddress(POLICY_CXF3452_ADDRESS);
        ep.publish();
        ei = ep.getServer().getEndpoint().getEndpointInfo();
        setCryptoProperties(ei, "alice.properties", "alice.properties");
        ei.setProperty(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);
    }
View Full Code Here

    @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();
        SpringBusFactory.setDefaultBus(bus);
        SpringBusFactory.setThreadDefaultBus(bus);
        Service service = Service.create(wsdl, SERVICE_QNAME);

        DoubleItPortType pt;

        QName
        portQName = new QName(NAMESPACE, "DoubleItPortCXF4122");
        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,
                                                      getClass().getResource("revocation.properties"));
        ((BindingProvider)pt).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES,
                                                      getClass().getResource("bob.properties"));
        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...
            assertTrue(errorMessage.contains("Certificate has been revoked")
                       || errorMessage.contains("Certificate revocation")
                       || errorMessage.contains("Error during certificate path validation"));
        }
        ((java.io.Closeable)pt).close();
        ep.stop();
        epBus.shutdown(true);
        bus.shutdown(true);
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.jaxws.EndpointImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.