View on
Mark Overmeer > XML-Compile-WSS-1.03 > XML::Compile::WSS



Annotate this POD


Open  2
View/Report Bugs
Module Version: 1.03   Source   Latest Release: XML-Compile-WSS-1.14


XML::Compile::WSS - OASIS Web Services Security


 XML::Compile::WSS is extended by


 # This modules van be used "stand-alone" ...
 my $schema = XML::Compile::Cache->new(...);
 my $auth   = XML::Compile::WSS::BasicAuth->new
   (schema => $schema, username => $user, ...);
 my $elem   = $auth->create($doc, $data);

 # ... or as SOAP slave (strict order of object creation!)
 my $wss    = XML::Compile::SOAP::WSS->new;
 my $wsdl   = XML::Compile::WSDL11->new($wsdlfn);
 my $auth   = $wss->basicAuth(username => $user, ...);
 my $answer = $wsdl->call($operation, wsse_Security => $auth, %data);
 # same, because "all" defined is default
 my $answer = $wsdl->call($operation, %data);
 # or
 my $call   = $wsdl->compileClient($operation);
 my $answer = $call->(%data);


The Web Services Security working group of W3C develops a set of standards which add signatures and encryption to XML.

In its current status, this module implements features in the Security header. One header may contain more than one of these:

You will certainly need the constants from XML::Compile::WSS::Util. Besides, when you want to use Security with SOAP, then use XML::Compile::SOAP::WSS.



 -Option     --Default
  schema       undef
  version      undef
  wss_version  <required>
schema => an XML::Compile::Cache object

Add the WSS extension information to the provided schema. If not used, you have to call loadSchemas() before compiling readers and writers.

version => STRING

Alternative for wss_version, but not always as clear.

wss_version => '1.1'|MODULE

[1.0] Explicitly state which version WSS needs to be produced. You may use a version number. You may also use the MODULE name, which is a namespace constant, provided via ::Util. The only option is currently WSS11MODULE.



Returns the version number.



Check whether received SECURITY information is correct. Each active WSS feature must check whether it finds information for it.

$obj->create(DOC, SECURITY, DATA)

Adds some WSS element to SECURITY. The DATA is the structure which is passed to some writer (for instance, the DATA which the user passes to the SOAP call). There is quite some flexibility in that structure, so should not be used, in general.



Returns a structure which can be used as timestamp, for instance in Created and Expires fields. This helper function will help you use these timestamp fields correctly.

The WSU10 specification defines a free format timestamp. Of course, that is very impractical. Typically a "design by committee" decission. Also, the standard does not describe the ValueType field, which is often used to cover this design mistake.


  # Both will get ValueType="$xsd/dateTime"
  Created => time()                 # will get formatted
  Created => '2012-10-14T22:26:21Z' # autodected

  # Explicit formatting
  Created => { _ => 'this Christmas'
             , ValueType => ''

  # No ValueType added
  Created => 'this Christmas'


XML::Compile::WSS->loadSchemas(SCHEMA, VERSION)

SCHEMA must extend XML::Compile::Cache.

The SCHEMA settings will may changed a little. For one, the allow_undeclared flag will be set. Also, any_element will be set to 'ATTEMPT' and mixed_elements to 'STRUCTURAL'.



A huge number of specifications act in this field. Every self respecting company has contributed its own implementation into the field. A lot of this is not supported, but the list of constants should be complete in XML::Compile::WSS::Util.


This module is part of XML-Compile-WSS distribution version 1.03, built on October 26, 2012. Website:

Other distributions in this suite: XML::Compile, XML::Compile::SOAP, XML::Compile::SOAP12, XML::Compile::SOAP::Daemon, XML::Compile::SOAP::WSA, XML::Compile::C14N, XML::Compile::WSS, XML::Compile::Tester, XML::Compile::Cache, XML::Compile::Dumper, XML::Compile::RPC, XML::Rewrite, XML::eXistDB, and XML::LibXML::Simple.

Please post questions or ideas to the mailinglist at For live contact with other developers, visit the #xml-compile channel on


Copyrights 2011-2012 by [Mark Overmeer]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See

syntax highlighting: