Using Soap Headers Yes or No?
Hi, I have a question about soap headers.Gente, tengo una duda existencial.
I've a lot of webmethod that have a common param (userdata) and a own param for each method.
I don't know if I can put this common data in a soap headers instead of pass this data by param.
In the first option, I'm looking for in the web and I found that all webservices's apis can and header definition to the WSDL.
Anybody can help me?
Regards-
Alejandro
[480 byte] By [
crisyalea] at [2007-11-27 3:37:55]

# 1
Hi Alejandro,
SOAP headers are designed to carry either information about the message or about the context, or any other supplement data.
In you case - I don't think that your questions can have yes/no answer.
If the common param (userdata) is more application level data, it should be inside SOAP body.
If the common param (userdata) is something like "user session" so it basically holds the context, it can be inside SOAP header.
Typically, SOAP headers are used for security (authentication, digital signatures), message routing or holding a "session" with a client.
Also be careful about the interoperability.
If you put common param (userdata) into SOAP header, be aware that not all web service tools can really
1) easily generate WSDL that describes that this SOAP header is really required and its content
2) generate stub/skeleton from WSDL that is aware of the required header
3) dealing with SOAP headers is very often a little bit more complex than dealing with just a SOAP body parameters when using webservices APIs
4) interoperability, interoperability... due to reason 1,2,3, you can always expect more interoperability issues (especially when integrating other platforms to your java WS (.NET, PHP, ...etc.).
So, if you want to keep it simple, I would put "userdata" inside message body.
Cheers,
Milan
http://www.boruvka.net/blog