[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ProcessXMLStringToDB



   Scott,

   I have included the RPG code I am using to post XML data from our
   iSeries to a HTTP server.  The HTTP server is running a service
   ProcessXMLStringToDB, I have included the service below.

   When I run the RPG program it appears to work fine (no errors),
   however the data is not updated on the ProcessXMLStringToDB service.

   I am new at this and would like to know if I am doing something
   wrong.  Possibly utilizing the wrong methods or parameters?

   Any help would be appreciated.

   Thank you,

   Ernie Woods

   Forman, Inc.

   Sr. Programmer/Analyst


   Service


ProcessXMLStringToDB

Test

   To test the operation using the HTTP POST protocol, click the 'Invoke'
   button.

   Parameter

   Value

   Doc:

SOAP 1.1

   The following is a sample SOAP 1.1 request and response. The
   placeholders shown need to be replaced with actual values.
POST /service.asmx HTTP/1.1
Host: xxx.126.154.120
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/ProcessXMLStringToDB";
 
<?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:Body>
    <ProcessXMLStringToDB xmlns="http://tempuri.org/";>
      <Doc>string</Doc>
    </ProcessXMLStringToDB>
  </soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
 
<?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:Body>
    <ProcessXMLStringToDBResponse xmlns="http://tempuri.org/";>
      <ProcessXMLStringToDBResult>string</ProcessXMLStringToDBResult>
    </ProcessXMLStringToDBResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

   The following is a sample SOAP 1.2 request and response. The
   placeholders shown need to be replaced with actual values.
POST /service.asmx HTTP/1.1
Host: xxx.126.154.120
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xs
d="http://www.w3.org/2001/XMLSchema"; xmlns:soap12="http://www.w3.org/2003/05/so
ap-envelope">
  <soap12:Body>
    <ProcessXMLStringToDB xmlns="http://tempuri.org/";>
      <Doc>string</Doc>
    </ProcessXMLStringToDB>
  </soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xs
d="http://www.w3.org/2001/XMLSchema"; xmlns:soap12="http://www.w3.org/2003/05/so
ap-envelope">
  <soap12:Body>
    <ProcessXMLStringToDBResponse xmlns="http://tempuri.org/";>
      <ProcessXMLStringToDBResult>string</ProcessXMLStringToDBResult>
    </ProcessXMLStringToDBResponse>
  </soap12:Body>
</soap12:Envelope>

HTTP GET

   The following is a sample HTTP GET request and response. The
   placeholders shown need to be replaced with actual values.
GET /service.asmx/ProcessXMLStringToDB?Doc=string HTTP/1.1
Host: xxx.126.154.120
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/";>string</string>

HTTP POST

   The following is a sample HTTP POST request and response. The
   placeholders shown need to be replaced with actual values.
POST /service.asmx/ProcessXMLStringToDB HTTP/1.1
Host: xxx.126.154.120
Content-Type: application/x-www-form-urlencoded
Content-Length: length
 
Doc=string
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/";>string</string>



   THE RPG PROGRAM:

   H BNDDIR('HTTPAPI')
   
   
    

    **
   
    **    CRTBNDRPG CUSTPRODHR SRCFILE(libhttp/QRPGLESRC) DBGVIEW(*LIST)
   +

   **       DFTACTGRP(*NO) ACTGRP(*NEW)                                  

   
    

   D/copy qrpglesrc,httpapi_h
    

   D/copy qrpglesrc,ifsio_h
   
   D/copy qrpglesrc,errno_h
   
   
    

   D cmd             pr                  extpgm('QCMDEXC')
   
   D  command                     200A   const
   
   D  length                       15P 5 const
   
   
    

   D ContentType     s             64A
   
   D rc              s             10I 0
   
   D msg             s             52A
   
   D stmf            S            256A
   
   
    

   C     *entry        plist
   
   C                   parm                    p_inpcust         4
   
   
    

    /free
   
     *inlr = *on;                                              

                                                               

     //** whatever data is in this stream file will            

     //** be POSTed to the URL below.                          

     stmf = '/cgiforman/xmlexport/custprod'+p_inpcust+'.xml';  

     ContentType='application/x-www-form-urlencoded';          

                                                               

     rc=http_url_post_stmf('http://xxx.126.154.120'             

       +'/service.asmx?op=ProcessXMLStringToDB'                

       : stmf                                                  

       : '/tmp/http_result.txt'                                

       : HTTP_TIMEOUT                                          

       : HTTP_USERAGENT                                        

       : ContentType );                                        

                                                               

     if rc <> 1;                                               

        msg = http_error();                                    

        dsply msg;                                             

        return;                                                

     endif;                                                    

                                                               

     //unlink('/tmp/http_result.txt');                         

     return; 

    

      This transmission contains information from Forman, Inc. which may be
      confidential and/or privileged. The information is intended to be for the
      exclusive use of the planned recipient. If you are not the intended
      recipient, be advised that any disclosure, copying, distribution or other
      use of this information is strictly prohibited. If you have received this
      transmission in error, please notify the sender immediately.
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------