Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 71d40963b505df4524269198e237b3e3 > files > 989

virtuoso-opensource-doc-6.1.4-2.fc14.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 <head profile="http://internetalchemy.org/2003/02/profile">
  <link rel="foaf" type="application/rdf+xml" title="FOAF" href="http://www.openlinksw.com/dataspace/uda/about.rdf" />
  <link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" />
  <meta name="dc.title" content="15. Web Services" />
  <meta name="dc.subject" content="15. Web Services" />
  <meta name="dc.creator" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="dc.copyright" content="OpenLink Software, 1999 - 2009" />
  <link rel="top" href="index.html" title="OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="search" href="/doc/adv_search.vspx" title="Search OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="parent" href="webservices.html" title="Chapter Contents" />
  <link rel="prev" href="warm.html" title="Web Services Reliable Messaging Protocol (WS-ReliableMessaging)" />
  <link rel="next" href="xmlxmla.html" title="XML for Analysis Provider" />
  <link rel="shortcut icon" href="../images/misc/favicon.ico" type="image/x-icon" />
  <link rel="stylesheet" type="text/css" href="doc.css" />
  <link rel="stylesheet" type="text/css" href="/doc/translation.css" />
  <title>15. Web Services</title>
  <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
  <meta name="author" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="copyright" content="OpenLink Software, 1999 - 2009" />
  <meta name="keywords" content="" />
  <meta name="GENERATOR" content="OpenLink XSLT Team" />
 </head>
 <body>
  <div id="header">
    <a name="vwstrust" />
    <img src="../images/misc/logo.jpg" alt="" />
    <h1>15. Web Services</h1>
  </div>
  <div id="navbartop">
   <div>
      <a class="link" href="webservices.html">Chapter Contents</a> | <a class="link" href="warm.html" title="Web Services Reliable Messaging Protocol (WS-ReliableMessaging)">Prev</a> | <a class="link" href="xmlxmla.html" title="XML for Analysis Provider">Next</a>
   </div>
  </div>
  <div id="currenttoc">
   <form method="post" action="/doc/adv_search.vspx">
    <div class="search">Keyword Search: <br />
        <input type="text" name="q" /> <input type="submit" name="go" value="Go" />
    </div>
   </form>
   <div>
      <a href="http://www.openlinksw.com/">www.openlinksw.com</a>
   </div>
   <div>
      <a href="http://docs.openlinksw.com/">docs.openlinksw.com</a>
   </div>
    <br />
   <div>
      <a href="index.html">Book Home</a>
   </div>
    <br />
   <div>
      <a href="contents.html">Contents</a>
   </div>
   <div>
      <a href="preface.html">Preface</a>
   </div>
    <br />
   <div class="selected">
      <a href="webservices.html">Web Services</a>
   </div>
    <br />
   <div>
      <a href="soap.html">SOAP</a>
   </div>
   <div>
      <a href="wsdl.html">WSDL</a>
   </div>
   <div>
      <a href="vfoafssl.html">WebID Protocol Support</a>
   </div>
   <div>
      <a href="voauth.html">OAuth Support</a>
   </div>
   <div>
      <a href="vwsssupport.html">WS-Security (WSS) Support in Virtuoso SOAP Server</a>
   </div>
   <div>
      <a href="ws-routing.html">Web Services Routing Protocol (WS-Routing)</a>
   </div>
   <div>
      <a href="warm.html">Web Services Reliable Messaging Protocol (WS-ReliableMessaging)</a>
   </div>
   <div class="selected">
      <a href="vwstrust.html">Web Services Trust Protocol (WS-Trust)</a>
   </div>
   <div>
      <a href="xmlxmla.html">XML for Analysis Provider</a>
   </div>
   <div>
      <a href="xmlrpc.html">XML-RPC support</a>
   </div>
   <div>
      <a href="syncml.html">SyncML</a>
   </div>
   <div>
      <a href="uddi.html">UDDI</a>
   </div>
   <div>
      <a href="expwsmodules.html">Exposing Persistent Stored Modules as Web Services</a>
   </div>
   <div>
      <a href="vsmx.html">Testing Web Published Web Services</a>
   </div>
   <div>
      <a href="bpel.html">BPEL Reference</a>
   </div>
   <div>
      <a href="xsql.html">XSQL</a>
   </div>
    <br />
  </div>
  <div id="text">
    <a name="vwstrust" />
    <h2>15.8. Web Services Trust Protocol (WS-Trust)</h2>

<p>In order to secure communication between two parties, the two parties
must exchange security credentials (either directly or indirectly).  However, each
party needs to determine if they can &quot;trust&quot; the asserted credentials of the
other party.  WS-Security defines the basic mechanisms for providing secure
SOAP messaging.
WS-Trust is an extension of WS-Security for security token exchange to enable
the issuance and dissemination of credentials within different trust domains, and
thus manage trust relationships.  The goal of WS-Trust is to enable applications
to construct trusted SOAP message exchanges. </p>

<p>Using these extensions, applications can engage in secure communication designed
to work with the general Web Services framework, including WSDL service
descriptions, UDDI businessServices and bindingTemplates, and SOAP messages. </p>

<p>WSS (WS-Security) enabled endpoint can make use of (WST) WS-Trust
by exposing the &quot;<span class="computeroutput">RequestSecurityToken</span>&quot; method.
It then will check the WSS headers, decode if appropriate and
pass the request parameters to the RequestSecurityToken method.</p>

<p>Virtuoso  supports and can generate many session key types.  Supported key
types are: DSA, 3des and AES.  RSA keys can be imported but not generated, likewise
x509 certificate generation, however they will be added in the near future.</p>

<p>WSS uses the <span class="computeroutput">UsernameToken</span> method
to bind an issued security token to a particular user.</p>

<p>Each WS enabled SOAP endpoint should have a list of supported encryption
methods, keys that may be issued, and authorized users.  This can be achieved using
a PL (Stored Procedure) hook.</p>

<div class="tip">
      <div class="tiptitle">See Also:</div>
  <p>
        <a href="http://www-106.ibm.com/developerworks/library/ws-trust/">Web Services Trust Language (WS-Trust)</a>
      </p>
    </div>

<p>The message flow involving WST endpoints will be as follows:</p>
  <ul>
      <li>The client (1st instance) must ask the WST endpoint for token
	(security token, may be a 3des key x509 certificate or whatever security
	tokens are supported)</li>
      <li>WST endpoint may or may not issue a token to the client.</li>
      <li>Client sends a message to 2nd instance (the target)
    to perform the main request.</li>
      <li>The 2nd instance (recipient) may accept or reject the request.</li>
      <li>The 2nd instance may also ask WST for the token, to
	encrypt the data for client, which depends on the policy to be applied.</li>
    </ul>

<p>The client has to have a way to know what policy to apply. This
can be a UDT that is initialized appropriately and passed to the client
routines.</p>

<p>SOAP clients have to have an API to perform:</p>

  <ul>
      <li>Request a security token from WST</li>
      <li>Invoke the method from recipient with token obtained from WST endpoint.</li>
    </ul>

<p>
      <a href="fn_wst_cli.html">wst_cli(req, policy)</a>
    </p>

<p>The call to <span class="computeroutput">wst_cli</span> performs the following actions:</p>

<ul>
      <li>For the URL of request determine whether a policy is needed; scan over
  policy array by URL. </li>
      <li>If token has an issuer, then ask issuer with policy conforming to it
  (obtain via URL from policy array).</li>
      <li>Apply the obtained token to the request and pass to the ultimate receiver.</li>
      <li>Return response from ultimate receiver.</li>
    </ul>

<p>Server tokens are stored in the
<span class="computeroutput">WST_SERVER_ISSUER_TOKENS</span> system table.</p>

<div class="tip">
      <div class="tiptitle">See Also:</div>
  <p>
        <a href="">WST_SERVER_ISSUER_TOKENS</a>
      </p>
    </div>

<p>Tokens can be selected using the system procedure: </p>

<div>
      <pre class="programlisting">
DB.DBA.WS_TRUST_TOKEN_GEN (
  in &quot;From&quot; any,
  in &quot;MessageID&quot; any,
  in &quot;RequestSecurityToken&quot; any,
  in &quot;Timestamp&quot; any,
  in &quot;To&quot; any).
</pre>
    </div>

<p>This procedure can be over-ridden for specific cases.  The definition of
the default procedure is shown below.  </p>

<div>
      <pre class="programlisting">
create procedure  DB.DBA.WS_TRUST_TOKEN_GEN (
  in &quot;From&quot; any,
  in &quot;MessageID&quot; any,
  in &quot;RequestSecurityToken&quot; any,
  in &quot;Timestamp&quot; any, in &quot;To&quot; any )
{
   declare ret any;
   declare t_type, r_type, l_from varchar;

   t_type := cast (&quot;RequestSecurityToken&quot;[3] as varchar);
   r_type := cast (&quot;RequestSecurityToken&quot;[5] as varchar);
   l_from := cast (&quot;From&quot;[3] as varchar);

   select WSK_TOKEN into ret from WST_SERVER_ISSUER_TOKENS
		where WSK_TOKEN_TYPE = t_type and
		  WSK_REQUEST_TYPE = r_type and WSK_FROM = l_from;

   return ret;
}
;
</pre>
    </div>

<a name="ex_wstrust1" />
    <div class="example">
      <div class="exampletitle">Example</div>

<p>1) client ask for context token token service:</p>

<div>
        <pre class="programlisting">
&lt;soap:Envelope
  xmlns:wsa=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;
  xmlns:wsu=&quot;http://schemas.xmlsoap.org/ws/2002/07/utility&quot;
  xmlns:wsse=&quot;http://schemas.xmlsoap.org/ws/2002/12/secext&quot;
  xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
    &lt;soap:Header&gt;
      &lt;wsa:To&gt;http://tokenservice&lt;/wsa:To&gt;
      &lt;wsse:Security soap:mustUnderstand=&quot;1&quot;&gt;
 	....
      &lt;/wsse:Security&gt;
    &lt;/soap:Header&gt;
    &lt;soap:Body wsu:Id=&quot;Id-d7fceab4-62ed-45fb-bc09-69310ff1712e&quot;&gt;
      &lt;wsse:RequestSecurityToken&gt;
        &lt;wsse:TokenType&gt;wsse:SecurityContextToken&lt;/wsse:TokenType&gt;
        &lt;wsse:RequestType&gt;wsse:ReqIssue&lt;/wsse:RequestType&gt;
        &lt;wsp:AppliesTo xmlns:wsp=&quot;http://schemas.xmlsoap.org/ws/2002/12/policy&quot;&gt;
          &lt;wsa:EndpointReference&gt;
            &lt;wsa:Address&gt;http://localhost/SecureConvPolicyService/SecureConvService.asmx&lt;/wsa:Address&gt;
          &lt;/wsa:EndpointReference&gt;
        &lt;/wsp:AppliesTo&gt;
      &lt;/wsse:RequestSecurityToken&gt;
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
</pre>
      </div>

<p>2) response from token service</p>

<div>
        <pre class="programlisting">
&lt;soap:Envelope xmlns:wsa=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;
  xmlns:wsu=&quot;http://schemas.xmlsoap.org/ws/2002/07/utility&quot;
  xmlns:wsse=&quot;http://schemas.xmlsoap.org/ws/2002/12/secext&quot;
  xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
    &lt;soap:Header&gt;
      &lt;wsse:Security soap:mustUnderstand=&quot;1&quot;&gt;
	....
      &lt;/wsse:Security&gt;
    &lt;/soap:Header&gt;
    &lt;soap:Body wsu:Id=&quot;Id-ee536e2b-3911-46c8-9a51-850b11ecf866&quot;&gt;
      &lt;xenc:EncryptedData xmlns:xenc=&quot;http://www.w3.org/2001/04/xmlenc#&quot;&gt;
        &lt;xenc:EncryptionMethod Algorithm=&quot;http://www.w3.org/2001/04/xmlenc#tripledes-cbc&quot; /&gt;
        &lt;xenc:CipherData&gt;
          &lt;xenc:CipherValue&gt;...&lt;/xenc:CipherValue&gt;
        &lt;/xenc:CipherData&gt;
      &lt;/xenc:EncryptedData&gt;
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
</pre>
      </div>

<p>3) using the token from response above ; perform request to the ultimate service</p>

<div>
        <pre class="programlisting">
&lt;soap:Envelope xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;
  xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;
  xmlns:wsa=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;
  xmlns:wsu=&quot;http://schemas.xmlsoap.org/ws/2002/07/utility&quot;
  xmlns:wsse=&quot;http://schemas.xmlsoap.org/ws/2002/12/secext&quot;&gt;
    &lt;soap:Header&gt;
      &lt;wsa:To&gt;http://quoteservice&lt;/wsa:To&gt;
      &lt;wsse:Security soap:mustUnderstand=&quot;1&quot;&gt;
	 ....
      &lt;/wsse:Security&gt;
    &lt;/soap:Header&gt;
    &lt;soap:Body wsu:Id=&quot;Id-a8a78a3b-6775-470d-96d8-ca3f96fd2715&quot;&gt;
      &lt;xenc:EncryptedData xmlns:xenc=&quot;http://www.w3.org/2001/04/xmlenc#&quot;&gt;
	...
      &lt;/xenc:EncryptedData&gt;
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
</pre>
      </div>

<p>4) response from ultimate service</p>

<div>
        <pre class="programlisting">
&lt;soap:Envelope xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;
  xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;
  xmlns:wsa=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;
  xmlns:wsu=&quot;http://schemas.xmlsoap.org/ws/2002/07/utility&quot;&gt;
    &lt;soap:Header&gt;
    &lt;/soap:Header&gt;
    &lt;soap:Body&gt;
      &lt;StockQuotes xmlns=&quot;http://temp.uri&quot;&gt;
        &lt;StockQuote&gt;
	...
        &lt;/StockQuote&gt;
	...
      &lt;/StockQuotes&gt;
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
</pre>
      </div>
</div>

<a name="ex_wst2" />
    <div class="example">
      <div class="exampletitle">Full WS-Trust Programmatic Sample</div>

<p>Table for sample results</p>

<div>
        <pre class="programlisting">
create table WS_S_5 (
	ID 	varchar primary key,
	LINK	varchar,
	TITLE	varchar,
	AUTHOR	varchar,
	ISSUED  datetime,
	CONTENT varchar
)
;
</pre>
      </div>

<p>User used for UsernameToken</p>

<div>
        <pre class="programlisting">
create user WS_TRUST;
USER_SET_PASSWORD (&#39;WS_TRUST&#39;, &#39;TRUST_PASSWORD&#39;);
</pre>
      </div>

<p>Endpoint user</p>

<div>
        <pre class="programlisting">
create user WSE;
</pre>
      </div>

<p>client test procedure</p>

<div>
        <pre class="programlisting">
create procedure trust_client ()
{
   declare token POLICY_STRUCT;
   declare req SOAP_CLIENT_REQ;
   declare ret any;

   token := new POLICY_STRUCT ();
   req := new SOAP_CLIENT_REQ ();

   -- Issuer parameters

   token.usage := &#39;ReqIssue&#39;;
   token.token_type := &#39;X509v3&#39;;
   token.token_issuer := &#39;http://localhost:&#39; || server_http_port () || &#39;/ws_s_5ts&#39;;
   token.user_name := &#39;WS_TRUST&#39;;
   token.user_pass := &#39;TRUST_PASSWORD&#39;;
   token.debug := 0;

   -- End point parameters

   req.url := &#39;http://localhost:&#39; || server_http_port () || &#39;/ws_s_5&#39;;
   req.parameters := vector (vector (&#39;AddEntry&#39;, &#39;http://weblogs.contoso.com/wse/samples/2003/07:AddEntry&#39;),
		     vector (soap_box_structure (&#39;title&#39;, &#39;Test title&#39;, &#39;author&#39;, &#39;Test author&#39;, &#39;issued&#39;, now (),
						 &#39;content&#39;, &#39;Test content&#39;)));

   req.soap_action := &#39;http://weblogs.contoso.com/wse/samples/2003/07:AddEntry&#39;;
   req.operation := &#39;AddEntry&#39;;

   ret := WST_CLI (req, token);  -- call the WS-Trust client.

   if (token.debug &lt;&gt; 0)
     return ret;

   -- Fill result to table

   insert into WS_S_5 (ID, LINK, TITLE, AUTHOR, ISSUED, CONTENT) values
		(ret[2][2][1], ret[2][4][1], ret[2][6][1], ret[2][8][1], ts (ret[2][10][1]), ret[2][12][1]);
}
;
</pre>
      </div>

<p>End point virtual directory</p>

<div>
        <pre class="programlisting">
VHOST_REMOVE (lpath=&gt;&#39;/ws_s_5&#39;);

VHOST_DEFINE (lpath=&gt;&#39;/ws_s_5&#39;, ppath=&gt;&#39;/SOAP/&#39;, soap_user=&gt;&#39;WSE&#39;,
              soap_opts=&gt;vector(&#39;Namespace&#39;,&#39;http://temp.uri/&#39;,
		                &#39;MethodInSoapAction&#39;,&#39;yes&#39;,
				&#39;ServiceName&#39;, &#39;WSSecure&#39;,
				&#39;CR-escape&#39;, &#39;no&#39;,
				&#39;WS-SEC&#39;,&#39;yes&#39;,
				&#39;WSS-Type&#39;, 0,
				&#39;WSS-Validate-Signature&#39;, 2,
				&#39;WSS-Func-Template&#39;, &#39;DB.DBA.SOAP_WS_TRUST_OUT_XENC_TEMPLATE&#39;))
;
</pre>
      </div>

<p>Issuer virtual directory</p>

<div>
        <pre class="programlisting">
VHOST_REMOVE (lpath=&gt;&#39;/ws_s_5ts&#39;);

VHOST_DEFINE (lpath=&gt;&#39;/ws_s_5ts&#39;, ppath=&gt;&#39;/SOAP/&#39;, soap_user=&gt;&#39;WSE&#39;,
              soap_opts=&gt;vector(&#39;Namespace&#39;,&#39;http://temp.uri/&#39;,
		                &#39;MethodInSoapAction&#39;,&#39;yes&#39;,
				&#39;ServiceName&#39;, &#39;WSSecure&#39;,
				&#39;CR-escape&#39;, &#39;no&#39;,
				&#39;WS-SEC&#39;,&#39;yes&#39;,
				&#39;WSS-KEY&#39;, &#39;ws_s_5&#39;,
				&#39;WSS-Template&#39;, &#39;ws_s_5&#39;,
				&#39;WSS-Type&#39;, 0,
				&#39;WSS-Validate-Signature&#39;, 2,
				&#39;WSS-Func-Template&#39;, &#39;DB.DBA.SOAP_WS_TRUST_OUT_XENC_TEMPLATE&#39;))
;

grant execute on WS.SOAP.RequestSecurityToken to WSE
;

CREATE PROCEDURE WS_S_5_XSD ()
{
  declare ses any;
  ses := string_output ();
  http (&#39;&lt;xsd:schema\n&#39;, ses);
  http (&#39;    xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;\n&#39;, ses);
  http (&#39;    xmlns:tns=&quot;http://weblogs.contoso.com/wse/samples/2003/07&quot;\n&#39;, ses);
  http (&#39;    targetNamespace=&quot;http://weblogs.contoso.com/wse/samples/2003/07&quot;&gt;\n&#39;, ses);
  http (&#39;    &lt;xsd:element name=&quot;AddEntry&quot;&gt;\n&#39;, ses);
  http (&#39;	&lt;xsd:complexType&gt;\n&#39;, ses);
  http (&#39;	    &lt;xsd:sequence&gt;\n&#39;, ses);
  http (&#39;		&lt;xsd:element name=&quot;entry&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot; type=&quot;tns:entry_t&quot; /&gt;\n&#39;, ses);
  http (&#39;	    &lt;/xsd:sequence&gt;\n&#39;, ses);
  http (&#39;	&lt;/xsd:complexType&gt;\n&#39;, ses);
  http (&#39;    &lt;/xsd:element&gt;\n&#39;, ses);
  http (&#39;    &lt;xsd:element name=&quot;WeblogEntry&quot;&gt;\n&#39;, ses);
  http (&#39;	&lt;xsd:complexType&gt;\n&#39;, ses);
  http (&#39;	    &lt;xsd:sequence&gt;\n&#39;, ses);
  http (&#39;		&lt;xsd:element name=&quot;WeblogEntry&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot; type=&quot;tns:entry_t&quot; /&gt;\n&#39;, ses);
  http (&#39;	    &lt;/xsd:sequence&gt;\n&#39;, ses);
  http (&#39;	&lt;/xsd:complexType&gt;\n&#39;, ses);
  http (&#39;    &lt;/xsd:element&gt;\n&#39;, ses);
  http (&#39;    &lt;xsd:element name=&quot;AddEntryResponse&quot;&gt;\n&#39;, ses);
  http (&#39;	&lt;xsd:complexType&gt;\n&#39;, ses);
  http (&#39;	    &lt;xsd:sequence&gt;\n&#39;, ses);
  http (&#39;		&lt;xsd:element name=&quot;WeblogEntry&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot; type=&quot;tns:entry_t&quot; /&gt;\n&#39;, ses);
  http (&#39;	    &lt;/xsd:sequence&gt;\n&#39;, ses);
  http (&#39;	&lt;/xsd:complexType&gt;\n&#39;, ses);
  http (&#39;    &lt;/xsd:element&gt;\n&#39;, ses);
  http (&#39;    &lt;xsd:complexType name=&quot;entry_t&quot;&gt;\n&#39;, ses);
  http (&#39;	    &lt;xsd:sequence&gt;\n&#39;, ses);
  http (&#39;		&lt;xsd:element name=&quot;id&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot; type=&quot;xsd:string&quot; /&gt;\n&#39;, ses);
  http (&#39;		&lt;xsd:element name=&quot;link&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot; type=&quot;xsd:string&quot; /&gt;\n&#39;, ses);
  http (&#39;		&lt;xsd:element name=&quot;title&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot; type=&quot;xsd:string&quot; /&gt;\n&#39;, ses);
  http (&#39;		&lt;xsd:element name=&quot;author&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot; type=&quot;xsd:string&quot; /&gt;\n&#39;, ses);
  http (&#39;		&lt;xsd:element name=&quot;issued&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot; type=&quot;xsd:dateTime&quot; /&gt;\n&#39;, ses);
  http (&#39;		&lt;xsd:element name=&quot;content&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot; type=&quot;xsd:string&quot; /&gt;\n&#39;, ses);
  http (&#39;	    &lt;/xsd:sequence&gt;\n&#39;, ses);
  http (&#39;    &lt;/xsd:complexType&gt;\n&#39;, ses);
  http (&#39;&lt;/xsd:schema&gt;\n&#39;, ses);
  return string_output_string (ses);
}
;
</pre>
      </div>

<p>XSD used from end point</p>

<div>
        <pre class="programlisting">
SOAP_LOAD_SCH (WS_S_5_XSD ())
;
</pre>
      </div>

<p>End point procedure</p>

<div>
        <pre class="programlisting">
create procedure WS.SOAP.AddEntry
(
in  AddEntry any := null __soap_type &#39;http://weblogs.contoso.com/wse/samples/2003/07:AddEntry&#39;,
out AddEntryResponse any __soap_type &#39;http://weblogs.contoso.com/wse/samples/2003/07:AddEntryResponse&#39;,
inout &quot;From&quot; any __soap_header &#39;http://schemas.xmlsoap.org/ws/2004/08/addressing:From&#39;,
inout &quot;MessageID&quot; any __soap_header &#39;http://schemas.xmlsoap.org/ws/2004/08/addressing:MessageID&#39;,
  out &quot;Timestamp&quot; any __soap_header &#39;http://schemas.xmlsoap.org/ws/2002/07/utility:Timestamp&#39;,
inout &quot;To&quot; any __soap_header &#39;http://schemas.xmlsoap.org/ws/2004/08/addressing:To&#39;
) __soap_doc &#39;__VOID__&#39;

{
   declare ret any;
   declare param any;
   declare wsa_from, wsu_time, created, expr, m_id, a_to, headers soap_parameter;
   declare in_title, in_author, in_content, out_id, out_link any;

   in_title := get_keyword (&#39;title&#39;, AddEntry[0], &#39;&#39;);
   in_author := get_keyword (&#39;author&#39;, AddEntry[0], &#39;&#39;);
   in_content := get_keyword (&#39;content&#39;, AddEntry[0], &#39;&#39;);

   out_id := lower (uuid ());
   out_link := sys_connected_server_address () || &#39;/ws-trust/sample?&#39; || out_id;

   wsa_from := new soap_parameter ();
   wsa_from.set_xsd (&#39;http://schemas.xmlsoap.org/ws/2004/08/addressing:From&#39;);
   wsa_from.add_member (&#39;Address&#39;, &#39;http://&#39; || sys_connected_server_address () || &#39;/WSE&#39;);
   wsa_from.set_attribute (&#39;Id&#39;, &#39;Id-&#39; || uuid());

   created := new soap_parameter (dt_set_tz (now (), 0));
   created.set_xsd (&#39;http://schemas.xmlsoap.org/ws/2002/07/utility:Created&#39;);
   created.set_attribute (&#39;Id&#39;, &#39;Id-&#39; || uuid());

   expr := new soap_parameter (dt_set_tz (dateadd (&#39;minute&#39;, 500, now ()), 0));
   expr.set_xsd (&#39;http://schemas.xmlsoap.org/ws/2002/07/utility:Expires&#39;);
   expr.set_attribute (&#39;Id&#39;, &#39;Id-&#39; || uuid());

   wsu_time := new soap_parameter ();
   wsu_time.set_xsd (&#39;http://schemas.xmlsoap.org/ws/2002/07/utility:Timestamp&#39;);
   wsu_time.add_member (&#39;Created&#39;, created);
   wsu_time.add_member (&#39;Expires&#39;, expr);

   m_id := new soap_parameter (lower (&#39;UUID:&#39;||uuid ()));
   m_id.set_xsd (&#39;http://schemas.xmlsoap.org/ws/2004/08/addressing:MessageID&#39;);
   m_id.set_attribute (&#39;Id&#39;, &#39;Id-&#39; || uuid());

   a_to := new soap_parameter (&#39;http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous&#39;);
   a_to.set_xsd (&#39;http://schemas.xmlsoap.org/ws/2004/08/addressing:To&#39;);
   a_to.set_attribute (&#39;Id&#39;, &#39;Id-&#39; || uuid());

   param :=  (vector (&#39;WeblogEntry&#39;, &#39;http://weblogs.contoso.com/wse/samples/2003/07:AddEntry&#39;),
	      vector (soap_box_structure (&#39;id&#39;, out_id,
					  &#39;link&#39;, out_link,
					  &#39;title&#39;, in_title,
					  &#39;author&#39;, in_author,
					  &#39;issued&#39;, now (),
					  &#39;content&#39;, in_content)));

    AddEntryResponse := param;
    &quot;From&quot; := wsa_from.s;
    &quot;MessageID&quot; := m_id.s;
    &quot;Timestamp&quot; := wsu_time.s;
    &quot;To&quot; := a_to.s;
}
;

grant execute on WS.SOAP.AddEntry to WSE;
</pre>
      </div>

<p>Server enc. template. Can be over-ridden</p>

<div>
        <pre class="programlisting">
create procedure
DB.DBA.SOAP_WS_TRUST_OUT_XENC_TEMPLATE (in body varchar)
{
  declare tmpl varchar;

  tmpl := sprintf (&#39;&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;Signature xmlns=&quot;http://www.w3.org/2000/09/xmldsig#&quot; &gt;
  &lt;SignedInfo&gt;
    &lt;CanonicalizationMethod Algorithm=&quot;http://www.w3.org/2001/10/xml-exc-c14n#&quot; /&gt;
    &lt;SignatureMethod Algorithm=&quot;http://www.w3.org/2000/09/xmldsig#rsa-sha1&quot; /&gt;
  &lt;/SignedInfo&gt;
  &lt;SignatureValue&gt;&lt;/SignatureValue&gt;
  &lt;KeyInfo&gt;
    &lt;KeyName&gt;ws_s_5&lt;/KeyName&gt;
  &lt;/KeyInfo&gt;
&lt;/Signature&gt;&#39;);

  return dsig_template_ext (body, tmpl,
      &#39;http://schemas.xmlsoap.org/soap/envelope/&#39;, &#39;Body&#39;,
      &#39;http://schemas.xmlsoap.org/ws/2004/08/addressing&#39;, &#39;MessageID&#39;,
      &#39;http://schemas.xmlsoap.org/ws/2004/08/addressing&#39;, &#39;From&#39;,
      &#39;http://schemas.xmlsoap.org/ws/2004/08/addressing&#39;, &#39;RelatesTo&#39;,
      &#39;http://schemas.xmlsoap.org/ws/2004/08/addressing&#39;, &#39;To&#39;,
      &#39;http://schemas.xmlsoap.org/ws/2002/07/utility&#39;, &#39;Expires&#39;,
      &#39;http://schemas.xmlsoap.org/ws/2002/07/utility&#39;, &#39;Created&#39;
      );

}
;
</pre>
      </div>

<p>Certificate from server</p>

<div>
        <pre class="programlisting">
create procedure cert ()
{
    return uudecode (
   &#39;MIIKIQIBAzCCCecGCSqGSIb3DQEHAaCCCdgEggnUMIIJ0DCCBs8GCSqGSIb3&#39; ||
   &#39;DQEHBqCCBsAwgga8AgEAMIIGtQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYw&#39; ||
   &#39;DgQIYR9Q5x78Es4CAggAgIIGiHRAz7QEEk6jrI3un28yD7YOO3G+Sm33abCa&#39; ||
   &#39;jCwA3x5lT4ShZxaRrIB5Xaykr4gfTWwa3+/eFFwqaHdae9XNAjsOCvWYftFU&#39; ||
   &#39;mRpxwJcuY0C1yOlMxG2SyLSJNDEGY8p/uY9Okw5e5iQuzMEvDxaU+j2PSum+&#39; ||
   &#39;QWg94obEAJkwmCqelMwKH7aVGlFNtkphGbrl8egJzfJUCIqC6vsMYA6KSurN&#39; ||
   &#39;Nv05Vk2/w9Av7q2DrkSfqNMOgYluZ+OKzbTnSq2kg42F/Qd9qJye3iUusi1j&#39; ||
   &#39;bcIqZBCFddIFNUR+Yxa/GWD720DngBquiagqaO5Tm0vvORk/hhLx3x4cJRra&#39; ||
   &#39;4CFHswtVSq8JHDgyF6goMifHPsv9HTnK5r3MzQFQVITS/26NCcoj3vf9G/ka&#39; ||
   &#39;fRZZCAtD14lRYvENoDBFZfjUfrbHTT7VrcXbDfhYuXopUMa/Zr6fJM8ELNgE&#39; ||
   &#39;QmAttT4+fEnL9tNaY3VRQVkxCAl+2dvZsOqNDOh8RqaeeEumPgNUKtGr6ppW&#39; ||
   &#39;DXIOAg3L8r/0CwDEQArNh1HZ+SQ5leUyswsnkDG9PY3LGdqYCJJDnhoxeDla&#39; ||
   &#39;hqlYmqjytyfkL96768CU5wL9eck+jKNySy3foDNKu0yVZVSvO4BP38OE+hzK&#39; ||
   &#39;4QrmFdSztousIgTw6fe73FmLgHMjrMTlp3OFXG0krH7AZvaxYvi0Xy6+g2zJ&#39; ||
   &#39;xOttT9O0kNYAt7tVk15n4/tkjlF/meS4Dhu8TnHTjTMX+kljYlNTsEewzn5r&#39; ||
   &#39;NfXQY0RMZa/zw8lS2G/vfT71UyCACPl/SYxkSYUht8kvZCc4L3Z0460IszpC&#39; ||
   &#39;+nQ9YFDLQqYX7VToVyKoGQWEfHN4z8FFoYHXY/e2NNacfZkBwhq7wfh4upWG&#39; ||
   &#39;kjHnDE2LC1EHSkPcdmeZoPZcXXve5/WZyPQEM3h5+rLca1F67lyD8a57nh2E&#39; ||
   &#39;7m916TO64V4mIfxjFwxZO+LF/MzRJDXyUlGWiHV2w363TIbgc6vD1/sed0yP&#39; ||
   &#39;xg6mTpFTkThj7mMcDFh5jO7p7JXeJU8v/uls7pb/HbfGcsSfXEHQcHSLqwM/&#39; ||
   &#39;kWk6KQRxvj+9wl7zglyrCU5ty3/0i5SOb4BL4DMtGeaLXgbhScczA26kmhSN&#39; ||
   &#39;C9wuB535TE9X/msXxjKqJclRC/nQicsIJEpoilwKKh0lt39J5mQwpk/By7du&#39; ||
   &#39;qspLZzEfXhcQlrNVJa6cTM14GuMMh3RqPK2AvxxVbwvSmBRxDDX4Wq+E7AsY&#39; ||
   &#39;onr322L3YHAS+oRIp7onKJyHv4J8M26iRSRCl11Jtt3lKcSEHtQIO1hS+BOR&#39; ||
   &#39;1yAXJ+AOhvufpCqbOwV12Tw+wCUXVDrRdpaGL+laoNaqC7heo6HZkWFy6SSm&#39; ||
   &#39;CUbKhtk6P0IE8Db0GdIF3jzLGvKreFiiBKkwFI1g4+C9j2BaPL1F4JMmoEaa&#39; ||
   &#39;eFrLqtd66g6/n0zSxkA43H3qqfGTQJ/YkilRvuqZ3pNN9sklR2n7ti44TSb+&#39; ||
   &#39;LZofLerppJxgcJgT67wD7Mt58pekjnOKW2HwPt8hegrQh6juBHaFxn/BIZuh&#39; ||
   &#39;VivCCsfY2V/sZBl/uL9qvevnoQXKrvOks0XESRTpqc3PptgQdFTkUST3vc6o&#39; ||
   &#39;CtrLSyK6rLNVI5bP2QRuCQAPyhI9u6s6AC1uot9T/BooOLowzzpNLioWstsB&#39; ||
   &#39;Td9+64Ei1bvcmIZZ2Gq3p/gAXYnkw/VciQ/YET54nP95wUYSrbB8OLXJHPX6&#39; ||
   &#39;zaLryqbpPIcNSvGjneSf84a0NkMFkdq5H4m0lJQIJPIvi7qhGxpNGYEuaqgv&#39; ||
   &#39;NwGmhWKK4noHLuXIMOv5Cn10MHTaR7CVxOLX950RzitmIQ9xa7Qu2Ey+wzRM&#39; ||
   &#39;LvoxUf1+GMUCGyuVhQlCRmfCK7ts53WTCLywNsJcueImaLTjXOOoJNg1Baov&#39; ||
   &#39;C+RYwAvigUtp1aBY9XZRHMqHytLooGhPG/xgX1Mhe+1452YSutxIww+psC5E&#39; ||
   &#39;9LAkBMZ7mz9o6JJnk3IvJ+WhAZ+hV876T7yABTifxctfkOmNu3H/RcpDV4uk&#39; ||
   &#39;TZizoDttm3/Mj99V9U+elt/1YreXvB5kJ63o9nOeN3gBu8mEBhqGLGOWuibL&#39; ||
   &#39;RANKQ1es3jVGk5SMS0bi8BeG6nGw59xna1BZcpS3KnbgWdU4ek7mz+OO0fHe&#39; ||
   &#39;tQPGQ1pI0FA/UTBEoRUokZPjGlELL9su7bcAbgpTTS0vncGzUwO5yxRExFh7&#39; ||
   &#39;PJPVMmjrOphChDvBlgUESq9J9CmEUswp+IEwggL5BgkqhkiG9w0BBwGgggLq&#39; ||
   &#39;BIIC5jCCAuIwggLeBgsqhkiG9w0BDAoBAqCCAqYwggKiMBwGCiqGSIb3DQEM&#39; ||
   &#39;AQMwDgQIBnHBzK4ZZwwCAggABIICgO8D5hIqZZLOZmVMCWdTayS0joeE1W6H&#39; ||
   &#39;7J/IiiP3N5EQeALNvVaoI6EeNuap3W8lj89moUzCuScokct7jRaLOhjeOeRa&#39; ||
   &#39;osMRMOvdbSSIFS+QN/CT1mQ46+LeNuFocCW0M0RsFVgcSPdWuJUJzOq9qx7J&#39; ||
   &#39;XjkG8UHfwpjy1o9JZAqtjde+fNFHiuPLYI3oJBwNGfbe1QJlrVjf+MAziu6J&#39; ||
   &#39;iGt+QBNfWWLoFgDZegHWLcfwwXkmrzfM/4KIGEjX2DZhBrf5M5r+P6ZDJFFs&#39; ||
   &#39;NNNmUUjVvtz+PQIlVWrBJxh5r0Yyr/n37g2pEGKcq5PNxP+DZ1H/UCEObUzk&#39; ||
   &#39;H8afcU7uUq43t0Eyq4cs8VX7pytIoUgvMT5bcs0aU8gs9b3c33BjRv7uTB7q&#39; ||
   &#39;qTGaAQ+b4t5vAR/MVoHfVA1Sgq0D8mzJ8NtD6IMdbjsW0cSxwZM/pgPDmSI9&#39; ||
   &#39;AKi6t9E/UrzxwaJWBmEgy2Qup5n6VrxzWZ+TiAKAH4/Ma3kIUkYtgvrAH9Tf&#39; ||
   &#39;qY/7ZOHIVF93aEEcIshYYVyUAHsJVa1r7LXkfcm7ogxDi8vjmvtDZhxo7+i8&#39; ||
   &#39;TmrsO19FoDSGUNJlYFvPsGpOpnrw/VT7M9VEhF9nSznRRlDD+xidZdWf2GDe&#39; ||
   &#39;MxLg+7dLMkKqYgQbWKRO6y6ATJbSL+0wBRml1h5hvIhK+PsJeDHcVf3rl5my&#39; ||
   &#39;NZgBlFkHau9/2WohA428dwKDgFVFjgt8WfsweOW6QCYL5ezjtORDRZHg3YQL&#39; ||
   &#39;ZrB7jSJkx9WFq5O81YT5YqVvcDow7aoPpKJvZtFUkPPtgMTyIz6zOTCC9sTe&#39; ||
   &#39;lHu6m/Olizb3o/uOlxlcK3727SHSiBV8+4rhgIstIlYxJTAjBgkqhkiG9w0B&#39; ||
   &#39;CRUxFgQUjYbSw3MD4nRuny8vVKz5hZtCftwwMTAhMAkGBSsOAwIaBQAEFLRv&#39; ||
   &#39;tU3dr9bQEbcm2mcYE+KK33n3BAh/OvyukQvZpAICCAA=&#39;, 2);
}
;

create procedure server_pub_x509_key ()
{
  return
   &#39;MIICxzCCAjCgAwIBAgIBADANBgkqhkiG9w0BAQQFADBSMQswCQYDVQQGEwJCRzEQMA4GA1UE&#39; ||
   &#39;CBMHUGxvdmRpdjEQMA4GA1UEBxMHUGxvdmRpdjEfMB0GA1UEChMWT3BlbkxpbmsgU29mdHdh&#39; ||
   &#39;cmUgTHRkLjAeFw0wNDAxMjExNDA4MzhaFw0wNTAxMjAxNDA4MzhaMFIxCzAJBgNVBAYTAkJH&#39; ||
   &#39;MRAwDgYDVQQIEwdQbG92ZGl2MRAwDgYDVQQHEwdQbG92ZGl2MR8wHQYDVQQKExZPcGVuTGlu&#39; ||
   &#39;ayBTb2Z0d2FyZSBMdGQuMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDp4LEkZOl/Nbve&#39; ||
   &#39;sKUYbJkYS615oB0nPbu3n0dCCC37xswbluBQcS+P/zHdvQZaWzWsluGpGctHzTYcD7+UkiLJ&#39; ||
   &#39;Xrd+PddqkgfogqaW7/9jB2CJSA1paoJTqX6b06/KOi4Jj1WYHwkGOfiD+WybUWcX65gtaM52&#39; ||
   &#39;OUoenVOy7v5zrwIDAQABo4GsMIGpMB0GA1UdDgQWBBTrS3v9pmTo/jCtrd9+7FBESXGVHDB6&#39; ||
   &#39;BgNVHSMEczBxgBTrS3v9pmTo/jCtrd9+7FBESXGVHKFWpFQwUjELMAkGA1UEBhMCQkcxEDAO&#39; ||
   &#39;BgNVBAgTB1Bsb3ZkaXYxEDAOBgNVBAcTB1Bsb3ZkaXYxHzAdBgNVBAoTFk9wZW5MaW5rIFNv&#39; ||
   &#39;ZnR3YXJlIEx0ZC6CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQCCzqtd0ej6&#39; ||
   &#39;f5NSORqyLlJ90L1FPAiF1lg+dFSatMpxbv6zPTK9qnHp3VWK0cPwK1GxxC3B2QyuhCIkeRs7&#39; ||
   &#39;qymH8S6W9maUMIvLD1dDQFxKStgxJe0IDEIG9CygaDGsTpkPwq/qPqhRGamGeLO9GU8wPnUN&#39; ||
   &#39;OleyHzY8Y4ZkCznSFQ==&#39;;
}
;
</pre>
      </div>

<p>Fill server public key to table.</p>

<div>
        <pre class="programlisting">
insert soft WST_SERVER_ISSUER_TOKENS (WSK_TOKEN_TYPE, WSK_REQUEST_TYPE, WSK_APPLIES_TO, WSK_FROM,
					   WSK_SERVICE_NAME, WSK_PORT_TYPE, WSK_TOKEN) values
		 (&#39;wsse:X509v3&#39;, &#39;wsse:ReqIssue&#39;, NULL,
		  &#39;http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous&#39;, NULL, NULL,
		   server_pub_x509_key ())
;
</pre>
      </div>

<p>Upload the server certificate</p>

<div>
        <pre class="programlisting">
USER_KEY_LOAD (&#39;ws_s_5&#39;, cert(), &#39;X.509&#39;, &#39;PKCS12&#39;, &#39;ws_s_5&#39;, null, 1)
;

reconnect WSE
;
</pre>
      </div>

<p>Upload the client certificate</p>

<div>
        <pre class="programlisting">
USER_KEY_LOAD (&#39;ws_s_5&#39;, cert(), &#39;X.509&#39;, &#39;PKCS12&#39;, &#39;ws_s_5&#39;, null, 1)
;

checkpoint
;
</pre>
      </div>
</div>
<table border="0" width="90%" id="navbarbottom">
    <tr>
        <td align="left" width="33%">
          <a href="warm.html" title="Web Services Reliable Messaging Protocol (WS-ReliableMessaging)">Previous</a>
          <br />Web Services Reliable Messaging Protocol (WS-ReliableMessaging)</td>
     <td align="center" width="34%">
          <a href="webservices.html">Chapter Contents</a>
     </td>
        <td align="right" width="33%">
          <a href="xmlxmla.html" title="XML for Analysis Provider">Next</a>
          <br />XML for Analysis Provider</td>
    </tr>
    </table>
  </div>
  <div id="footer">
    <div>Copyright© 1999 - 2009 OpenLink Software All rights reserved.</div>
   <div id="validation">
    <a href="http://validator.w3.org/check/referer">
        <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" />
    </a>
    <a href="http://jigsaw.w3.org/css-validator/">
        <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" height="31" width="88" />
    </a>
   </div>
  </div>
 </body>
</html>