Thank you. This has started me on the right track, but I'm still not quite there yet. The parameter appears to be 'header' with a lowercase 'h'. But it seems like it only accepts an arrayref containing a hashref. I tried looking through the modules themselves as well as the documentation to see how to structure this and eventually I came to this:
my $header = [{ parts => [{ name => 'token', element => 'tns:token', destination => $sessionToken, mustUnderstand => 1 }] }];
This structure got me the farthest (I was either getting errors about it not being a hashref or arrayref, or a "panic: findName called without name" before). But now I'm getting this error:
error: cannot find element or attribute `{http://example.com/tns}token +'
That despite when I do the login and do a dumper on the $answer variable I get this:
Answer: $VAR1 = { 'parameters' => { 'Output' => { 'SessionToken' => 'sessiontokenv +alue' } }, '{http://example.com/tns}token' => bless( do{\(my $o = 44800 +400)}, 'XML::LibXML::Element' ) };
Yet when I try to add that into the header with that same namespace, it complains it can't find the element. Now I tried making a schema just for this token (since it is not defined in any of the WSDLs or XSDs that the company whose API I am trying to access provides):
<?xml version="1.0" encoding="utf-8"?> <xs:schema elementFormDefault="qualified" targetNamespace="http://example.com/tns" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://example.com/tns"> <xs:element name="token" nillable="true" type="xs:string" /> </xs:schema>
Now I get a different error: Can't call method "header" on unblessed reference at /usr/local/perl/5.16.1/lib/site_perl/5.16.1/XML/Compile/Transport/SOAPHTTP.pm line 340. So now it wants the header to be an object, and it appears the default value comes from HTTP::Headers (which is not the kind of header I want, I'm looking for the SOAP envelope header tag. So how do I build the header element? Thanks.

In reply to Re^2: Passing a session token using XML::Compile::WSDL by SeptamusNonovant
in thread Passing a session token using XML::Compile::WSDL by SeptamusNonovant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.