Package org.apache.cxf.jaxws

Examples of org.apache.cxf.jaxws.EndpointImpl


    }   
    public synchronized boolean startup(boolean optional) {
        if (!started && client.isAdHoc()) {
            Bus b = BusFactory.getAndSetThreadDefaultBus(bus);
            try {
                udpEndpoint = new EndpointImpl(bus, new WSDiscoveryProvider());
                Map<String, Object> props = new HashMap<String, Object>();
                props.put("jaxws.provider.interpretNullAsOneway", "true");
                udpEndpoint.setProperties(props);
                udpEndpoint.publish("soap.udp://239.255.255.250:3702");
                started = true;
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

    protected void run() {
        Object implementor = new AddNumberImpl();
        String address = "http://localhost:" + PORT + "/jaxws/add";
       
        EndpointImpl ep = new EndpointImpl(BusFactory.getThreadDefaultBus(),
                                           implementor,
                                           null,
                                           getWsdl());

        ep.publish(address);
       
        Endpoint.publish(address + "-provider", new AddNumberProvider());
        Endpoint.publish(address + "-providernows", new AddNumberProviderNoWsdl());
    }
View Full Code Here

    protected void run()  {   
        Object implementor = new AddNumberImpl();
        String address = "http://localhost:" + PORT + "/jaxws/add";
        //Endpoint.publish(address, implementor);

        EndpointImpl ep = (EndpointImpl) Endpoint.create(implementor);
        ep.getFeatures().add(new WSAddressingFeature());
        ep.publish(address);
    }
View Full Code Here

   
    protected void run() {
        Object implementor = new AddNumberImpl();
        String address = "http://localhost:" + PORT + "/AddNumberImplPort";
       
        EndpointImpl ep = new EndpointImpl(implementor);

        ep.getFeatures().add(new WSAddressingFeature());
        ep.publish(address);
    }
View Full Code Here

    protected void run() {
        Object implementor = new AddNumberImpl();
        String address = "http://localhost:" + PORT + "/jaxws/add";
       
        EndpointImpl ep = new EndpointImpl(BusFactory.getThreadDefaultBus(),
                                           implementor,
                                           null,
                                           getWsdl());
        ep.publish(address);
    }
View Full Code Here

       
    }
    protected void run()  {   
        Object implementor = new AddNumberReg();
        String address = "http://localhost:" + PORT + "/jaxws/add";
        EndpointImpl ep;
        ep = new EndpointImpl(BusFactory.getThreadDefaultBus(),
                                           implementor,
                                           null,
                                           getWsdl());

        ep.getFeatures().add(new WSAddressingFeature());
        ep.publish(address);

        implementor = new AddNumberNonAnon();
        address = "http://localhost:" + PORT + "/jaxws/addNonAnon";
       
        ep = new EndpointImpl(BusFactory.getThreadDefaultBus(),
                                           implementor,
                                           null,
                                           getWsdl());

        ep.getFeatures().add(new WSAddressingFeature());
        ep.publish(address);

        implementor = new AddNumberOnlyAnon();
        address = "http://localhost:" + PORT + "/jaxws/addAnon";
       
        ep = new EndpointImpl(BusFactory.getThreadDefaultBus(),
                                           implementor,
                                           null,
                                           getWsdl());

        ep.getFeatures().add(new WSAddressingFeature());
        ep.publish(address);
    }
View Full Code Here

    @Test
    public void testEndpoints() throws Exception {
        ClassPathXmlApplicationContext ctx =
            new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/jaxws/spring/endpoints.xml"});

        EndpointImpl ep = getEndpointImplBean("simple", ctx);
        assertNotNull(ep.getImplementor());
        assertNotNull(ep.getServer());

        ep = getEndpointImplBean("simpleWithAddress", ctx);
        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());       

        ep = getEndpointImplBean("inlineImplementor", ctx);
        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());


        ep = getEndpointImplBean("inlineInvoker", ctx);
        assertTrue(ep.getInvoker() instanceof NullInvoker);
        assertTrue(ep.getService().getInvoker() instanceof NullInvoker);

        ep = getEndpointImplBean("simpleWithBindingUri", ctx);
        assertEquals("get the wrong bindingId",
                     ep.getBindingUri(),
                     "http://cxf.apache.org/bindings/xformat");
        assertEquals("get a wrong transportId",
                     "http://cxf.apache.org/transports/local", ep.getTransportId());

        ep = getEndpointImplBean("simpleWithBinding", ctx);
        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());

        ep = getEndpointImplBean("implementorClass", ctx);
        assertEquals(Hello.class, ep.getImplementorClass());
        assertTrue(ep.getImplementor().getClass() == Object.class);

        ep = getEndpointImplBean("epWithProps", ctx);
        assertEquals("bar", ep.getProperties().get("foo"));

        ep = getEndpointImplBean("classImpl", ctx);
        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());

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

        ep = getEndpointImplBean("publishedEndpointUrl", ctx);
        String expectedEndpointUrl = "http://cxf.apache.org/Greeter";
        assertEquals(expectedEndpointUrl, ep.getPublishedEndpointUrl());
       
        ep = getEndpointImplBean("epWithDataBinding", ctx);
        DataBinding dataBinding = ep.getDataBinding();
       
        assertTrue(dataBinding instanceof JAXBDataBinding);
        assertEquals("The namespace map should have an entry",
                     ((JAXBDataBinding)dataBinding).getNamespaceMap().size(), 1);
        // test for existence of Endpoint without an id element
        boolean found = false;
        String[] names = ctx.getBeanNamesForType(EndpointImpl.class);
        for (String n : names) {
            if (n.startsWith(EndpointImpl.class.getPackage().getName())) {
                found = true;
            }
        }
        assertTrue("Could not find server factory with autogenerated id", found);

        ep = getEndpointImplBean("unpublishedEndpoint", ctx);
        assertFalse("Unpublished endpoint is published", ep.isPublished());

        testInterceptors(ctx);
    }
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<? extends Message>> inInterceptors = ep.getInInterceptors();
        boolean saaj = false;
        boolean logging = false;
        for (Interceptor<? extends Message> 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

        ClassPathXmlApplicationContext ctx = null;
        Bus cxf1 = null;
        Bus cxf2 = null;
        try {
            ctx = new ClassPathXmlApplicationContext("/org/apache/cxf/jaxws/spring/endpoints2.xml");
            EndpointImpl ep1 = (EndpointImpl) ctx.getBean("ep1");
            assertNotNull(ep1);
            cxf1 = (Bus) ctx.getBean("cxf1");
            assertNotNull(cxf1);
            assertEquals(cxf1, ep1.getBus());
            assertEquals("barf", ep1.getBus().getProperty("foo"));           

            EndpointImpl ep2 = (EndpointImpl) ctx.getBean("ep2");
            assertNotNull(ep2);
            cxf2 = (Bus) ctx.getBean("cxf2");
            assertNotNull(cxf2);
            assertEquals(cxf2, ep2.getBus());
            assertEquals("snarf", ep2.getBus().getProperty("foo"));           

        } finally {
            if (cxf1 != null) {
                cxf1.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.