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

RE: duplicate calls to web service



Hi Mike,

I'm not looping on error, but one difference between my code and
Example18 (what I'm basing this program off of), is that I am not
calling http_crash() if the connection fails.  I'm receiving the
messages in the httpapi_debug.txt file, so I figured that http_crash()
wasn't necessary. 

Here is the code I'm using to call the web service and then parse the
returned response. Do you see anything here that would make it loop? 

      /free
      /if defined(DEBUGGING)
           // Note:  http_debug(*ON/*OFF) can be used to turn debugging
           //        on and off.  When debugging is turned on,
diagnostic
           //        info is written to an IFS file named
           //        /tmp/httpapi_debug.txt
           // CHANGE: I've decided to create a separate debug file for
each request/response
           debgFile = '/tmp/' + %trimr(IFSFile) + 'DEBUG.txt';
           http_debug(*ON:%trim(debgFile));
      /endif

         http_XmlReturnPtr(*ON);

         *inlr = *on;

         rFileName = %trimr(IFSFile) + '.txt';
         strVar=IFS_file2Var(%trim(IFSDir) + rFileName);
         rPos = %scan('.':rFileName);
         rPos = rPos - 8;        // shift 8 characters to right
         rPolno = %subst(rFileName:rPos:7);
         pCount = 0;
         unlink(%trim(IFSDir) + %trim(rFileName));


       SOAP =
        '<?xml version="1.0" encoding="UTF-8"?>'
       +'<soapenv:Envelope '
       +%trim('
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";')
       +' xmlns:eos="http://QuestWebServices/EOService";>'
       +'<soapenv:Header />'
       +'<soapenv:Body>'
       +'  <eos:DeliverExamOneContent>'
       +'    <eos:username>fakeusername</eos:username>'
       +'    <eos:password>fakepassword</eos:password>'
       +'    <eos:destinationID>RX</eos:destinationID>'
       +'    <eos:payload><![CDATA['
       + %trim(strVar)
       +']]></eos:payload>'
       +'</eos:DeliverExamOneContent>'
       +'</soapenv:Body>'
       +'</soapenv:Envelope>';

         // ----------------------------------------------
        //  Send request to server, and get response
        // ----------------------------------------------

           embfile = http_tempfile();
          

             rc = 0;

             // LabOne Web Service -
             // test address:
https://wssim.labone.com/services/eoservice.asmx
             // live address:
https://ws.labone.com/services/eoservice.asmx

             rc = http_url_post_xml(
                 'https://ws.labone.com/services/eoservice.asmx'
                       : %addr(SOAP)+2
                       : %len(SOAP)
                       : %paddr(StartOfElement)
                       : %paddr(EndOfElement)
                       : *NULL
                       : HTTP_TIMEOUT);

            if (rc <> 1);
              rStatus = 'F';  // F = Failure
              rError = http_error;
            else;
              rStatus = 'S';  // S = Success
              rError = *blanks;
            endif;
                      
         http_XmlReturnPtr(*OFF);


         // ----------------------------------------------
        //    Parse the second XML document (the one
        //    that was embedded)
        // ----------------------------------------------
          resp = *allx'00';
          if (http_parse_xml_stmf( embfile
                                 : HTTP_XML_CALC
                                 : *null
                                 : %paddr(Embedded)
                                 : %addr(resp) ) < 0);
              unlink(embfile);
              rError = http_error;
              rStatus = 'F';  //F = Fail;
          else;

            head = 1;
            exsr printRequest;
            rStatus = 'S';  //S = Success;
            rError = *blanks;

          endif;

      /if defined(DEBUGGING)
          if rStatus = 'S';
            exsr printData;
          endif;
      /endif

          return;      


Thanks so much for your help, everyone. 

Kim Gibson
________________________________________
* From: Mike Krebs <mkrebs@xxxxxxxxxxxxxxxxxx>
* To: HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
* Subject: RE: duplicate calls to web service
* Date: Wed, 9 Feb 2011 16:09:09 -0600
________________________________________
Are you looping on error and "retrying"?



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