简体   繁体   English

从另一个Web服务调用Web服务的异常

[英]Exception calling a web service from another web service

I need to call an axis2 web service inside another web service. 我需要在另一个Web服务中调用axis2 Web服务。 Until now, I was doing it using a thread. 到现在为止,我一直在使用线程执行此操作。 I created a thread and invoked the web service and worked fine. 我创建了一个线程并调用了Web服务,并且运行良好。

But, the thread is not really needed since I need to waik for the response anyway. 但是,实际上并不需要线程,因为无论如何我都需要放弃响应。 So I've changed it and invoke it directly but it returns the following error 所以我更改了它并直接调用它,但是它返回以下错误

The server did not recognise the action which it received: 
    at es.cecabank.ealiapagos.servicios.wsimpl.operaciones.ws_operaciones_pagoconcargo.WS_operaciones_pagoConCargoSkeleton.realizarConciliacion(WS_operaciones_pagoConCargoSkeleton.java:471)
    at es.cecabank.ealiapagos.servicios.wsimpl.operaciones.ws_operaciones_pagoconcargo.WS_operaciones_pagoConCargoSkeleton.operacionesPagoConCargo(WS_operaciones_pagoConCargoSkeleton.java:174)
    at es.cecabank.ealiapagos.servicios.wsimpl.operaciones.ws_operaciones_pagoconcargo.WS_operaciones_pagoConCargoMessageReceiverInOut.invokeBusinessLogic(WS_operaciones_pagoConCargoMessageReceiverInOut.java:64)
    at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
    at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)
    at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:488)
    at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:420)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)
    at java.lang.Thread.run(Thread.java:745)

I'm struggling to see the cause of this. 我正在努力寻找原因。 I see the action is set in the stub as always. 我看到操作像往常一样在存根中设置。

_operationClient.getOptions().setAction("op3215");

Can anyone help with this? 有人能帮忙吗?

After studying the axis code, I've found the solution. 研究轴代码后,​​我找到了解决方案。 Before actually executing the operation with _operationClient.execute(true); 在使用_operationClient.execute(true)实际执行操作之前; , I've changed a property in the message context. ,我更改了消息上下文中的属性。

_messageContext.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, true);

This way it works, for now. 通过这种方式,目前。 I don't know if it will have other implications. 我不知道它是否还会带来其他影响。

As for the cause of the error, I think it has to do with the definition of the service I'm invoking. 至于错误的原因,我认为这与我正在调用的服务的定义有关。 It doesn't have specific names for the input and the output actions: 对于输入和输出操作,它没有特定的名称:

<wsdl:operation name="op3215">
  <soap:operation soapAction="op3215"/>
  <wsdl:input>
    <soap:body use="literal"/>
  </wsdl:input>
  <wsdl:output>
    <soap:body use="literal"/>
  </wsdl:output>
</wsdl:operation>

instead of 代替

  <wsdl:operation name="op3215">
     <wsdlsoap:operation soapAction=""/>
     <wsdl:input name="op3215">
        <wsdlsoap:body use="literal"/>
     </wsdl:input>
     <wsdl:output name="op3215">
        <wsdlsoap:body use="literal"/>
     </wsdl:output>
  </wsdl:operation>

Then again, I'm not completely sure, and I don't know either why it worked fine using an independent thread. 再说一次,我不确定,也不知道为什么使用独立线程可以正常工作。

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

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