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

Re: New to http questions

Hello Walker,

> 1. In the Incoming proc,  what is the purpose of calling the proc
> 'atof' ? I am working on the response from the web service, which is
> a pass/fail value.

atof() is a C function that converts a character string representing a 
floating point number into a floating point variable (data type F in RPG).

It was used in my currency exchange example because the WSDL for the 
currency exchange web service claimed that it returned a floating point 
value -- so it made sense.

> 2. Not only is the web service passing a flag, but also a
> description. I notice that when I get name = 'anyType' I get two of
> them. The first comes as the flag and then the next instance of
> 'anyType', the description. They don't come as value(PSuccess), but
> value(P) and then value(Success).

It depends on how the XML document is laid out.  From what you're 
describing, your web service is returning an XML document that looks 
like this:


Note that XML elements like <Sample> (that do NOT have a slash) are 
"start elements". XML elements like </Sample> that do have a slash are 
"end elements". HTTPAPI will call your subprocedures individually for 
every element found.  The character data (the data in between the tags) 
is passed in the "value" parameter for end elements.

In this sample XML, HTTPAPI would call your procedures as follows:

StartProc: depth=1, name="Sample", path="/"
StartProc: depth=2, name="anyType", path="/Sample"
EndProc  : depth=2, name="anyType", path="/Sample", value="P"
StartProc: depth=2, name="anyType", path="/Sample"
EndProc  : depth=2, name="anyType", path="/Sample", value="Success"
EndProc  : depth=1, name="Sample", path="/", value="      "

Although I don't think you mentioned this, your sample code sounds like 
it's a copy of EXAMPLE18 (Currency Exchange). EXAMPLE18 tells HTTPAPI to 
skip the StartProc (by passing *NULL in the StartProc parameter) and 
tells HTTPAPI to call a subprocedure named 'Incoming' as the EndProc. 
So HTTPAPI would do the following:

Incoming: depth=2, name="anyType", path="/Sample", value="P"
Incoming: depth=2, name="anyType", path="/Sample", value="Success"
Incoming: depth=1, name="Sample", path="/", value="      "

But, in any event, HTTPAPI is just following the XML document that was 
given to it.  The reason you'd get two XML elements with the same name 
would be because the document contained two XML elements with the same 

If you think HTTPAPI is doing this when it shouldn't, please send me a 
copy of the XML document that's giving you grief, and I'll try to 
reproduce the problem and fix it.
This is the FTPAPI mailing list.  To unsubscribe, please go to: