Forum Discussion
shabar
13 years agoContributor
Thanks for your reply.
I just tried the following publicly available web service. Even there XML request working fine but NOT the json one as below
XML Request
Response
Json Request
Jason Raw Request
Raw Response
After checking "http logs" couldn't find anything suspicious.
Can the service define as ONLY expect xml request?
I just tried the following publicly available web service. Even there XML request working fine but NOT the json one as below
XML Request
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://www.webserviceX.NET/">
<soap:Header/>
<soap:Body>
<web:ConversionRate>
<web:FromCurrency>USD</web:FromCurrency>
<web:ToCurrency>AUD</web:ToCurrency>
</web:ConversionRate>
</soap:Body>
</soap:Envelope>
Response
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<ConversionRateResponse xmlns="http://www.webserviceX.NET/">
<ConversionRateResult>1.0987</ConversionRateResult>
</ConversionRateResponse>
</soap:Body>
</soap:Envelope>
Json Request
{
"soap:Envelope": {
"-xmlns:soap": "http://www.w3.org/2003/05/soap-envelope",
"-xmlns:web": "http://www.webserviceX.NET/",
"soap:Body": {
"web:ConversionRate": {
"web:FromCurrency": "USD",
"web:ToCurrency": "AUD"
}
}
}
}
Jason Raw Request
POST http://www.webservicex.com/CurrencyConvertor.asmx HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/soap+xml;charset=UTF-8;action="http://www.webserviceX.NET/ConversionRate"
Content-Length: 269
Host: www.webservicex.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
{
"soap:Envelope": {
"-xmlns:soap": "http://www.w3.org/2003/05/soap-envelope",
"-xmlns:web": "http://www.webserviceX.NET/",
"soap:Body": {
"web:ConversionRate": {
"web:FromCurrency": "USD",
"web:ToCurrency": "AUD"
}
}
}
}
Raw Response
HTTP/1.1 400 Bad Request
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/html
Server: Microsoft-IIS/7.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Fri, 06 Dec 2013 23:55:54 GMT
Bad Request
After checking "http logs" couldn't find anything suspicious.
Can the service define as ONLY expect xml request?