You need to sign in to do that
Don't have an account?
S Sai
how to parse Json Format
hi
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetCitiesByCountryResponse xmlns="http://www.webserviceX.NET">
<GetCitiesByCountryResult>
<NewDataSet>
<Table>
<Country>India</Country>
<City>Bangalore</City>
</Table>
</NewDataSet>
</GetCitiesByCountryResult>
</GetCitiesByCountryResponse>
</soap:Body>
</soap:Envelope>
Thanks
Sai
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetCitiesByCountryResponse xmlns="http://www.webserviceX.NET">
<GetCitiesByCountryResult>
<NewDataSet>
<Table>
<Country>India</Country>
<City>Bangalore</City>
</Table>
</NewDataSet>
</GetCitiesByCountryResult>
</GetCitiesByCountryResponse>
</soap:Body>
</soap:Envelope>
Thanks
Sai
1) http://www.utilities-online.info/xmltojson/#.VyBUffl97Dc
JSON Let us know if this will help you
Thanks
Amit Chaudhary
Thanks for your reply
public class CityFinder {
public static void FindCity(string Country){
httpRequest req = new httpRequest();
string endpoint='http://www.webservicex.net/globalweather.asmx/GetCitiesByCountry?CountryName='+Country;
req.setEndpoint(endpoint);
req.setMethod('GET');
req.setHeader('Accept', 'application/json;charset=UTF-8');
req.setTimeout(20000);
//req.setHeader('Content-Type', 'text/xml; charset=utf-8');
req.setHeader('SOAPAction','http://www.webserviceX.NET/GetCitiesByCountry');
system.debug('Req ########'+req);
Http http = new Http();
HTTPResponse res = http.send(req);
string bodyRes = res.getBody();
string r1 = bodyRes.replace('<','<');
string r2 = r1.replace('>','>');
system.debug('RESPONSE>>>>'+r2);
}
}
Here I am getting output
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetCitiesByCountryResponse xmlns="http://www.webserviceX.NET">
<GetCitiesByCountryResult>
<NewDataSet>
<Table>
<Country>India</Country>
<City>Bangalore</City>
</Table>
</NewDataSet>
</GetCitiesByCountryResult>
</GetCitiesByCountryResponse>
</soap:Body>
</soap:Envelope>
i want to display output is json format