Using the Generated WSDL

This WSDL can then be used by a web service consumer for generating the proxy classes and invoking the published methods. To create a web service application, you do not need any knowledge of XML, SOAP, or WSDL. For example, the Jade code for the getClient method is as follows.

getClient(clientName: String): Client;
vars
    client : Client;
begin
    client := app.myCompany.allClients[clientName];
    if client = null then
        setError(23, clientName, 'Client does not exist');
    endif;
    return client;
end;

A sample SOAP message for invoking this method would be as follows.

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:m0="urn:JadeWebServices/WebShop/22/07/03/">
   <SOAP-ENV:Header>
      <JadeSessionHeader>
         <m0:sessionId></m0:sessionId>
      </JadeSessionHeader>
   </SOAP-ENV:Header>
   <SOAP-ENV:Body>
      <m:getClient xmlns:m="urn:JadeWebServices/WebShop/22/07/03/">
         <m:clientName>Brian Olsen</m:clientName>
      </m:getClient>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

A sample SOAP response for this request would be as follows.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xmlns:xsd=http://www.w3.org/2001/XMLSchema
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
      <JadeSessionHeader xmlns="urn:JadeWebServices/WebShop/22/07/03/">
         <sessionId>7cbf601166a9240e</sessionId>
      </JadeSessionHeader>
   </soap:Header>
   <soap:Body>
      <getClientResponse xmlns="urn:JadeWebServices/WebShop/22/07/03/">
         <getClientResult>
            <address1>2834 The Palace</address1>
            <address2>San Diego</address2>
            <address3>United States of America</address3>
            <email>bo@wol.com</email>
            <fax>64 2 2930 9393</fax>
            <name>Brian Olsen</name>
            <phone>1 2 3848 8384</phone>
            <webSite>www.wol/olsen.com</webSite>
            <allRetailSales>
               <RetailSale>
                  <mySaleItem>
                     <fullDescription>Live in complete privacy and
                        luxury miles from civilisation. Land includes
                        helipad, satellite television and internet
                        connections.</fullDescription>
   <photo>/9j/4AAQSkZJRgABAgAAZABkAAD//gASQWRvYmUgSW1hZ2VSZWFkef/sABFEdWNre
      QABAAQAAAAyAAD/7gAOQWRvYmUAZMAAAAAB/9sAhAAIBgYGBgYIBgYIDAgHCAwOCggIC
      g4QDQ0ODQ0QEQwODQ0ODBEPEhMUExIPGBgaGhgYIyIiIiMnJycnJycnJycnAQkICAkKC
      QsJCQsOCw0LDhEODg4OERMNDQ4Nw/6rwu57t+GlpaWi+CCj8F//2Q==</photo>
                     <price>6250000.00</price>
                  </mySaleItem>
                  <price>6250000.00</price>
                  <timeStamp>2003-07-22</timeStamp>
               </RetailSale>
            </allRetailSales>
            <myCompany>
               <address1>Erewhon House</address1>
               <address2>Christchurch</address2>
               <address3>New Zealand</address3>
               <email>discover@jadeworld.com</email>
               <fax>(64) 3 555 1267</fax>
               <name>Erewhon Investments Inc</name>
               <phone>(64) 3 555 4519</phone>
               <webSite>www.jadeworld.com</webSite>
            </myCompany>
         </getClientResult>
      </getClientResponse>
   </soap:Body>
</soap:Envelope>

If there is a fault (for example, if there is a version mismatch), the following fault response message is sent.

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Sender</faultcode>
         <faultstring>Server Error</faultstring>
         <detail>
            <tns:faultDetails
               xmlns:tns="urn:JadeWebServices/WebShop/22/07/03/">
               <errorCode>11009</errorCode>
               <errorItem>Version Mismatch</errorItem>
               <errorText>
                  There is a version mismatch for the requested service -
                  Version requested: urn:JadeWebServices/WebShop/22/07/02/
                  Current version: urn:JadeWebServices/WebShop/22/07/03/
               </errorText>
            </tns:faultDetails>
         </detail>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>