当前位置: 动力学知识库 > 问答 > 编程问答 >

Calling web service from Java "The message with Action '' cannot be processed at the receiver"

问题描述:

I'm newbie with web services and java, so I have some issues to connect my application with an external Web Service. I get all the time this exception

The message with Action '' cannot be processed at the receiver

Maybe my assumptions are wrong, but I think the action is defined inside the SOAP payload. Here is the WSDL:

<?xml version='1.0'?>

<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.tempuri.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.tempuri.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">

<types />

<message name="BINICIARREPORTRequest">

<part name="EAUSUARIO" type="xsd:string" />

<part name="EAMODULO" type="xsd:string" />

<part name="EANOMREPOR" type="xsd:string" />

<part name="EAPARAMREPOR" type="xsd:string" />

<part name="EANOMPANTA" type="xsd:string" />

</message>

<message name="BINICIARREPORTResponse">

<part name="RESULT" type="xsd:boolean" />

</message>

<portType name="PWS_LANZA_REPOR_PORT_1">

<operation name="BINICIARREPORT">

<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />

<input message="tns:BINICIARREPORTRequest" />

<output message="tns:BINICIARREPORTResponse" />

</operation>

</portType>

<binding name="PWS_LANZA_REPOR_PORT_1Soap" type="tns:PWS_LANZA_REPOR_PORT_1">

<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />

<operation name="BINICIARREPORT">

<soap:operation soapAction="http://www.tempuri.org/wsdl/BINICIARREPORTRequest" style="rpc" />

<input name="BINICIARREPORTRequest">

<soap:body use="encoded" namespace="http://www.tempuri.org/wsdl/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />

</input>

<output name="BINICIARREPORTResponse">

<soap:body use="encoded" namespace="http://www.tempuri.org/wsdl/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />

</output>

</operation>

</binding>

<service name="PWS_LANZA_REPOR">

<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />

<port name="PWS_LANZA_REPOR_PORT_1Port" binding="tns:PWS_LANZA_REPOR_PORT_1Soap">

<soap:address location="" />

</port>

</service>

</definitions>

Here is the code I'm using:

 final String endpointUrl = this.configuracion

.getConfigJNDI(WS_MECANIZACION_JNDI);

final QName serviceName = new QName(null,

"PWS_LANZA_REPOR");

final QName portName = new QName(null, "PWS_LANZA_REPOR_PORT_1Port");

final javax.xml.ws.Service service = javax.xml.ws.Service

.create(serviceName);

service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,

endpointUrl);

final Dispatch<SOAPMessage> dispatch = service.createDispatch(

portName, SOAPMessage.class,

javax.xml.ws.Service.Mode.MESSAGE);

final SOAPMessage response = dispatch.invoke(mensajeSOAP);

If I use SoapUI to check this out, everything works fine (the message is OK as well as the endpointURL), but no success whatsoever from the java application.

This is the soap message I'm sending:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="s" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<SOAP-ENV:Header/>

<SOAP-ENV:Body>

<wsdl:BINICIARREPORT xmlns:wsdl="cosa">

<EAUSUARIO>CD</EAUSUARIO>

<EAMODULO>PR</EAMODULO>

<EANOMREPOR>PRR14</EANOMREPOR>

<EAPARAMREPOR/>

<EANOMPANTA/>

</wsdl:BINICIARREPORT>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

I don't know whether this is important, but the url I was given has no "?wsdl" at then end:

http://prueba/prueba/Pws_Lanza_Rep1.svc

Any clues?

网友答案:

I haven't figured it out yet, but following the steps here everything worked fine! I have used the same xml and the same parameters, so it still remains a mistery to me why the previous code didn't work.

分享给朋友:
您可能感兴趣的文章:
随机阅读: