Setting HTTP Header for While sending SOAP Requests

tata pavan kumar <[email protected]> Wed, 28 Apr 2004 07:15:21 -0700
Newsgroups gmane.comp.windows.devel.soap.general
Message-ID <[email protected]>
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='1.0' encoding='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 = xmlParseMemory(xml_in_memory,length+1);
              ii)  env = soap_env_new_from_doc(doc);
                iii)  res = 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="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encoding="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<msgSubmit xmlns="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=a8NMuhIFZXO-; Path=/
Content-Type: text/xml; charset=utf-8
Content-Length: 479
Date: Wed, 28 Apr 2004 10:35:05 GMT

Response:
-------------
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="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='1.0' encoding='UTF-8'?>
 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<msgSubmit xmlns="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