2014-07-06 23 views
2

我一直在关注本教程,该教程非常适合使用WSDL http://training.middlewareschool.com/mule/consuming-wsdl-first-service/中的wb服务。 我一直试图通过在Eclipse中使用CXF生成客户端Web服务并在Mule中发布Web服务来尝试做类似的方法。我的问题是:如果我将客户端和mule应用程序配置为具有相同的端点(例如:localhost:8082/ipsoap/test),如何使Web服务以与本教程相同的方式工作。 含义如果我测试从客户端发送一个请求给mule(在eclipse中)我应该收到来自mule的正确响应。预先感谢您的时间。Mule:如何使用来自远程客户端的服务

因此,在短期:

使用WSDL在教程下面的链接

1-I产生的蚀一个客户端应用程序:http://ws.cdyne.com/ip2geo/ip2geo.asmx?wsdl

2-正如骡开始,我添加一个http连接器和记录器,并将eclipse中的端点路径更改为我在Mule上的HTTP连接器上设置的端点路径。因此,当我从Eclipse客户端向Mule发送请求时,我可以看到有一个有效载荷。我需要有一个应用程序,也就是我在eclipse中的客户端应用程序,它在Mule中使用已发布的服务。现在我认为这是使用CXF组件实现的,但我仍然无法使其工作。事实上,我不知道这是否是使用Mule的有效方式,因为我找不到任何有关我想要实现的教程。

因此,这里是我如何测试: enter image description here

我用我的骡子使用相同的端点和接收以下日志:

> INFO 2014-07-07 13:19:46,124 
> [[soapservice].connector.http.mule.default.receiver.02] 
> org.mule.api.processor.LoggerMessageProcessor: message transformation 
> <soapenv:Envelope 
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
> xmlns:q0="http://ws.cdyne.com/" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
> <soapenv:Body> 
>  <q0:ResolveIP> 
>  <q0:ipAddress>173.194.36.39</q0:ipAddress> 
>  <q0:licenseKey/> 
>  </q0:ResolveIP> </soapenv:Body> </soapenv:Envelope> 
> 
> ERROR 2014-07-07 13:19:46,134 
> [[soapservice].connector.http.mule.default.receiver.02] 
> org.mule.exception.DefaultMessagingExceptionStrategy: 
> ******************************************************************************** Message    : wrong number of arguments. Failed to route 
> event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. 
> Message payload is of type: String Code     : 
> MULE_ERROR--2 
> -------------------------------------------------------------------------------- Exception stack is: 
> 1. wrong number of arguments (java.lang.IllegalArgumentException) sun.reflect.NativeMethodAccessorImpl:-2 (null) 
> 2. wrong number of arguments. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of 
> type: String (org.mule.api.transport.DispatchException) 
> org.mule.module.cxf.CxfOutboundMessageProcessor:150 
> (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html) 
> -------------------------------------------------------------------------------- Root Exception stack trace: java.lang.IllegalArgumentException: wrong 
> number of arguments at 
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at 
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
>  + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) 

正如你所看到的SOAP请求可以看出但它不会在CXF组件级别消耗。这是我的骡代码:

​​

另外,如果我添加一组有效载荷与IP#[{“173.194.36.39”,“”}](第二个参数可以留空)的CXF组件之前它返回一个空元素。然而,回应应该是这样的:

<pck.IPInformation> 
<city>Mountain View</city> 
<stateProvince>CA</stateProvince> 
<country>United States</country> 
<organization/> 
<latitude>37.4192</latitude> 
<longitude>-122.0574</longitude> 
<areaCode>0</areaCode> 
<timeZone/> 
<hasDaylightSavings>false</hasDaylightSavings> 
<certainty>90</certainty> 
<regionName/> 
<countryCode>US</countryCode> 
</pck.IPInformation> 

因此,我的问题是与消费和检索的反应。 我对这个长度表示歉意,但是我一直在为此付出努力,还没有在网上找到解决方案。提前致谢。

+0

我很抱歉地说我不明白你想要达到什么效果。你能否扩展/重述你的问题? –

+0

感谢您的快速回复,我编辑了我的问题。我希望这样很好,否则我可以更清楚。 – Orochi1992

+0

任何输入将不胜感激。谢谢。 – Orochi1992

回答

1

您应该为WSDL创建的ResolveIP方法生成的消息类实例,并将其用作cxf:jaxws-client元素之前的消息负载。

+0

的确,我尝试按照建议设置有效负载并且它正在工作。然而,我设法通过删除cxf客户端并简单地将HTTP出站与WSDL的位置地址留在一起来找到我的问题,现在它返回正确的响应。因此,问题是有两个客户在日食和一个在骡子。谢谢您的回答 ! – Orochi1992

相关问题