2013-05-14 48 views
0

我想要使用JAX-WS服务方法。该方法被命名为find并接受一个字符串作为参数。在Mule ESB流程中使用JAX-WS

这骡子流程:

<flow name="InvokeAWebServiceFlow1" doc:name="InvokeAWebServiceFlow1"> 
    <file:inbound-endpoint path="C:\MuleStudio\SandBox\input" pollingFrequency="3000" responseTimeout="10000" doc:name="File"/> 
    <file:file-to-string-transformer encoding="UTF-8" mimeType="text/xml" doc:name="File to String"/> 
    <cxf:jaxws-client port="douaneWSPort" serviceClass="WSDL.DouaneWS" doc:name="SOAP" enableMuleSoapHeaders="true" operation="find"/> 
    <echo-component doc:name="Echo"/> 
    <file:outbound-endpoint path="C:\MuleStudio\SandBox\output" outputPattern="#[function:datestamp:dd-MM-yy]_#[function:systime].xml" responseTimeout="10000" doc:name="File"/> 
</flow> 

我把参数到一个文件,在这个为例的说法是“CTR-”后,我把文件放到入站端点,在此之后,文件被转换为一个字符串并转到JAX-WS客户端,最后该反写被写入输出文件。

当我运行我得到作为输出流:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
<soap:Body> 
<ns2:find xmlns:ns2="http://douane.ws/"> 
    <id>ctr1</id> 
</ns2:find> 
</soap:Body> 
</soap:Envelope> 

输出是SOAP请求,而不是预期SOAP响应,这应该是财产以后像:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> 
    <S:Body> 
     <ns2:findResponse xmlns:ns2="http://douane.ws/"> 
     <return> 
      <quality>medium</quality> 
      <price>150</price> 
      <idProd>ctr1</idProd> 
     </return> 
     </ns2:findResponse> 
    </S:Body> 
</S:Envelope 

> 。

错误产生是

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
+ Started app 'invokeawebservice'       + 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
INFO 2013-05-14 11:13:15,024 [[invokeawebservice].connector.file.mule.default.receiver.01] org.mule.transport.file.FileMessageReceiver: Lock obtained on file: C:\MuleStudio\SandBox\input\input.txt 
INFO 2013-05-14 11:13:15,155 [[invokeawebservice].InvokeAWebServiceFlow1.stage1.02] org.mule.component.simple.LogComponent: 
******************************************************************************** 
* Message received in service: InvokeAWebServiceFlow1. Content is:    * 
* '<soap:Envelope                * 
* xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:find * 
* xmlns:ns2...[100 of 173]'             * 
******************************************************************************** 
INFO 2013-05-14 11:13:15,184 [[invokeawebservice].connector.file.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.file.mule.default.dispatcher.2917880'. Object is: FileMessageDispatcher 
INFO 2013-05-14 11:13:15,184 [[invokeawebservice].connector.file.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.file.mule.default.dispatcher.2917880'. Object is: FileMessageDispatcher 
INFO 2013-05-14 11:13:15,200 [[invokeawebservice].connector.file.mule.default.dispatcher.01] org.mule.transport.file.FileConnector: Writing file to: C:\MuleStudio\SandBox\output\14-05-13_1368522795199.xml 
WARN 2013-05-14 11:13:15,261 [[invokeawebservice].InvokeAWebServiceFlow1.stage1.02] org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {http://douane.ws/}DouaneWSService#{http://douane.ws/}find has thrown exception, unwinding now 
org.apache.cxf.interceptor.Fault: Unexpected wrapper element {http://douane.ws/}find found. Expected {http://douane.ws/}findResponse. 
    at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:106) 
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) 
    at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:799) 
    at org.mule.module.cxf.transport.MuleUniversalConduit.dispatchMuleMessage(MuleUniversalConduit.java:280) 
    at org.mule.module.cxf.transport.MuleUniversalConduit$2.handleMessage(MuleUniversalConduit.java:194) 
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) 
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:533) 
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463) 
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:375) 
    at org.mule.module.cxf.CxfOutboundMessageProcessor.doSendWithClient(CxfOutboundMessageProcessor.java:235) 
    at org.mule.module.cxf.CxfOutboundMessageProcessor.process(CxfOutboundMessageProcessor.java:125) 
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) 
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61) 
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47) 
    at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:95) 
    at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70) 
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) 
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47) 
    at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:106) 
    at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55) 
    at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:122) 
    at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:192) 
    at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:185) 
    at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:20) 
    at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:34) 
    at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:18) 
    at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:58) 
    at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:48) 
    at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54) 
    at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:44) 
    at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:44) 
    at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:52) 
    at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:32) 
    at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:17) 
    at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:113) 
    at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:34) 
    at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:184) 
    at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:43) 
    at org.mule.work.WorkerContext.run(WorkerContext.java:311) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at java.lang.Thread.run(Unknown Source) 
ERROR 2013-05-14 11:13:15,271 [[invokeawebservice].InvokeAWebServiceFlow1.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy: 
******************************************************************************** 
Message    : Unexpected wrapper element {http://douane.ws/}find found. Expected {http://douane.ws/}findResponse.. 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. Unexpected wrapper element {http://douane.ws/}find found. Expected {http://douane.ws/}findResponse. (org.apache.cxf.interceptor.Fault) 
    org.apache.cxf.interceptor.DocLiteralInInterceptor:106 (null) 
2. Unexpected wrapper element {http://douane.ws/}find found. Expected {http://douane.ws/}findResponse.. 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:144 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html) 
-------------------------------------------------------------------------------- 
Root Exception stack trace: 
org.apache.cxf.interceptor.Fault: Unexpected wrapper element {http://douane.ws/}find found. Expected {http://douane.ws/}findResponse. 
    at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:106) 
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) 
    at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:799) 
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) 
******************************************************************************** 

任何帮助?

回答

1

如果你想要消费web服务托管,让我们在http://domain.com/ws说,比你的配置应该是这样的:

<flow name="InvokeAWebServiceFlow1" doc:name="InvokeAWebServiceFlow1"> 
<file:inbound-endpoint path="C:\MuleStudio\SandBox\input" pollingFrequency="3000" responseTimeout="10000" doc:name="File"/> 
<file:file-to-string-transformer encoding="UTF-8" mimeType="text/xml" doc:name="File to String"/> 
<cxf:jaxws-client port="douaneWSPort" serviceClass="WSDL.DouaneWS" doc:name="SOAP" enableMuleSoapHeaders="true" operation="find"/> 
<http:outbound-endpoint address="http://domain.com/ws" /> 
<echo-component doc:name="Echo"/> 
<file:outbound-endpoint path="C:\MuleStudio\SandBox\output" outputPattern="#[function:datestamp:dd-MM-yy]_#[function:systime].xml" responseTimeout="10000" doc:name="File"/> 
</flow> 

你可以找到关于该主题here

+0

更多信息谢谢您,这是工作。 – 2013-05-14 12:41:36