繁体   English   中英

在Mule 3.5中使用CXF消耗Web服务

[英]Consuming a webservice with CXF in Mule 3.5

我正在尝试使用Mule(Anypoint Studio)中的CXF组件使用Web服务。 因此,我尝试从URL生成WSDL文件,但出现此错误: Rpc/encoded wsdls are not supported in CXF因此我遵循了这个答案。

它可以正常工作并生成客户端存根,然后将文件复制到我的Mule项目中。

但我收到此错误:

Service.SomeService.<init>(java.net.URL, javax.xml.namespace.QName) (java.lang.NoSuchMethodException)

这是我的流程:

<flow name="WebServiceTest">
          <cxf:jaxws-client
         clientClass="service.SomeService"
         wsdlLocation="http://127.0.0.1:8000/api/v2_soap/?wsdl"
        operation="test"/>         
      <outbound-endpoint address="http://127.0.0.1:8000/api.php/?type=v2_soap"/>
</flow>

有任何想法吗?

您的配置不正确,特别是出站端点URL。 您可以尝试根据Mule文档配置CXF客户端。
您还可以为JAX-WS服务构建客户端,而无需从WSDL生成客户端。 在这里,您需要一个服务接口和本地所有数据对象的副本,以使用类似以下内容:

<flow name="csvPublisher">
  ...
  <cxf:jaxws-client serviceClass="org.example.HelloService" operation="sayHi"/>
  <outbound-endpoint address="http://localhost:63081/services/greeter"/>
</flow>

另一种方法是,可以将CXF生成的客户端用作出站端点。 首先,您需要使用从CXF或Maven插件使用WSDL to Java工具生成CXF客户端。
然后,您需要配置以下内容:

<flow name="csvPublisher">
  ...
  <cxf:jaxws-client
         clientClass="org.apache.hello_world_soap_http.SOAPService"
         port="SoapPort"
         wsdlLocation="classpath:/wsdl/hello_world.wsdl"
         operation="greetMe"/>
  <outbound-endpoint address="http://localhost:63081/services/greeter"/>
</flow>

最好将wsdl放在本地类路径中。

请在此处签出完整文档作为参考以进行配置:-
https://docs.mulesoft.com/mule-user-guide/v/3.7/using-web-services-with-cxf

使用Mule 3.4消耗Web服务

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM