Web services 使用mule使用一个简单的web服务

Web services 使用mule使用一个简单的web服务,web-services,mule,Web Services,Mule,我试图使用Mule+apachecxf使用公共服务。这项服务可在 这是一个非常简单的服务,它执行基本的算术运算。我试图在这里调用“添加”操作。我的mule配置如下所示 <flow name="calculator" doc:name="calculator"> <stdio:inbound-endpoint system="IN" doc:name="STDIO"/> <custom-transformer class="com.calculator.transf

我试图使用Mule+apachecxf使用公共服务。这项服务可在

这是一个非常简单的服务,它执行基本的算术运算。我试图在这里调用“添加”操作。我的mule配置如下所示

<flow name="calculator" doc:name="calculator">

<stdio:inbound-endpoint system="IN" doc:name="STDIO"/>
<custom-transformer class="com.calculator.transformer.CalculatorClient" doc:name="Java"/>

<outbound-endpoint address="http://localhost:28081/service/Calculator?WSDL" exchange-pattern="request-response" doc:name="HTTP">

  <cxf:jaxws-client clientClass="com.calculator.wsdl.Calculator" enableMuleSoapHeaders="true" port="CalculatorHttpPost" wsdlLocation="classpath:/wsdl/Calculator.wsdl" operation="Add">
      <cxf:inInterceptors>
    <spring:bean class="org.apache.cxf.interceptor.LoggingInInterceptor" />
    </cxf:inInterceptors>
    <cxf:outInterceptors>
      <spring:bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
    </cxf:outInterceptors>
  </cxf:jaxws-client>

</outbound-endpoint>

 <transformer ref="CalculatorResponse" doc:name="Transformer Reference"/>

 <mulexml:jaxb-object-to-xml-transformer name="CalculatortoXML" jaxbContext-ref="myJaxbCal" />



<stdio:outbound-endpoint system="OUT" doc:name="STDIO"/>


</flow>
一旦我启动mule,我就会收到错误。不确定我做错了什么

ERROR 2014-01-16 01:09:46,237 [[weatherproject].calculator.stage1.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: Add
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: Add (org.mule.api.transport.DispatchException)
  org.mule.module.cxf.CxfOutboundMessageProcessor:148 (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(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

您提到了
http://localhost:28081/service/Calculator?WSDL
作为您的地址,我想应该是
http://localhost:28081/service/Calculator

这篇文章帮助我解决了这个问题


通过使用建议的JAXB绑定,CXF将生成包装器对象。

是的,我得到的错误是参数数量错误。我不确定我是否正确执行此操作替换java.lang.IllegalArgumentException后面临的名称问题:参数数量错误
ERROR 2014-01-16 01:09:46,237 [[weatherproject].calculator.stage1.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: Add
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: Add (org.mule.api.transport.DispatchException)
  org.mule.module.cxf.CxfOutboundMessageProcessor:148 (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(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)