Signature templates are used to define how signatures are generated for SOAP messages. They are XML files containing a structure of Signature elements as per XML Signature standard. The DigestValue and SignatureValue elements are empty, so they will be filled upon output. The most important element is the KeyName element. This must contain a reference to an existing key from the user account space. This key reference does not need to be the same as key for data encryption, it can be a different key. Please note that XML encoding routines will resolve the key automatically, so there is no need to specify how the key instance will be obtained, hence no relation to "WSS-Key" from SOAP options section (above).

The default template will create an XML Signature using the following definitions:

a) have a simple template corresponding to a key reference (and it's algorithm) as:

TEMP := <?xml version="1.0" encoding="UTF-8"?>
<Signature xmlns="" >
    <CanonicalizationMethod Algorithm="" />
    <SignatureMethod Algorithm="[key algorithm]" />
    <KeyName>[key reference]</KeyName>

b) generate references to template a), using the dsig_template_ext() function and BODY of the SOAP request.

TEMPLATE :=  dsig_template_ext (xtree_doc (SOAP_BODY), TEMP,
      '', 'Body',
      '', 'action',
      '', 'to',
      '', 'id',
      '', 'Created',
      '', 'Expires');

In other words, the 'Body' of the SOAP message, part of the routing header elements ('action,'to','id') and, if it exists, Timestamp headers ('Created', 'Expires').

Example 17.28. Using default templates

This example demonstrates the use of the default template mechanism and X.509 certificate with RSA key:

--------------- SOAP message
<SOAP:Envelope xmlns:xsi=""
  <SOAP:Header />
    <AddInt xmlns="">

--------------- Generated signature template
<ds:Signature xmlns:ds=""
      <ds:CanonicalizationMethod Algorithm="">
      <ds:SignatureMethod Algorithm=""></ds:SignatureMethod>
      <ds:Reference URI="#Id-2e7c29c7-8645-4ad8-af59-06bed179d2fb">
          <ds:Transform Algorithm="">
        <ds:DigestMethod Algorithm=""></ds:DigestMethod>
        <wsse:Reference URI="#SecurityToken-24c152e3-26e0-d611-bb59-90b4c67d3be5"></wsse:Reference>

Now, an example of a user defined template:

<?xml version="1.0" encoding="UTF-8"?>
<Signature xmlns="">
      <CanonicalizationMethod Algorithm="" />
      <SignatureMethod Algorithm="" />
      <Reference URI="">
          <Transform Algorithm="" />
        <DigestMethod Algorithm="" />