是否可以使用一个端点运行两个 ws 实现?

发布于 2024-12-15 02:12:30 字数 956 浏览 0 评论 0原文

我有两个共享一些命名空间的 Web 服务实现(使用相同的对象 - 例如对象 C)。 我想发布它,所以

1) 将为客户端共享生成的对象(相同的对象 C 存根)

2) 我可以在一个端口上运行 Booth Web 服务并访问它们,只需更改 url,如下所示

http://localhost:6690/WS/A?wsdl
http://localhost:6690/WS/B?wsdl

package a.wsdl.xxx.com;
@WebService(targetNamespace = "a.wsdl.xxx.com", serviceName = "A", name = "A")
public class A{
    @WebMethod
    public C a(){...}
}

//------ -------------------------------------------------- --------

package a.wsdl.xxx.com;   
@WebService(targetNamespace = "b.wsdl.xxx.com", serviceName = "B", name = "B")
public class B{
    @WebMethod
    public C b(){...}
}

//---------------------------------------- ------------------------

package xxx.com; 
public class C{
 String s; 
 ....
} 

I have two webservices implementations that shares some namespaces(Uses same objects - object C in example).
I whant to publish it so

1) There will be shared generated objects for the client side (the same object C stub)

2) I can run booth webservices on one port and access them just changing url like bellow

http://localhost:6690/WS/A?wsdl
http://localhost:6690/WS/B?wsdl

package a.wsdl.xxx.com;
@WebService(targetNamespace = "a.wsdl.xxx.com", serviceName = "A", name = "A")
public class A{
    @WebMethod
    public C a(){...}
}

//----------------------------------------------------------------

package a.wsdl.xxx.com;   
@WebService(targetNamespace = "b.wsdl.xxx.com", serviceName = "B", name = "B")
public class B{
    @WebMethod
    public C b(){...}
}

//----------------------------------------------------------------

package xxx.com; 
public class C{
 String s; 
 ....
} 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

神经大条 2024-12-22 02:12:30

是的,我刚刚创建了两个war文件greeting1.war和greeting2.war。它们都实现了一个 hello-world 接口,如下所示,只是类名 Greeting1Greeting2 不同。然后我将两者都部署到jboss。两者都可以通过 http://localhost:8080/greeting1?wsdlhttp://localhost:8080/greeting2?wsdl

package my.webservice;

import javax.jws.WebService;
import javax.jws.WebMethod;

@WebService
public class Greeting1 {
   @WebMethod
   public String greetClient(String user)
   {
      return "hello " + user;
   }
}

Yes, I just created two war files greeting1.war and greeting2.war. Each of them implements a hello-world interface as shown below, only class names are different Greeting1 and Greeting2. Then I deployed both to jboss. Both are accessible via http://localhost:8080/greeting1?wsdl and http://localhost:8080/greeting2?wsdl

package my.webservice;

import javax.jws.WebService;
import javax.jws.WebMethod;

@WebService
public class Greeting1 {
   @WebMethod
   public String greetClient(String user)
   {
      return "hello " + user;
   }
}
画离情绘悲伤 2024-12-22 02:12:30

两个或多个应用程序无法侦听同一端口。

Two or more applications can't listen same port.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文