You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by keith chapman <ke...@gmail.com> on 2008/04/03 17:02:10 UTC
[AXIS2] SOAP Action is not set by service Client when its invoked via a WSDL
Hi devs,
I was trying accessing an external webservice using service client as
follows,
ServiceClient serviceClient = new ServiceClient(null, new URL("
http://www.webservicex.net/CurrencyConvertor.asmx?wsdl"), new QName("
http://www.webserviceX.NET/","CurrencyConvertor"), "CurrencyConvertorSoap");
StAXOMBuilder stAXOMBuilder = new StAXOMBuilder(new
ByteArrayInputStream(
"<ConversionRate><FromCurrency>USD</FromCurrency><ToCurrency>LKR</ToCurrency></ConversionRate>".getBytes()));
OMElement omElement = serviceClient.sendReceive(
new QName("http://www.webserviceX.NET/", "ConversionRate"),
stAXOMBuilder.getDocumentElement());
System.out.println(omElement.toString());
But this call was failing with the exception
"System.Web.Services.Protocols.SoapException: Server did not recognize the
value of HTTP Header SOAPAction: ."
The request sent by the client had the header SOAPAction: "" whereas the
WSDL had <soap:operation soapAction="
http://www.webserviceX.NET/ConversionRate" style="document"/>
debugging through I noticed the following lines in
WSDL11ToAxisServiceBuilder (Line 2340)
if (isServerSide) {
axisBindingOperation.getAxisOperation().setSoapAction(soapActionURI);
}
else {
axisBindingOperation.getAxisOperation().setOutputAction(soapActionURI);
}
and CommonsHTTPTransportSender has the following in line 200
soapActionString = messageContext.getAxisOperation()
.getSoapAction();
Now this looks like a bug to me. Does anybody have a clue as to why we dont
set the soapAction on the axisoperation when the axisService is on the
client side?
Thanks,
Keith.
--
Keith Chapman
Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/
blog: http://www.keith-chapman.org
Re: [AXIS2] SOAP Action is not set by service Client when its invoked via a WSDL
Posted by David Illsley <da...@gmail.com>.
Hi Keith.
Yes, it's to do with WS-Addressing where there are both input and
output actions. In that case, the client 'output action' is the action
you should put on the request message.
There's been a lot of misunderstandings about this resulting in lots
of changes over the years such that I'm not 100% convinced it's
correct right now. (There should be a distinction in the code between
input actions and the soap action, and at one point there was, but
last time I looked it appeared to have gone).
I'll take another look and try to work out what's going on.
David
On Thu, Apr 3, 2008 at 4:02 PM, keith chapman <ke...@gmail.com> wrote:
> Hi devs,
>
> I was trying accessing an external webservice using service client as
> follows,
>
> ServiceClient serviceClient = new ServiceClient(null, new
> URL("http://www.webservicex.net/CurrencyConvertor.asmx?wsdl"), new
> QName("http://www.webserviceX.NET/","CurrencyConvertor"),
> "CurrencyConvertorSoap");
> StAXOMBuilder stAXOMBuilder = new StAXOMBuilder(new
> ByteArrayInputStream(
>
> "<ConversionRate><FromCurrency>USD</FromCurrency><ToCurrency>LKR</ToCurrency></ConversionRate>".getBytes()));
> OMElement omElement = serviceClient.sendReceive(
> new QName("http://www.webserviceX.NET/", "ConversionRate"),
> stAXOMBuilder.getDocumentElement());
> System.out.println(omElement.toString());
>
> But this call was failing with the exception
> "System.Web.Services.Protocols.SoapException: Server did not recognize the
> value of HTTP Header SOAPAction: ."
>
> The request sent by the client had the header SOAPAction: "" whereas the
> WSDL had <soap:operation
> soapAction="http://www.webserviceX.NET/ConversionRate" style="document"/>
>
> debugging through I noticed the following lines in
> WSDL11ToAxisServiceBuilder (Line 2340)
>
> if (isServerSide) {
>
> axisBindingOperation.getAxisOperation().setSoapAction(soapActionURI);
> }
> else {
>
> axisBindingOperation.getAxisOperation().setOutputAction(soapActionURI);
> }
>
> and CommonsHTTPTransportSender has the following in line 200
>
> soapActionString = messageContext.getAxisOperation()
> .getSoapAction();
>
> Now this looks like a bug to me. Does anybody have a clue as to why we dont
> set the soapAction on the axisoperation when the axisService is on the
> client side?
>
> Thanks,
> Keith.
>
> --
> Keith Chapman
> Software Engineer
> WSO2 Inc.
> Oxygenating the Web Service Platform.
> http://wso2.org/
>
> blog: http://www.keith-chapman.org
--
David Illsley - IBM Web Services Development
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org