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

RE: Call to HTTP_URL_P ended in error



Scott, 
      Thank you very much, and yet again very grateful for your help. I will revise the rest of my code, and fix it accordingly. 

Naresh   

Naresh Mistry | TM Architect | Nulogx Inc. | 5090 Explorer Dr, Suite 203, Mississauga, ON L4W 4T9 | T: 905-486-1162 x 238 | F: 905-267-3164 | C: 416-820-5231
www.nulogx.com | Transportation Management Solutions | www.cgfi.ca | Canadian General Freight Index – Register Today



-----Original Message-----
From: Scott Klement [mailto:sk@xxxxxxxxxxxxxxxx] 
Sent: Monday, May 14, 2012 3:30 PM
To: Naresh Mistry
Cc: HTTPAPI and FTPAPI Projects
Subject: Re: Call to HTTP_URL_P ended in error

Hi Naresh,

Your XML has this:

    <RBNO/>

Your EndOfElement routine has this:

   when name = 'RBNO';
      p0Rat = %subst(value:3:6);

The result is that 'value' will be 0 bytes long, and you're telling RPG to take a substring starting at position 3, and going for a length of 6. 
  That's not possible for something that's 0 long, resulting in the "Length or start position is out of range for the string operation." error.

There may be other, similar, errors in your code as well (I didn't test every single possibility.)  But, this doesn't appear to be an issue with HTTPAPI (whew!)

Hope that helps...



On 5/14/2012 9:50 AM, Naresh Mistry wrote:
> Scott,
>        The parser did crash. I have attached the XML file and the 
> StartofElement and EndofElement routines from my program in the 
> CodeSample.txt file
>
> Naresh
>
> Naresh Mistry | TM Architect | Nulogx Inc. | 5090 Explorer Dr, Suite 
> 203, Mississauga, ON L4W 4T9 | T: 905-486-1162 x 238 | F: 905-267-3164 
> | C: 416-820-5231 www.nulogx.com | Transportation Management Solutions 
> | www.cgfi.ca | Canadian General Freight Index – Register Today
>
>
>
> -----Original Message-----
> From: Scott Klement [mailto:sk@xxxxxxxxxxxxxxxx]
> Sent: Monday, May 14, 2012 10:06 AM
> To: Naresh Mistry
> Cc: HTTPAPI and FTPAPI Projects
> Subject: Re: Call to HTTP_URL_P ended in error
>
> Hi Naresh,
>
> rc=1 means success.
>
> The http_url_post() routine does not parse the data you receive back from the server, it simply saves it to a file.  So nothing "replaces"
> the StartOfElement/EndOfElement -- the XML parser hasn't been run, so there's nothing similar to those.
>
> What we have determined, therefore, is that the error isn't occurring during the HTTP communications. It's occuring during the XML parsing.
>
> Now your XML file is in a stream file (maybe called 
> /tmp/httpapi_test.txt -- or whatever you decided to call it.)
>
> Let's try parsing that XML without doing the HTTP transfer:
>
> rc = http_parse_xml_stmf( '/tmp/httpapi_test.xml'
>                           : HTTP_XML_CALC
>                           : %paddr(StartOfElement)
>                           : %paddr(EndOfElement)
>                           : *null );
>
> So this takes the file you've already downloaded and parses it directly from the IFS without the network communications happening.  Since we now suppose the error is occurring during XML processing, I can only assume that this will end in error (call to HTTP_PARSE ended in error).
>
> Please try that, and see if it's true.   If I'm right and it crashes,
> please send me the XML file and the two routines
> (StartOfElement/EndOfElement) so I can try to reproduce the problem on my box.
>
> -SK
>
> On 5/14/2012 7:30 AM, Naresh Mistry wrote:
>>
>> Scott, I made the change, nothing crashed and rc returned a 1. Now 
>> that StartofElement and EndofElement procedures are not part of the 
>> parameter list, what replaces these procedures ?
>>
>> Naresh>

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