You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Olivier Mengué <om...@oxymel.com> on 2010/01/29 19:19:29 UTC

How to set SOAPAction header for SOAP 1.1?

Hi,

I'm trying to write a SOAP client for the public SOAP service at:
http://www.service-repository.com/service/wsdl?id=98309

My attempts fail due to an empty SOAPAction header: Axis2/C 1.6.0 sends this:
-------------------------------------
POST http://mellbourn.com:80/WebServices/PasswordGeneratorWebService/PasswordGeneratorService.asmx HTTP/1.1
User-Agent: Axis2C/1.6.0
SOAPAction: ""
Content-Length: 199
Content-Type: text/xml;charset=UTF-8
Host: mellbourn.com:80

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><get_Password xmlns="http://www.mellbourn.com/WebServices/"></get_Password></soapenv:Body></soapenv:Envelope>
-------------------------------------

The response is:
-------------------------------------
HTTP/1.1 500 Internal Server Error.
Date: Fri, 29 Jan 2010 18:04:58 GMT
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET
PICS-Label: (PICS-1.0 "http://www.rsac.org/ratingsv01.html" l by "Klas@Mellbourn
.net" on "2003.05.01T16:56+0200" exp "2004.05.01T12:00+0200" r (v 0 s 0 n 0 l 0)
)
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 818
Proxy-Connection: Keep-Alive
Connection: Keep-Alive

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XM
LSchema">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Client</faultcode>
      <faultstring>System.Web.Services.Protocols.SoapException: Server did not r
ecognize the value of HTTP Header SOAPAction: .
   at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, Http
Context context, HttpRequest request, HttpResponse response, Boolean&amp; abortP
rocessing)</faultstring>
      <detail />
    </soap:Fault>
  </soap:Body>
</soap:Envelope>
----------------------------


According to the faultstring, the problem is the [SOAPAction: ""] header.

I tried to set the soap_action in the client options, but it looks like that does nothing:

        /* The axutil_string_create_const() is strange. See AXIS2C-1443 */
        axis2_char_t *SOAP_ACTION;
        axis2_options_set_soap_action(options, env, axutil_string_create_const(env, &SOAP_ACTION));


The full source code is attached. I plan to release it as an AXIS2/C sample when it's done.

Olivier Mengué

Re: How to set SOAPAction header for SOAP 1.1?

Posted by Selvaratnam Uthaiyashankar <ut...@gmail.com>.
Hi,

It seems you didn't assign any value to SOAP_ACTION variable???

Regards,
Shankar

2010/1/29 Olivier Mengué <om...@oxymel.com>:
> Hi,
>
> I'm trying to write a SOAP client for the public SOAP service at:
> http://www.service-repository.com/service/wsdl?id=98309
>
> My attempts fail due to an empty SOAPAction header: Axis2/C 1.6.0 sends
> this:
> -------------------------------------
> POST
> http://mellbourn.com:80/WebServices/PasswordGeneratorWebService/PasswordGeneratorService.asmx
> HTTP/1.1
> User-Agent: Axis2C/1.6.0
> SOAPAction: ""
> Content-Length: 199
> Content-Type: text/xml;charset=UTF-8
> Host: mellbourn.com:80
>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><get_Password
> xmlns="http://www.mellbourn.com/WebServices/"></get_Password></soapenv:Body></soapenv:Envelope>
> -------------------------------------
>
> The response is:
> -------------------------------------
> HTTP/1.1 500 Internal Server Error.
> Date: Fri, 29 Jan 2010 18:04:58 GMT
> Server: Microsoft-IIS/6.0
> MicrosoftOfficeWebServer: 5.0_Pub
> X-Powered-By: ASP.NET
> PICS-Label: (PICS-1.0 "http://www.rsac.org/ratingsv01.html" l by
> "Klas@Mellbourn
> .net" on "2003.05.01T16:56+0200" exp "2004.05.01T12:00+0200" r (v 0 s 0 n 0
> l 0)
> )
> X-AspNet-Version: 1.1.4322
> Cache-Control: private
> Content-Type: text/xml; charset=utf-8
> Content-Length: 818
> Proxy-Connection: Keep-Alive
> Connection: Keep-Alive
>
> <?xml version="1.0" encoding="utf-8"?>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi=
> "http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XM
> LSchema">
>   <soap:Body>
>     <soap:Fault>
>       <faultcode>soap:Client</faultcode>
>       <faultstring>System.Web.Services.Protocols.SoapException: Server did
> not r
> ecognize the value of HTTP Header SOAPAction: .
>    at
> System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
>    at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
>    at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type,
> Http
> Context context, HttpRequest request, HttpResponse response, Boolean&amp;
> abortP
> rocessing)</faultstring>
>       <detail />
>     </soap:Fault>
>   </soap:Body>
> </soap:Envelope>
> ----------------------------
>
>
> According to the faultstring, the problem is the [SOAPAction: ""] header.
>
> I tried to set the soap_action in the client options, but it looks like that
> does nothing:
>
>         /* The axutil_string_create_const() is strange. See AXIS2C-1443 */
>         axis2_char_t *SOAP_ACTION;
>         axis2_options_set_soap_action(options, env,
> axutil_string_create_const(env, &SOAP_ACTION));
>
>
> The full source code is attached. I plan to release it as an AXIS2/C sample
> when it's done.
>
> Olivier Mengué



-- 
S.Uthaiyashankar
Software Architect
WSO2 Inc.
http://wso2.com/ - "The Open Source SOA Company"

RE : How to set SOAPAction header for SOAP 1.1?

Posted by Olivier Mengué <om...@oxymel.com>.
Thanks. My bug was really too obvious.

Olivier.

-------- Message d'origine--------
De: Doughty, Michael [mailto:Michael_Doughty@bmc.com]
Date: dim. 31/01/2010 07 h 28
À: Apache AXIS C User List
Objet : RE: How to set SOAPAction header for SOAP 1.1?
 
It looks like you're setting the soap action to a string pointer that you haven't initialized or set to the proper value.  From looking at the WSDL it seems like that value should be the local value "get_Password", but the example they have on that site shows that it should be set to the qualified value "http://www.mellbourn.com/WebServices/get_Password".  So set the string value of the action to the latter of the two and rebuild.

RE: How to set SOAPAction header for SOAP 1.1?

Posted by "Doughty, Michael" <Mi...@bmc.com>.
It looks like you're setting the soap action to a string pointer that you haven't initialized or set to the proper value.  From looking at the WSDL it seems like that value should be the local value "get_Password", but the example they have on that site shows that it should be set to the qualified value "http://www.mellbourn.com/WebServices/get_Password".  So set the string value of the action to the latter of the two and rebuild.

From: Olivier Mengué [mailto:omengue@oxymel.com]
Sent: Friday, January 29, 2010 12:19 PM
To: axis-c-user@ws.apache.org
Subject: How to set SOAPAction header for SOAP 1.1?


Hi,

I'm trying to write a SOAP client for the public SOAP service at:
http://www.service-repository.com/service/wsdl?id=98309

My attempts fail due to an empty SOAPAction header: Axis2/C 1.6.0 sends this:
-------------------------------------
POST http://mellbourn.com:80/WebServices/PasswordGeneratorWebService/PasswordGeneratorService.asmx HTTP/1.1
User-Agent: Axis2C/1.6.0
SOAPAction: ""
Content-Length: 199
Content-Type: text/xml;charset=UTF-8
Host: mellbourn.com:80

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><get_Password xmlns="http://www.mellbourn.com/WebServices/"></get_Password></soapenv:Body></soapenv:Envelope>
-------------------------------------

The response is:
-------------------------------------
HTTP/1.1 500 Internal Server Error.
Date: Fri, 29 Jan 2010 18:04:58 GMT
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET
PICS-Label: (PICS-1.0 "http://www.rsac.org/ratingsv01.html" l by "Klas@Mellbourn
.net" on "2003.05.01T16:56+0200" exp "2004.05.01T12:00+0200" r (v 0 s 0 n 0 l 0)
)
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 818
Proxy-Connection: Keep-Alive
Connection: Keep-Alive

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XM
LSchema">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Client</faultcode>
      <faultstring>System.Web.Services.Protocols.SoapException: Server did not r
ecognize the value of HTTP Header SOAPAction: .
   at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, Http
Context context, HttpRequest request, HttpResponse response, Boolean&amp; abortP
rocessing)</faultstring>
      <detail />
    </soap:Fault>
  </soap:Body>
</soap:Envelope>
----------------------------


According to the faultstring, the problem is the [SOAPAction: ""] header.

I tried to set the soap_action in the client options, but it looks like that does nothing:

        /* The axutil_string_create_const() is strange. See AXIS2C-1443 */
        axis2_char_t *SOAP_ACTION;
        axis2_options_set_soap_action(options, env, axutil_string_create_const(env, &SOAP_ACTION));


The full source code is attached. I plan to release it as an AXIS2/C sample when it's done.

Olivier Mengué