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.
|