Java Code Examples for javax.xml.ws.Endpoint

The following examples show how to use javax.xml.ws.Endpoint. These examples are extracted from open source projects. 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 Project: cxf   Source File: StaxServer.java    License: Apache License 2.0 7 votes vote down vote up
private void doPublish(String url, Object obj) {
    Endpoint ep = Endpoint.create(obj);
    ep.getProperties().put(SecurityConstants.ENABLE_STREAMING_SECURITY, "true");
    ep.getProperties().put(SecurityConstants.CALLBACK_HANDLER + ".sct", new KeystorePasswordCallback());
    ep.getProperties().put(SecurityConstants.ENCRYPT_PROPERTIES + ".sct",
            "bob.properties");

    if (url.contains("X10_I")) {
        ep.getProperties().put(SecurityConstants.SIGNATURE_PROPERTIES + ".sct",
                "bob.properties");
        ep.getProperties().put(SecurityConstants.ENCRYPT_PROPERTIES + ".sct",
                "alice.properties");
    } else if (url.contains("MutualCert")) {
        ep.getProperties().put(SecurityConstants.ENCRYPT_PROPERTIES + ".sct",
            "bob.properties");
        ep.getProperties().put(SecurityConstants.SIGNATURE_PROPERTIES + ".sct",
            "alice.properties");
        ep.getProperties().put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
    } else if (url.contains("UserNameOverTransport")) {
        ep.getProperties().put(SecurityConstants.CALLBACK_HANDLER + ".sct", new UTPasswordCallback());
    }
    ep.publish(url);
}
 
Example 2
Source Project: cxf   Source File: AbstractColocTest.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Setup this test case
 */
@Before
public void setUp() throws Exception {
    // initialize Mule Manager
    URL cxfConfig = null;
    if (getCxfConfig() != null) {
        cxfConfig = ClassLoaderUtils.getResource(getCxfConfig(), AbstractColocTest.class);
        if (cxfConfig == null) {
            throw new Exception("Make sure " + getCxfConfig() + " is in the CLASSPATH");
        }
        assertNotNull(cxfConfig.toExternalForm());
    }

    //Bus is shared by client, router and server.
    SpringBusFactory bf = new SpringBusFactory();
    bus = bf.createBus(cxfConfig);
    BusFactory.setDefaultBus(bus);

    //Start the Remote Server
    // the endpoint of the "real" cxf server
    endpoint = Endpoint.publish(getTransportURI(), getServiceImpl());
}
 
Example 3
Source Project: cxf   Source File: WSNHelper.java    License: Apache License 2.0 6 votes vote down vote up
public Endpoint publish(String address, Object o, Class<?> ... extraClasses) {
    if (extraClasses != null && extraClasses.length > 0) {
        throw new UnsupportedOperationException("Pure JAX-WS does not support the extraClasses");
    }
    Endpoint endpoint = Endpoint.create(o);
    URL wsdlLocation = WSNWSDLLocator.getWSDLUrl();
    if (wsdlLocation != null) {
        try {
            if (endpoint.getProperties() == null) {
                endpoint.setProperties(new HashMap<String, Object>());
            }
            endpoint.getProperties().put("javax.xml.ws.wsdl.description", wsdlLocation.toExternalForm());
            List<Source> mt = new ArrayList<>();
            StreamSource src = new StreamSource(wsdlLocation.openStream(), wsdlLocation.toExternalForm());
            mt.add(src);
            endpoint.setMetadata(mt);
        } catch (IOException e) {
            //ignore, no wsdl really needed
        }
    }

    endpoint.publish(address);
    return endpoint;
}
 
Example 4
Source Project: cxf   Source File: ClientServerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testProxy() throws Exception {
    InvocationHandler handler = new InvocationHandler() {

        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            return null;
        }

    };
    Object implementor4 = Proxy.newProxyInstance(this.getClass().getClassLoader(),
                                                 new Class<?>[] {DocLitWrappedCodeFirstService.class},
                                                 handler);
    Endpoint.publish("http://localhost:" + PUB_PORT + "/DocLitWrappedCodeFirstService/", implementor4);
    URL url = new URL("http://localhost:" + PUB_PORT + "/DocLitWrappedCodeFirstService/?wsdl");
    InputStream ins = url.openStream();
    ins.close();
}
 
Example 5
Source Project: cxf   Source File: RobustServiceAtMostOnceTest.java    License: Apache License 2.0 6 votes vote down vote up
protected void run() {
    SpringBusFactory bf = new SpringBusFactory();
    // use a at-most-once server with sync ack processing
    Bus bus = bf.createBus("/org/apache/cxf/systest/ws/rm/atmostonce.xml");
    BusFactory.setDefaultBus(bus);
    setBus(bus);
    bus.getExtension(RMManager.class).getConfiguration().setAcknowledgementInterval(Long.valueOf(0));

    // add some intentional processing delay at inbound
    SlowProcessingSimulator sps = new SlowProcessingSimulator();
    sps.setAction("http://cxf.apache.org/greeter_control/Greeter/greetMeOneWayRequest");
    sps.setDelay(10000L);
    bus.getInInterceptors().add(sps);
    serverGreeter = new GreeterCounterImpl();
    String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort";

    // publish this robust oneway endpoint
    ep = Endpoint.create(serverGreeter);
    ep.getProperties().put(Message.ROBUST_ONEWAY, Boolean.TRUE);
    ep.publish(address);
    LOG.info("Published greeter endpoint.");
}
 
Example 6
Source Project: cxf   Source File: AddressingAnonymousPolicyTest.java    License: Apache License 2.0 6 votes vote down vote up
protected void run()  {

            System.setProperty("server.temp.location", tmpDir);
            SpringBusFactory bf = new SpringBusFactory();
            Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/addr-anon-server.xml");
            setBus(bus);
            BusFactory.setDefaultBus(bus);
            LoggingInInterceptor in = new LoggingInInterceptor();
            bus.getInInterceptors().add(in);
            bus.getInFaultInterceptors().add(in);
            LoggingOutInterceptor out = new LoggingOutInterceptor();
            bus.getOutInterceptors().add(out);
            bus.getOutFaultInterceptors().add(out);

            GreeterImpl implementor = new GreeterImpl();
            String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort";
            ep = Endpoint.publish(address, implementor);
            LOG.info("Published greeter endpoint.");
        }
 
Example 7
Source Project: cxf   Source File: DecoupledClientServerTest.java    License: Apache License 2.0 6 votes vote down vote up
protected void run()  {
    SpringBusFactory bf = new SpringBusFactory();
    Bus bus = bf.createBus("/org/apache/cxf/systest/ws/rm/decoupled.xml");
    BusFactory.setDefaultBus(bus);
    setBus(bus);
    LoggingInInterceptor in = new LoggingInInterceptor();
    bus.getInInterceptors().add(in);
    bus.getInFaultInterceptors().add(in);
    LoggingOutInterceptor out = new LoggingOutInterceptor();
    bus.getOutInterceptors().add(out);
    bus.getOutFaultInterceptors().add(out);

    GreeterImpl implementor = new GreeterImpl();
    implementor.useLastOnewayArg(true);
    implementor.setDelay(5000);
    String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort";

    ep = Endpoint.create(implementor);
    Map<String, Object> properties = new HashMap<>();
    properties.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);
    ep.setProperties(properties);
    ep.publish(address);

    LOG.info("Published greeter endpoint.");
}
 
Example 8
Source Project: cxf   Source File: EndpointAPITest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testMultipleEndpointsSameContext() throws Exception {
    server.start();
    String contextPath = "/ctxt";
    String path = "/echo";
    int k = 3;
    Endpoint[] endpoints = new Endpoint[k];
    HttpContext[] contexts = new HttpContext[k];
    String[] addresses = new String[k];
    for (int i = 0; i < k; i++) {
        addresses[i] = "http://localhost:" + currentPort + contextPath + path + i;
        contexts[i] = GrizzlyHttpContextFactory.createHttpContext(server,
                                                                  contextPath,
                                                                  path + i);
        endpoints[i] = Endpoint.create(new EndpointBean());
        endpoints[i].publish(contexts[i]);
    }
    for (int i = 0; i < k; i++) {
        invokeEndpoint(addresses[i]);
    }
    for (int i = 0; i < k; i++) {
        endpoints[i].stop();
    }
}
 
Example 9
Source Project: cxf   Source File: Server.java    License: Apache License 2.0 6 votes vote down vote up
protected void run()  {
    System.setProperty("org.apache.cxf.bus.factory", "org.apache.cxf.bus.CXFBusFactory");
    Object implementor = new PutLastTradedPriceImpl();
    String address = "http://localhost:" + PORT + "/SOAPDocLitBareService/SoapPort";
    ep = Endpoint.create(implementor);
    Map<String, Object> props = new HashMap<>(2);
    props.put(Endpoint.WSDL_SERVICE, new QName("http://apache.org/hello_world_doc_lit_bare",
                                               "SOAPService"));
    props.put(Endpoint.WSDL_PORT, new QName("http://apache.org/hello_world_doc_lit_bare", "SoapPort"));
    ep.setProperties(props);
    ep.publish(address);
    implementor = new BareSoapServiceImpl();
    address = "http://localhost:" + PORT + "/SOAPDocLitBareService/SoapPort1";
    ep = Endpoint.create(implementor);
    ep.publish(address);
}
 
Example 10
Source Project: cxf   Source File: AbstractClientPersistenceTest.java    License: Apache License 2.0 6 votes vote down vote up
protected void run() {
    SpringBusFactory bf = new SpringBusFactory();
    System.setProperty("db.name", pfx + "-server");
    Bus bus = bf.createBus("/org/apache/cxf/systest/ws/rm/persistent.xml");
    BusFactory.setDefaultBus(bus);
    setBus(bus);
    System.clearProperty("db.name");

    LoggingInInterceptor logIn = new LoggingInInterceptor();
    bus.getInInterceptors().add(logIn);
    LoggingOutInterceptor logOut = new LoggingOutInterceptor();
    bus.getOutFaultInterceptors().add(logOut);
    bus.getOutFaultInterceptors().add(logOut);

    bus.getExtension(RMManager.class).getConfiguration()
        .setBaseRetransmissionInterval(Long.valueOf(60000));

    GreeterImpl implementor = new GreeterImpl();
    String address = "http://localhost:" + port + "/SoapContext/GreeterPort";
    ep = Endpoint.create(implementor);
    Map<String, Object> properties = new HashMap<>();
    properties.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);
    ep.setProperties(properties);
    ep.publish(address);
    LOG.info("Published greeter endpoint.");
}
 
Example 11
Source Project: cxf   Source File: EndpointAPITest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testMultipleEndpointsDifferentContexts() throws Exception {
    server.start();
    String contextPath = "/ctxt";
    String path = "/echo";
    int k = 3;
    Endpoint[] endpoints = new Endpoint[k];
    HttpContext[] contexts = new HttpContext[k];
    String[] addresses = new String[k];
    for (int i = 0; i < k; i++) {
        addresses[i] = "http://localhost:" + currentPort + contextPath + i + path;
        contexts[i] = GrizzlyHttpContextFactory.createHttpContext(server,
                                                                  contextPath + i,
                                                                  path);
        endpoints[i] = Endpoint.create(new EndpointBean());
        endpoints[i].publish(contexts[i]);
    }
    for (int i = 0; i < k; i++) {
        invokeEndpoint(addresses[i]);
    }
    for (int i = 0; i < k; i++) {
        endpoints[i].stop();
    }
}
 
Example 12
Source Project: cxf   Source File: SSLNettyServerTest.java    License: Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void start() throws Exception {
    Bus b = createStaticBus("/org/apache/cxf/transport/http/netty/server/integration/ServerConfig.xml");
    // setup the ssl interceptor
    MySSLInterceptor myInterceptor = new MySSLInterceptor();
    b.getInInterceptors().add(myInterceptor);
    BusFactory.setThreadDefaultBus(b);

    address = "https://localhost:" + PORT + "/SoapContext/SoapPort";
    ep = Endpoint.publish(address,
            new org.apache.hello_world_soap_http.GreeterImpl());

    URL wsdl = NettyServerTest.class.getResource("/wsdl/hello_world.wsdl");
    assertNotNull("WSDL is null", wsdl);

    SOAPService service = new SOAPService(wsdl);
    assertNotNull("Service is null", service);

    g = service.getSoapPort();
    assertNotNull("Port is null", g);
}
 
Example 13
Source Project: cxf   Source File: CachedOutMessageTest.java    License: Apache License 2.0 6 votes vote down vote up
protected void run()  {
    SpringBusFactory bf = new SpringBusFactory();
    Bus bus = bf.createBus("/org/apache/cxf/systest/ws/rm/message-loss.xml");
    BusFactory.setDefaultBus(bus);
    setBus(bus);
    LoggingInInterceptor in = new LoggingInInterceptor();
    bus.getInInterceptors().add(in);
    bus.getInFaultInterceptors().add(in);
    LoggingOutInterceptor out = new LoggingOutInterceptor();
    bus.getOutInterceptors().add(out);
    bus.getOutFaultInterceptors().add(out);

    GreeterImpl implementor = new GreeterImpl();
    String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort";

    ep = Endpoint.create(implementor);
    ep.publish(address);

    LOG.info("Published greeter endpoint.");
}
 
Example 14
Source Project: openjdk-jdk8u   Source File: WSTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        // find a free port
        ServerSocket ss = new ServerSocket(0);
        int port = ss.getLocalPort();
        ss.close();

        Endpoint endPoint1 = null;
        Endpoint endPoint2 = null;
        try {
            endPoint1 = Endpoint.publish("http://0.0.0.0:" + port + "/method1",
                    new Method1());
            endPoint2 = Endpoint.publish("http://0.0.0.0:" + port + "/method2",
                    new Method2());

            System.out.println("Sleep 3 secs...");

            Thread.sleep(3000);
        } finally {
            stop(endPoint2);
            stop(endPoint1);
        }
    }
 
Example 15
Source Project: cxf   Source File: ServerXMLBinding.java    License: Apache License 2.0 6 votes vote down vote up
protected void run() {
    Object implementor = new GreeterImpl();
    String address = "http://localhost:" + REG_PORT + "/XMLService/XMLPort";
    eps.add(Endpoint.publish(address, implementor));

    Object implementor1 = new org.apache.hello_world_xml_http.wrapped.GreeterImpl();
    address = "http://localhost:" + WRAP_PORT + "/XMLService/XMLPort";
    eps.add(Endpoint.publish(address, implementor1));

    Object faultImplementor = new GreeterFaultImpl();
    String faultAddress = "http://localhost:" + REG_PORT + "/XMLService/XMLFaultPort";
    eps.add(Endpoint.publish(faultAddress, faultImplementor));

    Object implementor2 = new HeaderTesterImpl();
    address = "http://localhost:" + REG_PORT + "/XMLContext/XMLPort";
    eps.add(Endpoint.publish(address, implementor2));

    Object implementor3 = new org.apache.hello_world_xml_http.mixed.GreeterImpl();
    address = "http://localhost:" + MIX_PORT + "/XMLService/XMLPort";
    eps.add(Endpoint.publish(address, implementor3));
}
 
Example 16
Source Project: neoscada   Source File: EndpointExporter.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void dispose ()
{
    super.dispose ();

    List<Endpoint> endpoints;
    synchronized ( this )
    {
        endpoints = new ArrayList<Endpoint> ( this.endpoints.values () );
        this.endpoints.clear ();
    }

    for ( final Endpoint e : endpoints )
    {
        e.stop ();
    }
}
 
Example 17
Source Project: cxf   Source File: ClientServiceConfigTest.java    License: Apache License 2.0 6 votes vote down vote up
@Before
public void before() throws Exception {
    super.setUp();

    ReflectionServiceFactoryBean factory = new ReflectionServiceFactoryBean();
    factory.setInvoker(new BeanInvoker(new EchoImpl()));
    factory.setDataBinding(new AegisDatabinding());

    ServerFactoryBean svrFac = new ServerFactoryBean();
    svrFac.setAddress("local://Echo");
    svrFac.setServiceFactory(factory);
    svrFac.setServiceClass(Echo.class);
    svrFac.setBus(getBus());
    svrFac.create();

    Endpoint endpoint = Endpoint.create(new EchoImpl());
    impl = (EndpointImpl) endpoint;
    impl.setDataBinding(new AegisDatabinding());
    endpoint.publish("local://JaxWsEcho");
}
 
Example 18
Source Project: jdk8u-jdk   Source File: WSTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        // find a free port
        ServerSocket ss = new ServerSocket(0);
        int port = ss.getLocalPort();
        ss.close();

        Endpoint endPoint1 = null;
        Endpoint endPoint2 = null;
        try {
            endPoint1 = Endpoint.publish("http://0.0.0.0:" + port + "/method1",
                    new Method1());
            endPoint2 = Endpoint.publish("http://0.0.0.0:" + port + "/method2",
                    new Method2());

            System.out.println("Sleep 3 secs...");

            Thread.sleep(3000);
        } finally {
            stop(endPoint2);
            stop(endPoint1);
        }
    }
 
Example 19
Source Project: cxf   Source File: DispatchClientServerTest.java    License: Apache License 2.0 6 votes vote down vote up
protected void run() {
    setBus(BusFactory.getDefaultBus());
    Object implementor = new GreeterImpl();
    String address = "http://localhost:"
        + TestUtil.getPortNumber(DispatchClientServerTest.class)
        + "/SOAPDispatchService/SoapDispatchPort";
    ep = Endpoint.create(SOAPBinding.SOAP11HTTP_BINDING, implementor);
    Map<String, Object> properties = new HashMap<>();
    Map<String, String> nsMap = new HashMap<>();
    nsMap.put("gmns", "http://apache.org/hello_world_soap_http/types");
    properties.put("soap.env.ns.map", nsMap);
    properties.put("disable.outputstream.optimization", "true");

    ep.setProperties(properties);
    ep.publish(address);
    BusFactory.setDefaultBus(null);
    BusFactory.setThreadDefaultBus(null);
}
 
Example 20
Source Project: cxf   Source File: ExtSoapHeaderClientServerTest.java    License: Apache License 2.0 6 votes vote down vote up
protected void run() {
    String address0 = "http://localhost:" + PORT0 + "/SoapExtHeader/SampleService";

    Object implementor1 = new SamplePortTypeImpl();
    Endpoint.publish(address0, implementor1);

    String address1 = "http://localhost:" + PORT1 + "/SoapExtHeader/SampleService";
    JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
    sf.setServiceClass(SamplePortTypeImpl.class);

    WebServiceClient webService = SampleService.class.getAnnotation(WebServiceClient.class);
    sf.setServiceName(new QName(webService.targetNamespace(), webService.name()));
    sf.setWsdlLocation(webService.wsdlLocation());
    sf.setAddress(address1);

    extserver = sf.create();
}
 
Example 21
Source Project: cxf   Source File: AddressingPolicyTest.java    License: Apache License 2.0 6 votes vote down vote up
protected void run()  {

            System.setProperty("temp.location", tmpDir);
            SpringBusFactory bf = new SpringBusFactory();
            Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/addr.xml");
            BusFactory.setDefaultBus(bus);
            setBus(bus);
            LoggingInInterceptor in = new LoggingInInterceptor();
            bus.getInInterceptors().add(in);
            bus.getInFaultInterceptors().add(in);
            LoggingOutInterceptor out = new LoggingOutInterceptor();
            bus.getOutInterceptors().add(out);
            bus.getOutFaultInterceptors().add(out);

            GreeterImpl implementor = new GreeterImpl();
            String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort";
            ep = Endpoint.publish(address, implementor);
            LOG.info("Published greeter endpoint.");
        }
 
Example 22
Source Project: openjdk-jdk8u-backup   Source File: WSTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        // find a free port
        ServerSocket ss = new ServerSocket(0);
        int port = ss.getLocalPort();
        ss.close();

        Endpoint endPoint1 = null;
        Endpoint endPoint2 = null;
        try {
            endPoint1 = Endpoint.publish("http://0.0.0.0:" + port + "/method1",
                    new Method1());
            endPoint2 = Endpoint.publish("http://0.0.0.0:" + port + "/method2",
                    new Method2());

            System.out.println("Sleep 3 secs...");

            Thread.sleep(3000);
        } finally {
            stop(endPoint2);
            stop(endPoint1);
        }
    }
 
Example 23
@Bean
public Endpoint sonosEndpoint(Bus bus, SonosService sonosService,
        SonosFaultInterceptor sonosFaultInterceptor,
        SonosLinkSecurityInterceptor sonosSecurity) {
    EndpointImpl endpoint = new EndpointImpl(bus, sonosService);
    endpoint.setOutFaultInterceptors(Collections.singletonList(sonosFaultInterceptor));
    endpoint.setInInterceptors(Collections.singletonList(sonosSecurity));
    endpoint.publish("/Sonos");
    return endpoint;
}
 
Example 24
Source Project: cxf   Source File: ClientServerWrappedContinuationTest.java    License: Apache License 2.0 5 votes vote down vote up
protected void run() {
    SpringBusFactory bf = new SpringBusFactory();
    Bus bus = bf.createBus(SERVER_CONFIG_FILE);
    setBus(bus);
    BusFactory.setDefaultBus(bus);

    Object implementor = new HelloImplWithWrapppedContinuation();
    String address = "http://localhost:" + PORT + "/hellocontinuation";
    Endpoint.publish(address, implementor);
    address = "https://localhost:" + HTTPS_PORT + "/securecontinuation";
    Endpoint.publish(address, implementor);
}
 
Example 25
/**
 * Build the HttpContext for the given endpoint.
 * @param endpoint the JAX-WS Provider Endpoint object
 * @param serviceName the given service name
 * @return the fully populated HttpContext
 */
protected HttpContext buildHttpContext(Endpoint endpoint, String serviceName) {
	Assert.state(this.server != null, "No HttpServer available");
	String fullPath = calculateEndpointPath(endpoint, serviceName);
	HttpContext httpContext = this.server.createContext(fullPath);
	if (this.filters != null) {
		httpContext.getFilters().addAll(this.filters);
	}
	if (this.authenticator != null) {
		httpContext.setAuthenticator(this.authenticator);
	}
	return httpContext;
}
 
Example 26
/**
 * Publish all {@link javax.jws.WebService} annotated beans in the
 * containing BeanFactory.
 * @see #publishEndpoint
 */
public void publishEndpoints() {
	Assert.state(this.beanFactory != null, "No BeanFactory set");

	Set<String> beanNames = new LinkedHashSet<>(this.beanFactory.getBeanDefinitionCount());
	Collections.addAll(beanNames, this.beanFactory.getBeanDefinitionNames());
	if (this.beanFactory instanceof ConfigurableBeanFactory) {
		Collections.addAll(beanNames, ((ConfigurableBeanFactory) this.beanFactory).getSingletonNames());
	}

	for (String beanName : beanNames) {
		try {
			Class<?> type = this.beanFactory.getType(beanName);
			if (type != null && !type.isInterface()) {
				WebService wsAnnotation = type.getAnnotation(WebService.class);
				WebServiceProvider wsProviderAnnotation = type.getAnnotation(WebServiceProvider.class);
				if (wsAnnotation != null || wsProviderAnnotation != null) {
					Endpoint endpoint = createEndpoint(this.beanFactory.getBean(beanName));
					if (this.endpointProperties != null) {
						endpoint.setProperties(this.endpointProperties);
					}
					if (this.executor != null) {
						endpoint.setExecutor(this.executor);
					}
					if (wsAnnotation != null) {
						publishEndpoint(endpoint, wsAnnotation);
					}
					else {
						publishEndpoint(endpoint, wsProviderAnnotation);
					}
					this.publishedEndpoints.add(endpoint);
				}
			}
		}
		catch (CannotLoadBeanClassException ex) {
			// ignore beans where the class is not resolvable
		}
	}
}
 
Example 27
Source Project: cxf   Source File: ServerTimeout.java    License: Apache License 2.0 5 votes vote down vote up
protected void run()  {
    System.setProperty("com.sun.CORBA.POA.ORBServerId", "1");
    System.setProperty("com.sun.CORBA.POA.ORBPersistentServerPort", PERSIST_PORT);
    setBus(new SpringBusFactory().createBus("org/apache/cxf/systest/corba/hello_world_server.xml"));
    Object implementor = new BaseGreeterTimeoutImpl();
    String address = "file:./HelloWorldTimeout.ref";
    Endpoint.publish(address, implementor);
}
 
Example 28
Source Project: cxf   Source File: Server.java    License: Apache License 2.0 5 votes vote down vote up
protected void run() {
    Object implementor = new SayHiImpl();
    String address = "http://localhost:" + PORT + "/schemaimport/sayHi";
    Endpoint.publish(address, implementor);
    Object implementor2 = new TestEndpointImpl();
    String address2 = "http://localhost:" + PORT + "/schemaimport/service";
    Endpoint.publish(address2, implementor2);
    Object implementor3 = new ServiceImpl();
    String address3 = "http://localhost:" + PORT + "/schemainclude/service";
    Endpoint.publish(address3, implementor3);
    Object implementor4 = new SayHiImpl2();
    String address4 = "http://localhost:" + PORT + "/schemaimport/sayHi2";
    Endpoint.publish(address4, implementor4);
}
 
Example 29
Source Project: cxf   Source File: ProviderImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Endpoint createEndpoint(String bindingId, Object implementor) {

    Endpoint ep = null;
    if (EndpointUtils.isValidImplementor(implementor)) {
        Bus bus = BusFactory.getThreadDefaultBus();
        ep = createEndpointImpl(bus, bindingId, implementor);
        return ep;
    }
    throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString());
}
 
Example 30
Source Project: cxf   Source File: CodeFirstWSDLTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testDocumentationOnSEI() throws Exception {
    //CXF-3093
    EndpointImpl ep = (EndpointImpl)Endpoint.publish("local://foo", new CXF3093Impl());
    ServiceWSDLBuilder wsdlBuilder =
        new ServiceWSDLBuilder(bus, ep.getService().getServiceInfos().get(0));
    Definition def = wsdlBuilder.build();
    Document d = bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter().getDocument(def);
    //org.apache.cxf.helpers.XMLUtils.printDOM(d);
    assertXPathEquals("//wsdl:definitions/wsdl:documentation", "My top level documentation",
                      d.getDocumentElement());
    assertXPathEquals("//wsdl:definitions/wsdl:portType/wsdl:documentation", "My portType documentation",
                      d.getDocumentElement());
    assertXPathEquals("//wsdl:definitions/wsdl:binding/wsdl:documentation", "My binding doc",
                      d.getDocumentElement());


    JaxwsServiceBuilder builder = new JaxwsServiceBuilder();
    builder.setServiceClass(CXF3093Impl.class);
    ServiceInfo serviceInfo = builder.createService();
    wsdlBuilder = new ServiceWSDLBuilder(bus, serviceInfo);

    def = wsdlBuilder.build();
    d = bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter().getDocument(def);
    //org.apache.cxf.helpers.XMLUtils.printDOM(d);
    assertXPathEquals("//wsdl:definitions/wsdl:documentation", "My top level documentation",
                      d.getDocumentElement());
    assertXPathEquals("//wsdl:definitions/wsdl:portType/wsdl:documentation", "My portType documentation",
                      d.getDocumentElement());
    assertXPathEquals("//wsdl:definitions/wsdl:binding/wsdl:documentation", "My binding doc",
                      d.getDocumentElement());
}