JAX-WS:两个或多个端点作为一个服务和WSDL的端口
问题描述:
是否可以将两个或多个JAX-WS端点作为WSDL:端口发布到单个WSDL:服务中以使用一个wsdl包含以下内容?JAX-WS:两个或多个端点作为一个服务和WSDL的端口
<definitions ...>
...
<service name="Airport">
<port name="Cargo" binding="tns:CargoBinding">
<soap:address location="http://localhost:9999/"/>
</port>
<port name="Civil" binding="tns:CivilBinding">
<soap:address location="http://localhost:9999/"/>
</port>
</service>
</definitions>
这个想法是将两个逻辑上相似的服务合并为一个。我想知道如何使用Endpoint.publish来实现这一点?
答
是的。在WSDL定义中,服务是相关端点的集合,并且端点必须具有由URI标识的唯一地址。在你的代码中,两个端点的地址是相同的。
对于不同的端口端点,您必须多次调用Endpoint.publish
。 当你的WSDL定义,
Cargo cargo = new CargoImpl(); // Cargo is endpoint interface
Endpoint.publish("http://hostname/service/cargo", cargo);
Civil civil = new CivilImpl();
Endpoint.publish("http://hostname/service/civil", civil);
好吧,也许你知道什么是JAX-WS端点解决两个或多个实例下一个WSDL结合? – chaplean 2015-03-04 11:34:31
@ chaplean更新。 – zankard 2015-03-04 15:48:59
不幸的是,这产生了两个独立的WSDL,但没有标记 – chaplean 2015-03-05 05:32:57