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

Re: http_debug_file and http_XmlStripCRLF not working?



Hello Patrick,

The way you control the debug file is by passing the pathname in the 2nd parameter of the http_debug() API, such as:
   http_debug(*ON: '/home/PGO/debugpat.txt');

The http_XmlStripCRLF() API controls the XML parser inside HTTPAPI. By default, the XML parser removes CRLF characters from XML as it parses it, and this routine disables that behavior. However, you are not using the XML parser in your code -- so this will have no effect.

http_url_post() saves the received data, as-is, to disk. It does not know that the data is XML.... as far as http_url_post() is concerned, it's just a string of bytes, and it saves it to disk exactly as it was sent from the HTTP server. Therefore, if you are not getting CRLF characters in your XML, it's because the HTTP server did not send them. (Which is commonplace!)

-SK


On 12/13/2012 9:49 AM, Patrick Goovaerts wrote:
    Hi,


    I'll try to remap the debugfile to an existing folder on the IFS so I
    include the following statement in my code

           http_debug_file = '/home/PGO/debugpat.txt';

    The debugfile is generated in it's default place with it's default
    name.



    Furthermore, I want to include `CRLF' in my XML-resultfile after
    executing a webservice, so I include the following statement

           http_XmlStripCRLF(*OFF);

    The resultfile is created in correct (and same) folder but has no
    CRLF's included.



    neither of above command seems to be working.




    any ideas?




    Code:


          *  This is an example of calling a SOAP Web service w/HTTPAPI.

          *

          *  To Compile (requires V5R1):

          *     CRTBNDRPG PGM(CODASOAPFL) SRCFILE(PGOOVAERTS/QRPGLESRC)

          *

          *  To Run:

          *     CALL CODASOAP

          *

          *

         H DFTACTGRP(*NO) BNDDIR('HTTPAPI':'QC2LE')


         D CODASOAPFL      PR                  ExtPgm('CODASOAPFL')

         D CODASOAPFL      PI


          /copy httpapi_h


         D SOAP            s          32767A   varying

         D rc              s             10I 0

         D Result          s             12P 2


          /free

           http_debug_file = '/home/PGO/debugpat.txt';

           http_debug(*ON);

           http_XmlStripCRLF(*OFF);


           SOAP = '<?xml version="1.0" encoding="utf-8"?>'

           +'<soapenv:Envelope xmlns:soapenv='

           +   '"[1]http://schemas.xmlsoap.org/soap/envelope/"; '

           +'xmlns:web="http://www.coda.com/efinance/schemas/'

           +   'elementmaster/elementmaster-12.0/webservice" '

           +'xmlns:com="[2]http://www.coda.com/efinance/schemas/common"; '


    +'xmlns:elem="[3]http://www.coda.com/efinance/schemas/elementmaster";>'

           +'<soapenv:Header>'

           +'   <web:Options company="Q" user="INSTALL" />'

           +'</soapenv:Header>'

           +'<soapenv:Body>'

           +'   <web:GetRequest>'

           +'      <web:Key>'

           +'         <elem:CmpCode>Q</elem:CmpCode>'

           +'         <elem:Level>3</elem:Level>'

           +'         <elem:Code>000049</elem:Code>'

           +'      </web:Key>'

           +'   </web:GetRequest>'

           +'</soapenv:Body>'

           +'</soapenv:Envelope>';

             http_setAuth(HTTP_AUTH_BASIC:'USERID':'PASSWORD');


             rc = http_url_post(


    'http://Coda/coda/services/finance/elementmaster/elementmaster-12.0'

                             : %addr(SOAP) + 2

                             : %len(SOAP)

                             : '/home/PGO/test.xml'

                             : HTTP_TIMEOUT

                             : HTTP_USERAGENT

                             : 'text/xml'

                    :
    'uri-coda-webservice/12.000.0729/finance/ElementMaster/Get');


           if (rc <> 1);

              http_crash();

           else;

           // dsply 'OK';

           endif;


           *inlr = *on;

          /end-free

References

    1. http://schemas.xmlsoap.org/soap/envelope/
    2. http://www.coda.com/efinance/schemas/common
    3. http://www.coda.com/efinance/schemas/elementmaster



-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------