CXF:在同一个soap:address上实现多个端口? [英] CXF: Implement multiple ports on same soap:adress?

查看:517
本文介绍了CXF:在同一个soap:address上实现多个端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们从客户那里获得了WSDL,要求我们在我们这边实现服务。



WSDL包含3个端口绑定,它们具有不同的名称和绑定,但相同的< soap:adress> ---像这样:

 <端口名= Name1 binding = tns:Binding1> 
< soap:address location = http:// localhost / Service / ServicePort />
< / port>
<端口名= Name2 binding = tns:Binding2>
< soap:address location = http:// localhost / Service / ServicePort />
< / port>
<端口名= Name3 binding = tns:Binding3>
< soap:address location = http:// localhost / Service / ServicePort />
< / port>

这样的WSDL是否可以用CXF实施?



当我运行 wsdl2java 时,CXF会生成3个Java接口。



我首先尝试了一种实现类,例如

  class MyServiceClass实现Interface1,Interface2,Interface3 {...} 

但是当我部署它并使用SoapUI进行检查时,由于某种原因,
只会公开<$ c $的端口绑定c> Interface1 ,
,似乎忽略了另外两个。 为什么?



然后我尝试改为实现3个不同的ServiceClass(每个实现一个接口),然后
放置多个< jaxws:endpoint> cxf-config.xml 中具有相同的地址属性/ p>

但是随后出现部署错误:

  RuntimeException:Soap 1.1已在地址/ Address 

中注册的端点任何提示,如何在CXF中实现这样的WSDL?
有可能吗?

解决方案

 但是,当我部署它并与由于某种原因,SoapUI只会公开Interface1的端口绑定,而似乎忽略了其他两个。为什么? 

如果您将看到实现类,则会找到此批注

  @WebService(endpointInterface = yourPackageName.Interface1)

仅指您的interface1。这就是为什么在部署它时会忽略其余2个接口的实现。



因此,您必须按照说明那样分别在不同的实现类中实现这3个接口。因为每个实现类中只允许一个endpointInterface。

 这样的WSDL是否可以用CXF实现? 

是的,有可能。



在端点发布者类中进行部署期间,您需要将这3个接口实现类对象包装在一个对象中,然后为单个端点发布。



我仍然不清楚



几个有用的链接:相同的要求,但很少造成混淆。



http:// cxf .547215.n5.nabble.com / Deploying-multiple-endpoints-ports-for-a-service-td569470.html



还请阅读有关JavaBeans端点的信息实现,我认为在这种情况下,它会比这更容易。


We got a WSDL from a client, asking us to implement the service on our side.

The WSDL contains 3 port-bindings, with different names and bindings, but identical <soap:adress> --- like this:

<port name="Name1" binding="tns:Binding1">
    <soap:address location="http://localhost/Service/ServicePort" />
</port>
<port name="Name2" binding="tns:Binding2">
    <soap:address location="http://localhost/Service/ServicePort" />
</port>
<port name="Name3" binding="tns:Binding3">
    <soap:address location="http://localhost/Service/ServicePort" />
</port>

Is such WSDL possible to implement with CXF?

When I run wsdl2java, CXF generates 3 java-interfaces.

I first tried a single implementation-class, like

class MyServiceClass implements Interface1, Interface2, Interface3 {...}

But when I deployed it and checked with SoapUI, for some reason, it would only expose Port-binding for Interface1, and seemed to ignore the 2 other ones. Why?

I then tried instead, to implement 3 different ServiceClasses (each implementing one of the interfaces), then put multiple <jaxws:endpoint> with identical address attributes in cxf-config.xml

But I then get deployment-error:

RuntimeException: Soap 1.1 endpoint already registered on address /Address

Any hints, how to implement such WSDL in CXF? Is it possible?

解决方案

      But when I deployed it and checked with SoapUI, for some reason, it would only expose Port-binding for Interface1, and seemed to ignore the 2 other ones. Why?

If you will see your implementation class, you will find this annotation,

@WebService(endpointInterface = "yourPackageName.Interface1")

Which is referring to your interface1 only. That's why on deploying it is ignoring rest 2 interface implementations.

So, you have to implement these 3 interface separately in different implemenataion class as you did as per your explanantion. Because only one endpointInterface is allowed in each implementation class.

Is such WSDL possible to implement with CXF?

Yes, it is possible.

During the deployement in your endpoint publisher class, you need to wrap these 3 interface implementation class object in one object and publish for a single end point.

I am still not clear how to do that, ill update the answer later.

Few useful links: It's same requirement but little confusing.

http://cxf.547215.n5.nabble.com/Deploying-multiple-endpoints-ports-for-a-service-td569470.html

Also read about JavaBeans endpoint implementation , i think in this case, it will be more easier than this.

这篇关于CXF:在同一个soap:address上实现多个端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆