You have seen how to use the package soap of the XSQL language to perform calls to web services. Through the tag <soap.call> you can interact as clients of web services. A common scenario can be communicated with web services of another server Axional Studio. How you will know Axional Studio. includes a group of web services very flexibles which includes:

SOAPAPPServer : which allows to execute petitions of application.

SOAPOBJServer : which allows to execute SQL objects.

SOAPSQLServer : which allows to execute SQL sentences ans process transactions.

The value of the attribute uri will depend of the service which will be invoked, usually from this function you can call any available SOAP service.

1 Axional Studio Service SOAP call: SOAPAPPServer

The service SOAPAPPServer allows to interact with the system of application. It disposes of several methodes which allows to determine the servers to which a user has access, the databases to which a user has access inside the server, etc.

Copy
<xsql-script name='soap_sample1'>
    <body>
        <set name='m_response'>
            <soap.call
                url='http://web1:80/soap/servlet/rpcrouter'
                uri='urn:SOAPAPPServer'
                method='getServers'
                user='demo'
                password='abcdemo'
                >
            </soap.call>
        </set>

        <println>
            <dom.node.getOwnerDocument><m_response/></dom.node.getOwnerDocument>
        </println>

    </body>
</xsql-script>

The HTTP message which will be generated this petition has the following format.

Copy
POST /soap/servlet/rpcrouter HTTP/1.0
Host: localhost:80
Content-Type: text/xml; charset=utf-8
Content-Length: 410
SOAPAction: ""
Authorization: Basic ZGVtbzphYmNkZW1v

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <SOAP-ENV:Body>
        <ns1:getServers xmlns:ns1="urn:SOAPAPPServer" SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml">
        </ns1:getServers>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The HTTP message which will be generated as response has the following format.

Copy
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Body>
        <ns1:getServersResponse SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml" xmlns:ns1="urn:SOAPAPPServer">
        <return>
            <array name="DB servers">
                <server>dbsrv1</server>
            </array>
        </return>
        </ns1:getServersResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

2 Axional Studio Service SOAP call: SOAPOBJServer

Below it is shown an example of script which uses SOAP and DOM. The objective of this script is invoke a SQL object to produce a balance in fo format. Once the content is received in the asked format, it is converted to pdf and it is remitted by email.

The call to the SOAPOBJServer service will incoke the methode of the service with the signature.

Copy
execute(String dbms, String code, String cond, Hashtable<String, Object> cols, Hashtable<String, Object> vars, String type, boolean gzip)

So, the script must be able to supply the objects of the Hashtable type as it will be seen in the example.

Copy
<xsql-script name='soap_sample1'>
    <body>
        <set name='m_response'>
            <soap.call
                url='http://localhost:80/soap/servlet/rpcrouter'
                uri='urn:SOAPOBJServer'
                method='execute'
                user='demo'
                password='abcdemo'
                >
                <parameters>
                    <parameter name='database'>demo_sports1</parameter>
                    <parameter name='objcode'>cbal_a_sal_p_nivel</parameter>
                    <parameter name='cond'><string/></parameter>
                    <parameter name='cols'>
                        <map.toHashtable>
                            <map>
                                <item><string>csaldos.cuenta</string><string>[67]*</string></item>
                            </map>
                        </map.toHashtable>
                    </parameter>
                    <parameter name='vars'>
                        <map.toHashtable>
                            <map>
                                <item><string>NIVEL</string><string>1</string></item>
                                <item><string>EXERCI</string><string>2004</string></item>
                                <item><string>PERINI</string><string>1</string></item>
                                <item><string>PERFIN</string><string>12</string></item>
                            </map>
                        </map.toHashtable>
                    </parameter>
                    <parameter name='type'>fo-xml</parameter>
                </parameters>
            </soap.call>
        </set>

        <!--
        * In the response you have the following
        <objresponse date="Tue Nov 21 11:43:04 CET 2006" host="localhost">
           * This is the firstChild			
           <object code="cbal_a_sal_p_nivel" dbms="demo_sports1" encoding="ISO-8859-1" glob=".xml" gzip="false" lang="es-ES" size="8363" type="fo-xml">
              * The response is coded in Base64.
              * If a PDF type would have been requested directly, the content would be already the processed PDF
              PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nSVNPLTg4NTktMSc/Pgo8Zm86cm9vdCB4bWxuczpmbz0naHR0cDovL3d3dy53My5vcmcvMTk5OS9YU0wvRm9ybWF0Jz4KCTxmb
              ...

        -->

        <set name='m_object'><dom.node.getFirstChildElement><m_response/></dom.node.getFirstChildElement></set>
        <set name='m_fo_base64'><dom.node.getChildCharacterData><m_object/></dom.node.getChildCharacterData></set>
        <set name='m_fo'><byte.decode type='BASE64'><string.getBytes><m_fo_base64/></string.getBytes></byte.decode></set>
		
        <file.out.open id='out1'>
            <file name='balance.pdf' type='temp' />
        </file.out.open>
        
        <file.out.println id='out1'>
            <file.getBytes>
            	<fop.transform type='pdf'><m_fo/></fop.transform>
            </file.getBytes>
        </file.out.println>

        <file.out.close id='out1'/>

        <mail
            smtphost='mail.deister.net'
            from='from@deister.es'
            to='to@deister.es'
            subject='Balance'
            >
            <content>See attached file.</content>
            <attachs>
                <mail.attach type='application/pdf'><file name='balance.pdf' type='temp' /></mail.attach>
            </attachs>

        </mail>        

    </body>
</xsql-script>}]></code> 
        <p>The HTTP messahe which will generate this petition has the following format.</p>
<code><![CDATA[POST /soap/servlet/rpcrouter HTTP/1.0
Host: localhost:80
Content-Type: text/xml; charset=utf-8
Content-Length: 1664
SOAPAction: ""
Authorization: Basic ZGVtbzphYmNkZW1v

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <SOAP-ENV:Body>
        <ns1:execute xmlns:ns1="urn:SOAPOBJServer" SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml">
        <database xsi:type="xsd:string" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">demo_sports1</database>
        <objcode xsi:type="xsd:string" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">cbal_a_sal_p_nivel</objcode>
        <cond xsi:type="xsd:string" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></cond>
        <cols xmlns:ns2="http://xml.apache.org/xml-soap" xsi:type="ns2:Map" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            <item>
                <key xsi:type="xsd:string">csaldos.cuenta</key>
                <value xsi:type="xsd:string">[67]*</value>
            </item>
        </cols>
        <vars xmlns:ns3="http://xml.apache.org/xml-soap" xsi:type="ns3:Map" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            <item>
                <key xsi:type="xsd:string">EXERCI</key>
                <value xsi:type="xsd:string">2004</value>
            </item>
            <item>
                <key xsi:type="xsd:string">LEVEL</key>
                <value xsi:type="xsd:string">1</value>
            </item>
            <item>
                <key xsi:type="xsd:string">PERINI</key>
                <value xsi:type="xsd:string">1</value>
            </item>
            <item>
                <key xsi:type="xsd:string">PERFIN</key>
                <value xsi:type="xsd:string">12</value>
            </item>
        </vars>
        <type xsi:type="xsd:string" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">fo-xml</type>
        </ns1:execute>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>>

The HTTP message which will be generated as response, has the following format.

Copy
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/20
    <SOAP-ENV:Body>
        <ns1:executeResponse SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml" xmlns:ns1="urn:SOAPOB
        <return>
            <objresponse date="Tue Nov 21 11:43:04 CET 2006" host="localhost">
                <object code="cbal_a_sal_p_nivel" dbms="demo_sports1" encoding="ISO-8859-1" glob=".xml" gzip="false" lang="es-ES" size="8363" type="fo-xml">
                PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nSVNPLTg4NTktMSc/Pgo8Zm86cm9vdCB4bWxuczpmbz0naHR0cDovL3d3dy53My5vcmcvMTk5OS9YU0wvRm9ybWF0Jz4KCTxmb
                ...
                </object>
            </objresponse>
        </return>
        </ns1:executeResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The script can be divided in 5 well differentiated parts:

SOAP request: through the label <soap.call>, a communication with the SOAP server is established, which executes the SQL object cbal_a_sal_p_nivel of the database demo_sports1. The result of invoke remotly the methode, is a XML document which is received as response to the SOAP request and is stored in the variable of m_response name.

Obtaining the balance: taking into account that the XML document has a struct in tree form, you should access to the exact node which contains the balance. For this, the functions DOM are used. The structure of the received document of the SOAP server is the following:

Copy
<objresponse date="Tue Nov 21 11:43:04 CET 2006" host="localhost">
    <object code="cbal_a_sal_p_nivel" dbms="demo_sports1" encoding="ISO-8859-1" glob=".xml" gzip="false" lang="es-ES" size="8363" type="fo-xml">
        [TEXTO CODIFICADO EN BASE64]
    </object>
</objresponse>

Starting of the root node <objresponse> ,through the function <dom.node.getFirstChildElement> the focus is positionned in the element <object> and with the function <dom.node.getChildCharacterData> you can obtain the balance in FO format (Formatting Object) codificado en BASE64.

Copy
<set name='m_object'><dom.node.getFirstChildElement><m_response/></dom.node.getFirstChildElement></set>
<set name='m_fo_base64'><dom.node.getChildCharacterData><m_object/></dom.node.getChildCharacterData></set>

Decoded the variable m_fo_base64.

Copy
<set name='m_fo'><byte.decode type='BASE64'><string.getBytes><m_fo_base64/></string.getBytes></byte.decode></set>
Copy
Convertion to PDF: from the FO obtained, the convertion of the balance to PDF format is performed  ( <fop.transform type='pdf'> ) and the
        result is writted in a file of new creation whose name is  balance.pdf
Copy
<file.out.open id='out1'>
   <file name='balance.pdf' type='temp' />
</file.out.open>
<file.out.println id='out1'>
   <file.getBytes>
      <fop.transform type='pdf'><m_fo/></fop.transform>
   </file.getBytes>
</file.out.println>
<file.out.close id='out1'/>

Sent by email: Once you dispose of the PDF filw which contains the balance, it is attached in a email ( <mail.attach type='application/pdf'> ) which is sent to a specific recipient.

Copy
<mail
   smtphost='mail.deister.net'
   from='from@deister.es'
   to='to@deister.es'
   subject='Balance'
   >
   <content>See attached file.</content>
   <attachs>
      <mail.attach type='application/pdf'><file name='balance.pdf' type='temp' /></mail.attach>
   </attachs>
</mail>

3 Axional Studio Service SOAP call: SOAPSQLServer (executeSQL)

The objective of the following script is to execute a SQL query against the database of a remote server to obtain a value of BLOB (Binary Large OBject) type, decode it and generate a MPEG video file for its playback. The call to the SOAPSQLServer service will invoke the methode of the service with the signature.

Copy
executeSQL(String dbms, String stmt)
Copy
<xsql-script name='soap_sql_query'>
   <body>
        <set name='m_response'>
            <soap.call
                url='http://localhost:80/soap/servlet/rpcrouter'
                uri='urn:SOAPSQLServer'
                method='executeSQL'
                user='demo'
                password='abcdemo'
                >
                <parameters>
                   <parameter name='database'>demo_sports1</parameter>
                   <parameter name='sqlstmt'>SELECT file_data FROM cterdocs WHERE seqno = 15</parameter>
                </parameters>
            </soap.call>
        </set>

        <file.out.open id='out1'>
            <file name='ferrari.mpeg' type='temp' />
        </file.out.open>

        <file.out.write id='out1'>
            <byte.decode type='BASE64'>
                <dom.node.getChildCharacterData>
                    <dom.getElementByXPath
                         xpath='/SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:executeSQLResponse/return/sqlresponse/rowset/row/file_data'>
                        <m_response/>
                    </dom.getElementByXPath>
                </dom.node.getChildCharacterData>
            </byte.decode>
        </file.out.write>

        <file.out.close id='out1' />

   </body>
</xsql-script>

The HTTP message which will generate this request has the following format.

Copy
POST /soap/servlet/rpcrouter HTTP/1.0
Host: localhost:80
Content-Type: text/xml; charset=utf-8
Content-Length: 704
SOAPAction: ""
Authorization: Basic ZGVtbzphYmNkZW1v

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <SOAP-ENV:Body>
        <ns1:executeSQL xmlns:ns1="urn:SOAPSQLServer" SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml">
            <database xsi:type="xsd:string" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">demo_sports1</database>
            <sqlstmt xsi:type="xsd:string" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">SELECT file_data FROM cterdocs WHERE seqno = &apos;15&apos;;</sqlstmt>
        </ns1:executeSQL>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Tha HTTP message which will generate as response has the following format.

Copy
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Body>
        <ns1:executeSQLResponse SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml" xmlns:ns1="urn:SOAPSQLServer">
        <return>
            <sqlresponse date="Wed Jun 14 19:36:23 CEST 2006" host="localhost">
             <sqlinfo>
              <sqlstmt>SELECT file_data FROM cterdocs WHERE seqno = '15'</sqlstmt>
              <sqluser>demo</sqluser>
              <sqldbms>demo_sports</sqldbms>
              <sqltype>SELECT</sqltype>
              <sqltime>1</sqltime>
              <sqlrows>0</sqlrows>
              <sqlserial>0</sqlserial>
             </sqlinfo>
             <metadata>
              <column catalogName="" columnClassName="com.informix.jdbc.IfxBblob" columnDisplaySize="72" columnLabel="file_data" columnName="file_data" columnType="2004" columnTypeName="blob" isAutoIncrement="false" isCaseSensitive="false" isCurrency="false" isDefinitelyWritable="true" isNullable="1" isReadOnly="false" isSigned="false" isWritable="true" precision="0" scale="0" schemaName="" tableName="cterdocs"/>
             </metadata>
             <rowset>
              <row>
               <file_data size="1384462"><![CDATA[000001ba210001001
            ...
              </row>
             </rowset>
            </sqlresponse>
        </return>
        </ns1:executeSQLResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The script is divided in three parts:

  • SOAP request : through the label <soap.call>, a communicxation with the SOAP server is established, which executes the SQL sentence against the database demo_sports1. The result of invoke the methode remotly, is a XML document which is received as response to the SOAP request and which is stored in the variable called m_response.
  • Creation of a file to write:the file which will contain the content of the call of the SOAP service is created.
  • Writing in the file: the content is write in the file through the access to the data block using XPath and the bytes decoder. How the XPath is used, the reference should be the SOAP document of response and the content is written in the file through the access to the data block using XPath and the byte decoder. How XPath is used, the reference should be the answer SOAP document and therefore it starts from the root of the same to go down to the data node.

4 Axional Studio Service SOAP call: SOAPSQLServer (executeQuery)

The objective of the following script is to execute a SQL query against the database of a remote server to obtain a single register represented by a object of HashMap type in string format. The call to the SOAPSQLServer service will invoke the methode of the service with the signature.

Copy
executeQuery(String dbms, String stmt)
Copy
<xsql-script name='executeQuery'>
   <body>
      <set name='m_response'>
         <soap.call
            url='http://localhost/soap/servlet/rpcrouter'
            uri='urn:SOAPSQLServer'
            method='executeQuery'
            user='demo'
            password='abcdemo'
            encoding='NS_URI_SOAP_ENC'
            >
            <parameters>
               <parameter name='dbms'>demo_sports1</parameter>
               <parameter name='stmt'>SELECT * FROM cdataemp</parameter>
            </parameters>
         </soap.call>
      </set>
      <return><string><m_response/></string></return>
   </body>
</xsql-script>

The result of execute the script is the following:

Copy
{ctafrm=####.#####, ctadev=6650.00000, ctaaux=0, tipdir=0, ctadec=7650.00000}

Notas

The columns with null value are not included in the answer HashMap object.

5 Axional Studio Service SOAP call: SOAPSQLServer (multirow transacion)

The objective of the following script is to insert three registers in a single operation on a table called cdiarios. The call to the SOAPSQLServer service will invoke the methode of the service with the signature.

Copy
executeSQL(String dbms, String stmt, int[] sqltype, Vector<Object[]> sqldata)

This implies the need to pass an array of integers and a vector of objects arrays to the SOAP function. Two structures which requieres the use of the arrays conversion functions and a constructions more sofisticated than usual. Fortunately, the XSQL language incorporates powerful conversion mechanisms which are shown in the example.

Copy
<xsql-script name='soap_mulirow_trasaction'>
   <body>
    <soap.call url='http://localhost/soap/servlet/rpcrouter'
        uri='urn:SOAPSQLServer'
        method='executeSQL'
        user='myuser'
        password='mypass'
        encoding='NS_URI_LITERAL_XML'>
    
        <parameters>
            <parameter name='dbms'>demo_sports1</parameter>
            <parameter name='stmt'>insert into cdiarios values (?, ?)</parameter>
            <parameter name='sqltype'>
                <array.toObject type='integer'>
                    <array>
                        <sql.type type='CHAR' />
                        <sql.type type='CHAR' />
                    </array>
                </array.toObject>
            </parameter>
            <parameter name='sqldata'>
                <array.toVector>
                    <array>
                        <!-- three elements each one of which is a String[2] -->
                        <object>
                            <string>X1</string>
                            <string>Diary X1</string>
                        </object>
                        <object>
                            <string>X2</string>
                            <string>Diary X2</string>
                        </object>
                        <object>
                            <string>X3</string>
                            <string>Diary X3</string>
                        </object>
                    </array>
                </array.toVector>
            </parameter>
        </parameters>
    </soap.call>
   </body>
</xsql-script>

The HTTP message which will generate this requests has the following format.

Copy
POST http://localhost/soap/servlet/rpcrouter HTTP/1.0
Host: localhost:80
Content-Type: text/xml; charset=utf-8
Content-Length: <b>1705</b>
SOAPAction: ""
Authorization: <b>Basic dGVzdDphYmM=</b>

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <SOAP-ENV:Body>
        <ns1:executeSQL xmlns:ns1="urn:SOAPSQLServer" SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml">
            <dbms xsi:type="xsd:string" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><b>demo_sports1 </b></dbms>
            <stmt xsi:type="xsd:string" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><b>insert into cdiarios values (?, ?)</b></stmt>
            <sqltype xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Array" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ns2:arrayType="xsd:int[2]">
                <item xsi:type="xsd:int"><b>1 </b></item>
                <item xsi:type="xsd:int"><b>1 </b></item>
            </sqltype>
            <sqldata xmlns:ns3="http://xml.apache.org/xml-soap" xsi:type="ns3:Vector" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                <item xmlns:ns4="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns4:Array" ns4:arrayType="xsd:anyType[2]">
                    <item xsi:type="xsd:string"><b>X1 </b></item>
                    <item xsi:type="xsd:string"><b>Diario X1 </b></item>
                </item>
                <item xmlns:ns5="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns5:Array" ns5:arrayType="xsd:anyType[2]">
                    <item xsi:type="xsd:string"><b>X2 </b></item>
                    <item xsi:type="xsd:string"><b>Diario X2 </b></item>
                </item>
                <item xmlns:ns6="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns6:Array" ns6:arrayType="xsd:anyType[2]">
                    <item xsi:type="xsd:string"><b>X3 </b></item>
                    <item xsi:type="xsd:string"><b>Diario X3 </b></item>
                </item>
            </sqldata>
        </ns1:executeSQL>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The HTTP message which will be generated as response has the following format.

Copy
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SOAP-ENV:Body>
   <ns1:executeSQLResponse SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml" xmlns:ns1="urn:SOAPSQLServer">
   	<return>
      <sqlresponse date="Thu Jul 06 21:43:28 CEST 2006" host="titan">
       <sqlinfo>
        <sqlstmt><b><![CDATA[insert into cdiarios values (?, ?)]] > </b></sqlstmt>
        <sqluser><b>informix </b></sqluser>
        <sqldbms><b>demo_sports </b></sqldbms>
        <sqltype><b>INSERT </b></sqltype>
        <sqltime><b>0 </b></sqltime>
        <sqlrows><b>3 </b></sqlrows>
        <sqlserial><b>0 </b></sqlserial>
       </sqlinfo>
      </sqlresponse>
     </return>
   </ns1:executeSQLResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

6 Axional Studio Service SOAP call: tempuri.org

It is possible to perform requests to a SOAP server in addition to being able to make the previously explained calls to the server Axional Studio. The values of the attributes will depend precisely on the server to which it is necessary to connect and the service required.

The following example shows a call to the delta service. In this case the authorization does not go in the request but how a SOAPHeader with two arguments, username and password.

Another differents features to the SOAP services of Axional Studio is the encoding, Axional Studio use NS_URI_LITERAL_XML using the attribute action.

Copy
<xsql-script name='main'>
    <body>
        <set name='username'>username</set>
        <set name='password'>
            <crypt.digest.sha><string.getBytes encoding='utf-8'>password</string.getBytes></crypt.digest.sha>
        </set>
        <println>
            <soap.call
                url='http://www.delta.com/testWS/helloworld.asmx'
                action='http://tempuri.org/testWS/helloworld/HelloWorld'
                uri='http://tempuri.org/testWS/helloworld'
                method='HelloWorld'
                encoding='NS_URI_SOAP_ENC'
            >
                <!-- Generate the body of the request. -->
                <!--
                    <ns1:HelloWorld xmlns:ns1="http://tempuri.org/testWS/helloworld"
                        SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                    </ns1:HelloWorld>
                -->
                <mappings>
                    <mapping
                        namespace='http://tempuri.org/testWS/helloworld'
                        type='HelloWorldResult'
                        deserializer='String'>
                    </mapping>
                </mappings>

                <!-- Generate the header of the request. -->
                <!--
                   <AuthHeader xmlns="http://tempuri.org/testWS/helloworld">
                      <Username>username</Username>
                      <Password>XXXXXXXX</Password>
                   </AuthHeader>
                -->
                <header>
                    <dom.createElement>
                        <element name='AuthHeader'>
                            <attributes>
                                <attribute name='xmlns' value='http://tempuri.org/testWS/helloworld' />
                            </attributes>
                            <elements>
                                <element name='Username'>
                                    <value><username /></value>
                                </element>
                                <element name='Password'>
                                    <value><password /></value>
                                </element>
                            </elements>
                        </element>
                    </dom.createElement>
                </header>
            </soap.call>
        </println>
     </body>
</xsql-script>

The request sent has the following form:

Copy
POST / HTTP/1.0
Host: localhost:80
Content-Type: text/xml; charset=utf-8
Content-Length: 662
SOAPAction: "http://tempuri.org/testWS/helloworld/HelloWorld"

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <SOAP-ENV:Header>
       <AuthHeader xmlns="http://tempuri.org/testWS/helloworld">
          <Username>username</Username>
          <Password>XXXXXXXX</Password>
       </AuthHeader>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns1:HelloWorld xmlns:ns1="http://tempuri.org/testWS/helloworld"
            SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        </ns1:HelloWorld>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>