Java Code Examples for javax.xml.ws.Endpoint

The following are top voted examples for showing how to use javax.xml.ws.Endpoint. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: spring4-understanding   File: AbstractJaxWsServiceExporter.java   View source code 7 votes vote down vote up
/**
 * Create the actual Endpoint instance.
 * @param bean the service object to wrap
 * @return the Endpoint instance
 * @see Endpoint#create(Object)
 * @see Endpoint#create(String, Object)
 */
@UsesJava7  // optional use of Endpoint#create with WebServiceFeature[]
protected Endpoint createEndpoint(Object bean) {
	if (this.endpointFeatures != null || this.webServiceFeatures != null) {
		WebServiceFeature[] endpointFeaturesToUse = this.endpointFeatures;
		if (endpointFeaturesToUse == null) {
			endpointFeaturesToUse = new WebServiceFeature[this.webServiceFeatures.length];
			for (int i = 0; i < this.webServiceFeatures.length; i++) {
				endpointFeaturesToUse[i] = convertWebServiceFeature(this.webServiceFeatures[i]);
			}
		}
		return Endpoint.create(this.bindingType, bean, endpointFeaturesToUse);
	}
	else {
		return Endpoint.create(this.bindingType, bean);
	}
}
 
Example 2
Project: dss-demonstrations   File: CXFConfig.java   View source code 6 votes vote down vote up
@Bean
public Endpoint createSoapSignatureEndpoint() {
	EndpointImpl endpoint = new EndpointImpl(bus, soapDocumentSignatureService());
	endpoint.publish(SOAP_SIGNATURE_ONE_DOCUMENT);
	enableMTOM(endpoint);
	return endpoint;
}
 
Example 3
Project: neoscada   File: EndpointExporter.java   View source code 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 4
Project: neoscada   File: EndpointExporter.java   View source code 6 votes vote down vote up
@Override
protected void unexportService ( final ServiceReference<?> serviceReference )
{
    final Endpoint e;
    synchronized ( this )
    {
        e = this.endpoints.remove ( serviceReference );
    }

    if ( e != null )
    {
        if ( e.isPublished () )
        {
            try
            {
                e.stop ();
            }
            catch ( final Exception ex )
            {
                logger.warn ( "Failed to stop export", ex );
            }
        }
    }
}
 
Example 5
Project: lams   File: AbstractJaxWsServiceExporter.java   View source code 6 votes vote down vote up
/**
 * Create the actual Endpoint instance.
 * @param bean the service object to wrap
 * @return the Endpoint instance
 * @see Endpoint#create(Object)
 * @see Endpoint#create(String, Object)
 */
protected Endpoint createEndpoint(Object bean) {
	if (this.endpointFeatures != null || this.webServiceFeatures != null) {
		WebServiceFeature[] endpointFeaturesToUse = this.endpointFeatures;
		if (endpointFeaturesToUse == null) {
			endpointFeaturesToUse = new WebServiceFeature[this.webServiceFeatures.length];
			for (int i = 0; i < this.webServiceFeatures.length; i++) {
				endpointFeaturesToUse[i] = convertWebServiceFeature(this.webServiceFeatures[i]);
			}
		}
		return Endpoint.create(this.bindingType, bean, endpointFeaturesToUse);
	}
	else {
		return Endpoint.create(this.bindingType, bean);
	}
}
 
Example 6
Project: jdk8u-jdk   File: WSTest.java   View source code 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 7
Project: openjdk-jdk10   File: WSTest.java   View source code 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 8
Project: book_ldrtc   File: CxfServer.java   View source code 6 votes vote down vote up
public static void main(String[] args) {  
//        HelloWorldImpl implementor = new HelloWorldImpl();  
//        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();  
//        // 除了http://localhost部分其他部分可以随便写,但格式不能乱 http://IP:PORT/NAME  
//        factory.setAddress("http://localhost:8080/ws/hello");  
//        factory.setServiceClass(HelloWorld.class);//可省,但不建议,因为可能会有些小问题  
//        factory.setServiceBean(implementor);  
////        //LoggingInInterceptor和LoggingOutInterceptor是日志拦截器,用于输入和输出时显示日志  
//        factory.getInInterceptors().add(new LoggingInInterceptor());  
//        factory.getOutInterceptors().add(new LoggingOutInterceptor());  
//        factory.create();  
//        System.out.println("ws is published");  
        
        
        HelloWorld hw = new HelloWorldImpl();  
        Endpoint.publish(ADDRESS, hw);  
    }
 
Example 9
Project: openjdk9   File: WSTest.java   View source code 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 10
Project: jdk8u_jdk   File: WSTest.java   View source code 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 11
Project: datex2   File: Datex2.java   View source code 6 votes vote down vote up
public Datex2Supplier createSupplier(String supplierPath,
		String subscriptionPath) {

	if (subscriptionPath != null) {
		ClientSubscriptionImpl subscription = new ClientSubscriptionImpl(
				supplierPath, subscriptionPath);
		autowire(subscription);
		Endpoint.publish(subscriptionPath, subscription);
	}

	Datex2SupplierImpl supplier = new Datex2SupplierImpl(supplierPath,
			subscriptionPath);
	autowire(supplier);

	ClientPullImpl pull = new ClientPullImpl(supplier);
	autowire(pull);
	Endpoint.publish(supplierPath, pull);

	return supplier;
}
 
Example 12
Project: myjavacode   File: LeaveWebserviceUtil.java   View source code 6 votes vote down vote up
/**
 * 发布Webservice
 */
public static void startServer() {
    if (server != null) {
        System.out.println("WebService服务正在运行。。。");
        return;
    }
    LeaveWebService leaveWebService = new LeaveWebServiceImpl();
    /*JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
    svrFactory.setServiceClass(LeaveWebService.class);
    svrFactory.setAddress(WEBSERVICE_URL);
    svrFactory.setServiceBean(leaveWebService);
    svrFactory.getInInterceptors().add(new LoggingInInterceptor());
    svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
    server = svrFactory.create();
    server.start();*/
    Endpoint.publish(WEBSERVICE_URL, leaveWebService);
    System.out.println("请假Webservice已发布:" + WEBSERVICE_URL + "?wsdl");
}
 
Example 13
Project: activiti-in-action-codes   File: LeaveWebserviceUtil.java   View source code 6 votes vote down vote up
/**
 * 发布Webservice
 */
public static void startServer() {
    if (server != null) {
        System.out.println("WebService服务正在运行。。。");
        return;
    }
    LeaveWebService leaveWebService = new LeaveWebServiceImpl();
    /*JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
    svrFactory.setServiceClass(LeaveWebService.class);
    svrFactory.setAddress(WEBSERVICE_URL);
    svrFactory.setServiceBean(leaveWebService);
    svrFactory.getInInterceptors().add(new LoggingInInterceptor());
    svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
    server = svrFactory.create();
    server.start();*/
    Endpoint.publish(WEBSERVICE_URL, leaveWebService);
    System.out.println("请假Webservice已发布:" + WEBSERVICE_URL + "?wsdl");
}
 
Example 14
Project: jaxws-undertow-httpspi   File: EndpointAPITest.java   View source code 6 votes vote down vote up
@Test
public void testMultiplePublishSameAddress() throws Exception
{
   server.start();
   String contextPath = "/ctxt";
   String path = "/echo";
   for (int i = 0; i < 3; i++)
   {
      HttpContext ctx = UndertowContextFactory.createHttpContext(server, contextPath, path);
      String address = "http://localhost:" + currentPort + contextPath + path;

      Endpoint endpoint = Endpoint.create(new EndpointBean());
      endpoint.publish(ctx); // Use httpserver context for publishing

      invokeEndpoint(address);

      endpoint.stop();
   }
}
 
Example 15
Project: jaxws-undertow-httpspi   File: EndpointAPITest.java   View source code 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] = UndertowContextFactory.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 16
Project: jaxws-undertow-httpspi   File: EndpointAPITest.java   View source code 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] = UndertowContextFactory.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 17
Project: db-component   File: Dispatcher.java   View source code 6 votes vote down vote up
public static void main(String[] argv) throws IOException {
	try {
		ConnectionsReader connReader = new ConnectionsReader();
		QueriesReader queriesReader = new QueriesReader();
		SettingsReader settingsReader = new SettingsReader();
		HashMap<String, Object> config;
		logs = new LogHandler();

		config = settingsReader.readSettings(new File("").getAbsolutePath() +
				File.separator + "config" + File.separator + "settings.xml", logs);
		connections = connReader.readSettings(new File("").getAbsolutePath() +
				File.separator + "config" + File.separator + "connections.xml", logs);
		connections = queriesReader.readQueries(new File("").getAbsolutePath() +
				File.separator + "config" + File.separator + "queries.xml", connections, logs);

		Dispatcher implementor = new Dispatcher();
		String address = "http://" + config.get("ip") + ":" + config.get("port") + "/" + config.get("name");
		System.out.println("Server wsdl can be found on http://localhost:" + config.get("port") + "/" + config.get("name"));

		Endpoint.publish(address, implementor);
	} catch (Exception e) {
		e.printStackTrace();
		logs.write(Level.SEVERE, e.getMessage());
	}
}
 
Example 18
Project: respiro   File: CxfPlugin.java   View source code 6 votes vote down vote up
private void configureEndpoint(EndpointConfig config, Endpoint endpoint) {
    Map<String, Object> props = endpoint.getProperties();

    // Basic config
    if(config.getWsdlService() != null) {
        props.put(Endpoint.WSDL_SERVICE, config.getWsdlService());
    }

    if(config.getWsdlPort() != null) {
        props.put(Endpoint.WSDL_PORT, config.getWsdlPort());
    }

    // setup schema validation
    props.put(Message.SCHEMA_VALIDATION_ENABLED, SchemaValidation.SchemaValidationType.valueOf(schemaValidation.toUpperCase()));


    for (EndpointCustomizer customizer : endpointCustomizers) {
        customizer.configureEndpoint(endpoint);
    }
}
 
Example 19
Project: jbossws-cxf   File: CXFEndpointServlet.java   View source code 6 votes vote down vote up
@Override
public void loadBus(ServletConfig servletConfig)
{
   super.loadBus(servletConfig);

   // You could add the endpoint publish codes here
   try {
      //be sure to use the bus that's been created in loadBus..
      Bus bus = getBus();
      BusFactory.setThreadDefaultBus(bus);
      Endpoint.publish("/Echo1", new EchoImpl());
   } finally {
      //free the thread default bus association in the current thread which
      //is serving the servlet init, as it can have side effect on other
      //servlet(s) deployed afterwards
      BusFactory.setThreadDefaultBus(null);
   }
}
 
Example 20
Project: jbossws-cxf   File: EndpointTestCase.java   View source code 6 votes vote down vote up
@Test
@RunAsClient
public void test() throws Exception
{
   String publishURL1 = "http://" + getServerHost() + ":" + port + "/jaxws-endpoint1";
   Endpoint endpoint1 = publishEndpoint(new EndpointBean(), publishURL1);

   String publishURL2 = "http://" + getServerHost() + ":" + port + "/jaxws-endpoint2";
   Endpoint endpoint2 = publishEndpoint(new EndpointBean(), publishURL2);

   invokeEndpoint(publishURL1);
   invokeEndpoint(publishURL2);

   endpoint1.stop();
   endpoint2.stop();
}
 
Example 21
Project: jbossws-cxf   File: WSClientEndpointBean.java   View source code 6 votes vote down vote up
public String echo(String input, String serverHost, int port)
{
   Endpoint ep = Endpoint.create(new EndpointBean());
   String publishUrl = "http://" + serverHost + ":" + port + "/foo/bar";
   ep.publish(publishUrl);

   try
   {
      QName qname = new QName("http://org.jboss.ws/jaxws/endpoint", "EndpointService");
      Service service = Service.create(new URL(publishUrl + "?wsdl"), qname);
      EndpointInterface proxy = (EndpointInterface) service.getPort(EndpointInterface.class);
      return proxy.echo(input);
   }
   catch (Exception e)
   {
      throw new WebServiceException(e);
   }
   finally
   {
      if (ep != null)
      {
         ep.stop();
      }
   }
}
 
Example 22
Project: jbossws-cxf   File: UsecasesTestCase.java   View source code 6 votes vote down vote up
@Test
@RunAsClient
public void testDifferentPortsSameContext() throws Exception
{
   String publishURL1 = "http://" + getServerHost() + ":" + port1 + "/jaxws-endpoint/";
   Endpoint endpoint1 = publishEndpoint1(new Endpoint1Impl(), publishURL1);

   String publishURL2 = "http://" + getServerHost() + ":" + port2 + "/jaxws-endpoint";
   Endpoint endpoint2 = publishEndpoint2(new Endpoint1Impl(), publishURL2);

   invokeEndpoint1(publishURL1);
   invokeEndpoint1(publishURL2);

   endpoint1.stop();
   endpoint2.stop();
}
 
Example 23
Project: jbossws-cxf   File: UsecasesTestCase.java   View source code 6 votes vote down vote up
@Test
@RunAsClient
public void testDifferentPortsNoContext() throws Exception
{
   String publishURL1 = "http://" + getServerHost() + ":" + port1 + "/";
   Endpoint endpoint1 = publishEndpoint1(new Endpoint1Impl(), publishURL1);

   String publishURL2 = "http://" + getServerHost() + ":" + port2;
   Endpoint endpoint2 = publishEndpoint2(new Endpoint1Impl(), publishURL2);

   invokeEndpoint1(publishURL1);
   if (isIntegrationCXF())
   {
      //sun.net.www.protocol.http.HttpURLConnection barfs on addresses like http://localhost:8872?wsdl
      invokeEndpoint1(publishURL2.replace(String.valueOf(port2), port2 + "/"));
   }
   else
   {
      invokeEndpoint1(publishURL2);
   }

   endpoint1.stop();
   endpoint2.stop();
}
 
Example 24
Project: jbossws-cxf   File: UsecasesTestCase.java   View source code 6 votes vote down vote up
@Test
@RunAsClient
public void testDifferentPortsAndLongPaths() throws Exception
{
   String publishURL1 = "http://" + getServerHost() + ":" + port1 + "/jaxws-endpoint/endpoint/long/path/";
   Endpoint endpoint1 = publishEndpoint3(new Endpoint1Impl(), publishURL1);

   String publishURL2 = "http://" + getServerHost() + ":" + port2 + "/jaxws-endpoint/endpoint/long/path";
   Endpoint endpoint2 = publishEndpoint1(new Endpoint1Impl(), publishURL2);

   invokeEndpoint1(publishURL1);
   invokeEndpoint1(publishURL2);

   endpoint1.stop();
   endpoint2.stop();
}
 
Example 25
Project: jbossws-cxf   File: UsecasesTestCase.java   View source code 6 votes vote down vote up
@Test
@RunAsClient
public void testSamePortsAndAlmostIdenticalLongPaths() throws Exception
{
   String publishURL1 = "http://" + getServerHost() + ":" + port1 + "/jaxws-endpoint/endpoint/number1/";
   Endpoint endpoint1 = publishEndpoint2(new Endpoint1Impl(), publishURL1);

   String publishURL2 = "http://" + getServerHost() + ":" + port1 + "/jaxws-endpoint/endpoint/number11";
   Endpoint endpoint2 = publishEndpoint3(new Endpoint1Impl(), publishURL2);

   invokeEndpoint2(publishURL1);
   invokeEndpoint2(publishURL2);

   endpoint1.stop();
   endpoint2.stop();
}
 
Example 26
Project: jbossws-cxf   File: UsecasesTestCase.java   View source code 6 votes vote down vote up
@Test
@RunAsClient
public void testDifferentPortsAndIdenticalPaths() throws Exception
{
   String publishURL1 = "http://" + getServerHost() + ":" + port1 + "/jaxws-endpoint/endpoint/number1/";
   Endpoint endpoint1 = publishEndpoint1(new Endpoint1Impl(), publishURL1);

   String publishURL2 = "http://" + getServerHost() + ":" + port2 + "/jaxws-endpoint/endpoint/number1";
   Endpoint endpoint2 = publishEndpoint2(new Endpoint1Impl(), publishURL2);

   invokeEndpoint2(publishURL1);
   invokeEndpoint2(publishURL2);

   endpoint1.stop();
   endpoint2.stop();
}
 
Example 27
Project: jbossws-cxf   File: ProviderImpl.java   View source code 6 votes vote down vote up
@Override
public Endpoint createEndpoint(String bindingId, Object implementor) {
   ClassLoader origClassLoader = getContextClassLoader();
   boolean restoreTCCL = false;
   try
   {
      restoreTCCL = checkAndFixContextClassLoader(origClassLoader);
      setValidThreadDefaultBus();
      return new DelegateEndpointImpl(super.createEndpoint(bindingId, implementor));
   }
   finally
   {
      if (restoreTCCL)
         setContextClassLoader(origClassLoader);
   }
}
 
Example 28
Project: jbossws-cxf   File: ProviderImpl.java   View source code 6 votes vote down vote up
@Override
public Endpoint createEndpoint(String bindingId,
      Object implementor,
      WebServiceFeature ... features) {
   ClassLoader origClassLoader = getContextClassLoader();
   boolean restoreTCCL = false;
   try
   {
      restoreTCCL = checkAndFixContextClassLoader(origClassLoader);
      setValidThreadDefaultBus();
      return new DelegateEndpointImpl(super.createEndpoint(bindingId, implementor, features));
   }
   finally
   {
      if (restoreTCCL)
         setContextClassLoader(origClassLoader);
   }
}
 
Example 29
Project: jbossws-cxf   File: ProviderImpl.java   View source code 6 votes vote down vote up
@Override
public Endpoint createEndpoint(String bindingId, Class<?> implementorClass,
      Invoker invoker, WebServiceFeature ... features) {
   ClassLoader origClassLoader = getContextClassLoader();
   boolean restoreTCCL = false;
   try
   {
      restoreTCCL = checkAndFixContextClassLoader(origClassLoader);
      setValidThreadDefaultBus();
      return new DelegateEndpointImpl(super.createEndpoint(bindingId, implementorClass, invoker, features));
   }
   finally
   {
      if (restoreTCCL)
         setContextClassLoader(origClassLoader);
   }
}
 
Example 30
Project: jbossws-cxf   File: ProviderImplTest.java   View source code 6 votes vote down vote up
/**
 * This verifies that DelegateEndpointImpl delegates to the Apache
 * CXF EndpointImpl after having properly setup the TCCL so that it
 * can load and create instances of the ProviderImpl class.
 */
@Test
public void testEndpointImplPublishCorrectlySetsTCCL()
{
   ClassLoader orig = Thread.currentThread().getContextClassLoader();
   try
   {
      Endpoint ep1 = new DelegateEndpointImpl(new TestEndpoint());
      ep1.publish(new Integer(1)); //just to ensure the publish(Object arg) is used
      ep1.publish("foo");
      Thread.currentThread().setContextClassLoader(new TestClassLoader());
      Endpoint ep2 = new DelegateEndpointImpl(new TestEndpoint());
      ep2.publish(new Integer(1)); //just to ensure the publish(Object arg) is used
      ep2.publish("foo");
   }
   finally
   {
      Thread.currentThread().setContextClassLoader(orig);
   }
}
 
Example 31
Project: SecureBPMN   File: WebServiceProviderServlet.java   View source code 6 votes vote down vote up
@Override
public void loadBus(ServletConfig servletConfig) throws ServletException {
    super.loadBus(servletConfig);
    
    // TODO: Hacky first version to get default Process Engine
    ProcessEngine processEngine = ProcessEngineConfiguration
      .createProcessEngineConfigurationFromResourceDefault()
      .buildProcessEngine();
    
    Bus bus = getBus();
    BusFactory.setDefaultBus(bus); 
    Endpoint.publish("/RuntimeService", new RuntimeWebServiceImpl(processEngine));
    
    // You can als use the simple frontend API to do this
    ServerFactoryBean factory = new ServerFactoryBean();
    factory.setBus(bus);
    factory.setServiceClass(RuntimeWebServiceImpl.class);
    factory.setAddress("/RuntimeService");
    factory.create();              
}
 
Example 32
Project: taskerbox   File: SOAPChannel.java   View source code 6 votes vote down vote up
@Override
@WebMethod(exclude = true)
protected void execute() throws Exception {

  TaskerboxWebService<T> wsImpl = this.wsClass.newInstance();
  wsImpl.setChannel(this);

  Endpoint.publish(this.wsAddress, wsImpl);

  logInfo(log, "Web service '" + this.wsClass.getName() + "' was published successfully.\n"
      + "WSDL URL: " + this.wsAddress + "?WSDL");

  // Keep the local web server running until the process is killed
  while (Thread.currentThread().isAlive()) {
    try {
      Thread.sleep(10000);
    } catch (InterruptedException ex) {
    }
  }

}
 
Example 33
Project: ds4p   File: DocumentSegmentationClientTest.java   View source code 6 votes vote down vote up
@Before
public void setUp() {
	try {
		address = "http://localhost:9000/services/DocumentSegmentationService";
		ep = Endpoint.publish(address,
				new DocumentSegmentationServicePortTypeImpl());

		returnedValueOfProcessDocument = new SegmentDocumentResponse();
		returnedValueOfProcessDocument
				.setMaskedDocument("<ClinicalDocument></ClinicalDocument>");
		returnedValueOfProcessDocument.setProcessedDocument(null);
		returnedValueOfProcessDocument.setPostProcessingMetadata(null);

	} catch (Exception e) {
		logger.error(e.getMessage(), e);
	}
}
 
Example 34
Project: ds4p   File: ContextHandlerWebServiceClientTest.java   View source code 6 votes vote down vote up
@BeforeClass
public static void setUp() {
	try {
		address = "http://localhost:9000/services/DS4PContextHandler";
		ep = Endpoint.publish(address, new DS4PContextHandlerImpl());
		
		returnedValueOfEnforcePolicy = new Return ();
		returnedValueOfEnforcePolicy.setPdpDecision("Permit");
		returnedValueOfEnforcePolicy.setPurposeOfUse("TREAT");
		returnedValueOfEnforcePolicy.setHomeCommunityId("2.16.840.1.113883.3.467");
		returnedValueOfEnforcePolicy.setResourceId("");
		returnedValueOfEnforcePolicy.setResourceName("");
		returnedValueOfEnforcePolicy.setPdpStatus("");
		returnedValueOfEnforcePolicy.setPdpRequest("");
		returnedValueOfEnforcePolicy.setPdpResponse("");
		returnedValueOfEnforcePolicy.setRequestTime(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar(2008,10,1)));
		returnedValueOfEnforcePolicy.setResponseTime(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar(2008,10,1)));
		
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
Example 35
Project: datex2   File: Datex2.java   View source code 6 votes vote down vote up
public Datex2Supplier createSupplier(String supplierPath,
		String subscriptionPath) {

	if (subscriptionPath != null) {
		ClientSubscriptionImpl subscription = new ClientSubscriptionImpl(
				supplierPath, subscriptionPath);
		autowire(subscription);
		Endpoint.publish(subscriptionPath, subscription);
	}

	Datex2SupplierImpl supplier = new Datex2SupplierImpl(supplierPath,
			subscriptionPath);
	autowire(supplier);

	ClientPullImpl pull = new ClientPullImpl(supplier);
	autowire(pull);
	Endpoint.publish(supplierPath, pull);

	return supplier;
}
 
Example 36
Project: mhus-osgi-tools   File: WebServiceInfoImpl.java   View source code 6 votes vote down vote up
public void connect() {
	if (isConnected() || getName() == null || getName().length() == 0 || service == null) return;
	error = null;
	endpoint = null;
	webService = service.getServiceObject();
	try {
		log.fine("JWS Connect: " + getName());
		endpoint = Endpoint.publish("/" + getName(), webService);
	} catch (Throwable t) {
		error = t.getMessage();
		webService = null;
		endpoint = null;
		log.log(Level.WARNING, "ERROR: " + getName() + " " + webService, t);
	}
	if (endpoint != null)
		service.published(this);
}
 
Example 37
Project: juddi   File: UDDI_170_ValueSetValidationIntegrationTest.java   View source code 6 votes vote down vote up
private void reset() throws Exception {
        messagesReceived = 0;
        if (ep == null || !ep.isPublished()) {
                int httpPort = 9600 + new Random().nextInt(99);
                String hostname = TckPublisher.getProperties().getProperty("bindaddress");
                if (hostname == null) {
                        hostname = InetAddress.getLocalHost().getHostName();
                }
                url = "http://" + hostname + ":" + httpPort + "/" + UUID.randomUUID().toString();
                logger.info("Firing up embedded endpoint at " + url);
                do {
                        try {

                                ep = Endpoint.publish(url, this);
                                httpPort = 9600 + new Random().nextInt(99);
                        } catch (Exception ex) {
                                logger.warn(ex.getMessage());
                        }
                } while (ep != null && !ep.isPublished());

        }

}
 
Example 38
Project: juddi   File: UDDI_090_HttpExternalTest.java   View source code 6 votes vote down vote up
@BeforeClass
public static void startup() throws Exception {
        if (!TckPublisher.isEnabled()) return;
        startManager();
        hostname = TckPublisher.getProperties().getProperty("bindaddress");
        if (hostname == null) {
                hostname = InetAddress.getLocalHost().getHostName();
        }
        port = 9600;
        //bring up the TCK SubscriptionListener
        String httpEndpoint = "http://" + hostname + ":" + port + "/tcksubscriptionlistener";
        System.out.println("Bringing up SubscriptionListener endpoint at " + httpEndpoint);
        endPoint = Endpoint.publish(httpEndpoint, new UDDISubscriptionListenerImpl());
        int count = 0;
        while (!endPoint.isPublished()) {
                port = 9600 + new Random().nextInt(99);
                httpEndpoint = "http://" + hostname + ":" + port + "/tcksubscriptionlistener";
                System.out.println("Bringing up SubscriptionListener endpoint at " + httpEndpoint);
                endPoint = Endpoint.publish(httpEndpoint, new UDDISubscriptionListenerImpl());
                count++;
                if (count > 10) {
                        Assert.fail("unable to bring up endpoint");
                }
        }
        
}
 
Example 39
Project: juddi   File: UDDI_090_HttpMavenIntegrationTest.java   View source code 6 votes vote down vote up
@BeforeClass
public static void startup() throws Exception {

        if (!TckPublisher.isEnabled()) {
                return;
        }
        startManager();
        hostname = "localhost";
        //bring up the TCK SubscriptionListener
        port = 9600;
        String httpEndpoint = "http://" + hostname + ":" + port + "/tcksubscriptionlistener";
        System.out.println("Bringing up SubscriptionListener endpoint at " + httpEndpoint);
        endPoint = Endpoint.publish(httpEndpoint, new UDDISubscriptionListenerImpl());
        int count = 0;
        while (!endPoint.isPublished()) {
                port = 9600 + new Random().nextInt(99);
                httpEndpoint = "http://" + hostname + ":" + port + "/tcksubscriptionlistener";
                System.out.println("Bringing up SubscriptionListener endpoint at " + httpEndpoint);
                endPoint = Endpoint.publish(httpEndpoint, new UDDISubscriptionListenerImpl());
                count++;
                if (count > 10) {
                        Assert.fail("unable to bring up endpoint");
                }
        }
}
 
Example 40
Project: juddi   File: Publish.java   View source code 6 votes vote down vote up
public static void main (String args[]) {
	
	System.out.println("1. Bring up the hello world endpoint at port 18080");
	Endpoint helloWorldEndPoint = Endpoint.create(new HelloWorldImpl());
	helloWorldEndPoint.publish("http://localhost:18080/services/helloworld");
	
	System.out.println("2. Programmatically publish the endpoint to UDDI");
	Publish sp = new Publish();
	try {
		uddiClient = new UDDIClient("META-INF/wsdl2uddi-uddi.xml");
		UDDIClerk clerk = uddiClient.getClerk("joe");
		
		System.out.println("setting up the publisher");
		sp.setupJoePublisher(clerk);
		System.out.println("publish the business");
		sp.publishBusiness(clerk);
		System.out.println("and the wsdl");
		sp.publishWSDL(clerk);
		
		System.out.println("waiting for calls into the HelloWorldImpl...");
		
	} catch (Exception e) {
		e.printStackTrace();
	}
}