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

RE: New to http questions



Hi, Scott and all.  The explanation below is exactly how the xml is passing back data.  This is good, now that I understand it.  I have modified my code to allow for this. (By using dim):-)

Thanks for the great explanation.  I am not having a problem and have been able to send test messages at will.  I love it when a plan comes together!

Regards,


Walker Powell
Pacer International IT
6805 Perimeter Dr.
Dublin, OH 43016
walker.powell@xxxxxxxxx
614.356.1257 office
614.923.1442 fax

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wed, October 31, 2007 1:22 PM
To: HTTPAPI and FTPAPI Projects
Subject: 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:

<Sample>
    <anyType>P</anyType>
    <anyType>Success</anyType>
</Sample>

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 name.

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:
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
-----------------------------------------------------------------------