[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: I would like to parse CDATA !
Hello,
The web service is sending you data where the XML tags have been escaped 
so that there's no chance of a conflict between the XML tags in the 
response and the tags in the SOAP envelope.  This is very common.
The solution is very simple.  Just have your end-tag-handler (often 
called "Incoming", though you can call it anything you choose) save it 
to a temporary IFS file.  Then, parse that IFS file.
Here are some examples of doing that (these are old examples, I haven't 
tried them recently to see if the web services are still offered -- but 
either way, I hope the RPG code illustrates what you need to do.)
http://www.scottklement.com/httpapi/bankrout.txt
http://www.scottklement.com/httpapi/vattest-rpgle.txt
As for the 
 stuff -- I'm hoping that these are normal XML entities 
that will be fixed by doing the 2nd XML parse, as described above.  If 
they are not, consider using RPG's %scan & %replace functions to scan 
for them and remove them from the document.  Since others don't seem to 
have problems with this, I don't think it makes sense to make it part of 
HTTPAPI.
Alain RUAS wrote:
>    Hi,
> 
> 
>    I'm consuming a web service with HTTPAPI.
> 
> 
>    The web service response is a quite long XML flow like this :
> 
> 
>    <?xml version="1.0" ?>
> 
>    <S:Envelope
>    xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><construct
>    ionOutput xmlns="http://drc99.euronautical.com/">
> 
>    <?xml version="1.0" encoding="ISO-8859-1"
>    ?>
> 
>    <drcresp version="1.0" reqid="tstaru">
> 
>    <constructed>
> 
>    <inp>
> 
>    <dept type="icao">ORY</dept>
> 
>    <dest type="icao">TLS</dest>
> 
>    etc ..
> 
> 
>    If I replace < ; " ; etc .. by the right signs, the result is :
> 
>    <?xml version="1.0" ?>
> 
>    <S:Envelope
>    xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><construct
>    ionOutput xmlns="http://drc99.euronautical.com/">
> 
>    <?xml version= `'1.0'' encoding=''ISO-8859-1'' ?>
> 
>    <drcresp version=''1.0'' reqid=''tstaru''>
> 
>    <constructed>
> 
>    <inp>
> 
>    <dept type=''icao''>ORY</dept>
> 
>    <dest type=`'icao''>TLS</dest>
> 
>    etc ..
> 
> 
>    All the text constructed as CDATA is, in fact, true XML.
> 
> 
>    Is there a solution to force the API to parse it ?
> 
> 
>    May I have help ?
> 
> 
>    In addition, is it possible to make "http_XmlStripCRLF(*ON/*OFF)"
> 
>    able  to manage 
> 
> 
>    Best regards
> 
> 
>    Alain RUAS
> 
>    Technical Manager
> 
>    (33) 562 747 500
> 
> 
> 
> ------------------------------------------------------------------------
> 
> -----------------------------------------------------------------------
> 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
-----------------------------------------------------------------------