Generating SOAP Header

"Gubler, Joseph" <[email protected]>
Newsgroups gmane.comp.windows.devel.soap.general
Message-ID <98C98384D16FD511B63900B0D0AA93C905193AC0@may1exchprivis2.monster.com>
I need to write a client that sends a particular SOAP header as part of the
request. I have looked through all of the SOAP::Lite documentation without
finding a decent description of how this might be done.

Inspired by the SOAP::Lite docs, I have tried using the
SOAP::Serializer::envelope() method as follows:

my $soap = SOAP::Lite
        -> uri('some:uri')
        -> proxy('some:address');

my $serializer = $soap->serializer();
$serializer->envelope(method => 'hi', SOAP::Header->name(test1 => 50));
$soap->serializer($serializer);
print $soap->hi()->result;

Unfortunately, this does not insert my request header field.

I tried something like:

my $soap = SOAP::Lite
        -> uri('some:uri')
        -> proxy('some:address')
        -> envelope(method => 'hi', SOAP::Header->name(test1 => 50));

print $soap->hi()->result;

This DOES insert my header field, but pollutes the body with an attempt to
invoke a non-existent remote method called 'envelope'.

I have finally found that I can get header information inserted into my
request by doing the following:

my $soap = SOAP::Lite
        -> uri('some:uri')
        -> proxy('some:address');

print $soap->hi(SOAP::Header->name(test2 => 5))->result;

This seems like very bizarre syntax to me, but it does work. Anyone care to
enlighten me as far as the 'correct' way to insert SOAP header fields into
my request? I'm amazed that there are no decent examples of this in the
SOAP::Lite documentation.

Thanks.

-Joe

-------------------------
Joseph Gubler
Sr. Software Engineer
MonsterTrak
310.893.5553




"Bringing people together to advance their lives."

NOTICE: The information contained in this electronic mail transmission is
intended by TMP Interactive Inc. d/b/a Monster or one of its subsidiaries
for the use of the named individual or entity to which it is addressed and
may contain information that is privileged or otherwise confidential.  It is
not intended for transmission to, or receipt by, any individual or entity
other than the named addressee (or a person authorized to deliver it to the
named addressee) except as otherwise expressly permitted in this electronic
mail transmission. If you have received this electronic transmission in
error, please delete it without copying or forwarding it, and notify the
sender of the error by reply email or by calling Monster at 1-800-MONSTER.

You can read messages from the SOAP archive, unsubscribe from SOAP, or subscribe to other
DevelopMentor lists at http://discuss.develop.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.