Re: Setting HTTP Header for While sending SOAP Requests

"Clemens F. Vasters" <[email protected]> Wed, 28 Apr 2004 19:08:20 +0200
Newsgroups gmane.comp.windows.devel.soap.general
Message-ID <[email protected]>
The SOAP part is ok. The server is apparently dying with a
NullPointerException after receiving the message and while
Processing the request. You wouldn't be getting that response if=20
This was a SOAP problem.


<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server.Exception:</faultcode>
<faultstring>java.lang.NullPointerException</faultstring>
<faultactor>/soap/servlet/messagerouter</faultactor>
</SOAP-ENV:Fault>



-----Original Message-----
From: Discussion of implementing SOAP applications today
[mailto:[email protected]] On Behalf Of tata pavan kumar
Sent: Wednesday, April 28, 2004 4:15 PM
To: [email protected]
Subject: [SOAP] Setting HTTP Header for While sending SOAP Requests

Hi,

I prepared a SOAP Client application.,it will take short message details
and prepares SOAP Envelope and send it to SOAP Server. I used C SOAP
library for this.
Here the problem is.,i am getting error messages from the server. If i
observe the server logs..the main xml header ( <?xml version=3D'1.0'
encoding=3D'UTF-8'?>) doesn't appear in the request.,eventhough i put it
in my program. And content type doesn't appear. Actually i didn't set
http header. I want to know how to set this. Which function i have to
use.
My logic of the application is take xml template and fill the values,
parse ti and invoke soap_client_invoke function to send the request.
( Shortly   i) doc =3D xmlParseMemory(xml_in_memory,length+1);
              ii)  env =3D soap_env_new_from_doc(doc);
                iii)  res =3D soap_client_invoke(env, url, "");

Finally my problems are:
I) How come xml header is missing
2) How to set HTTP Header...

Please find request & response of message:
POST /soap/servlet/messagerouter HTTP/1.1
Host: 202.6.80.67
Date: Wed, 28 Apr 04 16:00:02 GMT
Content-Length: 666
SoapAction:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV=3D"http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"
SOAP-ENV:encoding=3D"http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<msgSubmit xmlns=3D"urn:smsgw">
 <SenderIdentification>
  <UserID>smsgw</UserID>
  <Password>smsgw</Password>
 </SenderIdentification>
 <RecipientInfo>
  <Recipient>
   <Destination>919825000359</Destination>
   <MsgData>jTesting</MsgData>
  </Recipient>
 </RecipientInfo>
 <MsgDetails>
  <MsgType>1</MsgType>
 </MsgDetails>
</msgSubmit>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>HTTP/1.1 500 Internal Server Error
Server: Resin/2.1.6
Cache-Control: private
Set-Cookie: JSESSIONID=3Da8NMuhIFZXO-; Path=3D/
Content-Type: text/xml; charset=3Dutf-8
Content-Length: 479
Date: Wed, 28 Apr 2004 10:35:05 GMT

Response:
-------------
<?xml version=3D'1.0' encoding=3D'UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV=3D"http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server.Exception:</faultcode>
<faultstring>java.lang.NullPointerException</faultstring>
<faultactor>/soap/servlet/messagerouter</faultactor>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

My XML Template:
-----------------------------
<?xml version=3D'1.0' encoding=3D'UTF-8'?>
 <SOAP-ENV:Envelope
xmlns:SOAP-ENV=3D"http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<msgSubmit xmlns=3D"urn:sample">
        <SenderIdentification>
                <UserID>$USERID</UserID>
                <Password>$PASSWORD</Password>
        </SenderIdentification>
        <RecipientInfo>
                <Recipient>
                        <Destination>$DESTINATION</Destination>
                        <MsgData>$MESSAGE</MsgData>
                </Recipient>
        </RecipientInfo>
        <MsgDetails>
                <MsgType>$MSGTYPE</MsgType>
        </MsgDetails>
</msgSubmit>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Any one help me..How to solve this??

Thanks & Regards,
Pavankumar..


---------------------------------
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs