Deprecated: The SOAPHTTPV and SOAPHTTPC user-defined functions

Db2 provides user-defined functions that allow you to work with SOAP and consume web services in SQL statements. The user-defined functions are two varieties of SOAPHTTPV for VARCHAR data and two varieties of SOAPHTTPC for CLOB data.

Restriction: SOAPHTTPV and SOAPHTTPC user-defined functions have been deprecated. Use SOAPHTTPNV and SOAPHTTPNC user-defined functions instead.
The user-defined functions perform the following actions:
  1. Compose a SOAP request
  2. Post the request to the service endpoint
  3. Receive the SOAP response
  4. Return the content of the SOAP body

When a consumer receives the result of a web services request, the SOAP envelope is stripped and the XML document is returned. An application program can process the result data and perform a variety of operations, including inserting or updating a table with the result data.

SOAPHTTPV and SOAPHTTPC are user-defined functions that enable Db2 to work with SOAP and to consume web services in SQL statements. These functions are overloaded functions that are used for VARCHAR or CLOB data of different sizes, depending on the SOAP body. Web services can be invoked in one of four ways, depending on the size of the input data and the result data. SOAPHTTPV returns VARCHAR(32672) data and SOAPHTTPC returns CLOB(1M) data. Both functions accept either VARCHAR(32672) or CLOB(1M) as the input body.

Example: The following example shows an HTTP post header that posts a SOAP request envelope to a host. The SOAP envelope body shows a temperature request for Barcelona.
POST /soap/servlet/rpcrouter HTTP/1.0 
Host: services.xmethods.net 
Connection: Keep-Alive User-Agent: DB2SOAP/1.0 
Content-Type: text/xml; charset="UTF-8" 
SOAPAction: "" 
Content-Length: 410 

<?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 >
  <SOAP-ENV:Body>
     <ns:getTemp xmlns:ns="urn:xmethods-Temperature">
           <city>Barcelona</city>
     </ns:getTemp>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Example: The following example is the result of the preceding example. This example shows the HTTP response header with the SOAP response envelope. The result shows that the temperature is 85 degrees Fahrenheit in Barcelona.
HTTP/1.1 200 OK 
Date: Wed, 31 Jul 2002 22:06:41 GMT 
Server: Enhydra-MultiServer/3.5.2 
Status: 200 
Content-Type: text/xml; charset=utf-8 
Servlet-Engine: Lutris Enhydra Application Server/3.5.2 
   (JSP 1.1; Servlet 2.2; Java 1.3.1_04; 
    Linux 2.4.7-10smp i386; java.vendor=Sun Microsystems Inc.) 
Content-Length: 467 
Set-Cookie:JSESSIONID=JLEcR34rBc2GTIkn-0F51ZDk;Path=/soap 
X-Cache: MISS from www.xmethods.net 
Keep-Alive: timeout=15, max=10 
Connection: Keep-Alive

<?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:getTempResponse xmlns:ns1="urn:xmethods-Temperature" 
      SOAP-ENV:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/ >
         <return xsi:type="xsd:float">85</return>
     </ns1:getTempResponse>
   </SOAP-ENV:Body></SOAP-ENV:Envelope>
Example: The following example shows how to insert the result from a web service into a table
INSERT INTO MYTABLE(XMLCOL) VALUES (DB2XML.SOAPHTTPC(
   'http://www.myserver.com/services/db2sample/list.dadx/SOAP',
   'http://tempuri.org/db2sample/list.dadx'
   '<listDepartments xmlns="http://tempuri.org/db2sample/listdadx">
        <deptno>A00</deptno>
    </ListDepartments>'))