speedygonzalez
asked on
Difference between SOAP & HTTPRequest Headers?
Hello,
I have a webservice I need to call which contains a <soap12:Header> element within its XML.
<soap12:Header>
<ServiceAuthHeader xmlns="http://dummyNameForExpertsExc">
<User>string</User>
<Password>string</Password >
</ServiceAuthHeader>
</soap12:Header>
In calling the webservice I will be doing so using the HttpRequest and HttpResponse apex classes.
the HttpRequest class has a method called setHeader.
In examples I have seen it is used to set attributes such as content type in the following
HttpRequest req = new HttpRequest();
req.setEndpoint('http://dummyNameForBlogPost.com/serviceTest.asmx ');
req.setMethod('POST');
req.setHeader('Content-Typ e', 'application/soap+xml');
req.setTimeout(60000);
There is a setBody method for HttpRequest also.
Should my SOAP Header actually go with the rest of my XML in the setBody method?
I have a webservice I need to call which contains a <soap12:Header> element within its XML.
<soap12:Header>
<ServiceAuthHeader xmlns="http://dummyNameForExpertsExc">
<User>string</User>
<Password>string</Password
</ServiceAuthHeader>
</soap12:Header>
In calling the webservice I will be doing so using the HttpRequest and HttpResponse apex classes.
the HttpRequest class has a method called setHeader.
In examples I have seen it is used to set attributes such as content type in the following
HttpRequest req = new HttpRequest();
req.setEndpoint('http://dummyNameForBlogPost.com/serviceTest.asmx ');
req.setMethod('POST');
req.setHeader('Content-Typ
req.setTimeout(60000);
There is a setBody method for HttpRequest also.
Should my SOAP Header actually go with the rest of my XML in the setBody method?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. This answer is very useful!
ASKER
My question is
Should my SOAP Header actually go with the rest of my XML in the setBody method? or should it be set in the HTTPRequest.setHeader() method?
This has really confused me.
Thanks.