[Xml-compile] WS-Security to Axis2 server
Mark Overmeer
mark at overmeer.net
Thu Aug 30 07:15:24 GMT 2012
* David McMath (mcdave at stanford.edu) [120830 05:25]:
> Not that I completely understand your situation, but it seems like
> the wsp:Policy element is just saying that you're going to need
> UsernameToken with the requests.
True.
> $wsdl->importDefinitions(
> '/Library/Perl/5.10.0/XML/Compile/WSS/wss11/200401-wss-secext.xsd' )
> ;
> $wsdl->importDefinitions(
> '/Library/Perl/5.10.0/XML/Compile/WSS/wss11/200401-wss-utility.xsd'
> ) ;
Instantiate the XML::Compile::WSS object, then this is not needed.
> >my $UsernameToken_writer =
> > $wsdl->schemas->compile(WRITER => $UsernameToken_element);
> Where it threw the error
>
> panic: schemas() removed in v2.00, not needed anymore
> at /Library/Perl/5.10.0/XML/Compile/WSDL11.pm line 65
> which says "old example" to me. But change that to
Where did you find this example? 2.00 was released four years ago.
First XML::Compile::Schema was a helper object for the WSDL. Later,
WSDL11 simply extended ::Schema.
> >my ($result, $trace) = $call->(
> > header => { $UsernameToken_element => $UsernameToken_value },
> > # rest of arguments
> >);
Like this:
my $op_call = $wsdl->compileClient($operation);
my $security = $wss->wsseBasicAuth($username, $password);
my %payload = ();
my ($answer, $trace) = $op_call->
( wsse_Security => $security
, %payload
);
> and I can't really disagree. That's just a warning. There's
> something somewhere about calling "addHeader" on something to make
> that piece work (XML::Compile::SOAP::WSS does that), but I don't
> really know how that works.
::SOAP::WSS uses ::SOAP::Operation::addHeader() to fix the information
from the WSDL. In WSDL11, you can describe which headers are expected
in the INPUT and the OUTPUT messages. However, the WSS group decided
not to bother with that feature. So, after the WSDL is parsed into
operations, those operations need to get fixed.
The repairs are done via a few hooks. Those hooks are installed via
a pluggable interface of the WSDL reader (WSS is not the only extension
which does not follow the WSDL guidelines) They get installed when the
::WSS object is created. That is the reason why the doc says:
# you really need next line
my $wss = XML::Compile::SOAP::WSS->new(version => '1.1');
my $wsdl = XML::Compile::WSDL11->new(...);
my $call = $wsdl->compileClient('some_operation');
For the next release, I have changed the last line in:
my $token = $wss->wsseBasicAuth($user, $password);
my ($data, $trace) = $call->(wsse_Security => $token, %data);
Hope this helps.
--
Regards,
MarkOv
------------------------------------------------------------------------
Mark Overmeer MSc MARKOV Solutions
Mark at Overmeer.net solutions at overmeer.net
http://Mark.Overmeer.net http://solutions.overmeer.net
More information about the Xml-compile
mailing list