How to make a XML Message ?

Hi All,

Actually I am trying to implement a RESt API where in I will get ZIPCODE as request and I need to call external API which will take ZIPCODE as input and give State and City in response.

But the problem is the request is in XML Format and also response is in XML format.

Example :

https://XYZ.com/ABC.dll?API=CSLookUP&XML=<CSLookupRequest USERID="USERID">
<ZipCode ID='0'>
<Zip5>20024</Zip5>
</ZipCode>
</CityStateLookupRequest>

and in Response 

<?xml version="1.0" encoding="UTF-8"?>
<CSLookupResponse>
    <ZipCode ID="0">
        <Zip5>20024</Zip5>
        <City>WASHINGTON</City>
        <State>DC</State>
    </ZipCode>
</CSLookupResponse>

So Basically,
1) How can I create a XML message where in I can pass ZIPCODE and send in Request URL and

2) How to read the XML response like State and City from XML.

  • 0
  • 0
  • 156
  • 1
  • 1

Respuestas

If you have an XSD, it's as simple as importing it and using imported classes.

If you do not have a schema, you'll need to either generate an XSD from XML (there are many tools online) or just plain create Caché classes and make them XML-enabled.

Documentation:

That said, is XML really a part of the url?