Hello,
I am trying to call an Asp.net web service.
This is my web service link:
mnsoft-001-site1.itempurl.com/iSIte.asmx?op=getCities
The web service should return string list and it is tested before and working.
And this is my code:
char servername[] = "mnsoft-001-site1.itempurl.com";
// char servername[] = "http://mnsoft-001-site1.itempurl.com";
void setup()
{
Serial.begin(9600);
//***** Wifi connection code
if (client.connect(servername, 80))
{
client.println(("POST /iSite.asmx HTTP/1.1"));
client.println(("Host: mnsoft-001-site1.itempurl.com"));
// client.println(("Host: http://mnsoft-001-site1.itempurl.com"));
// client.println(("Connection: Keep-Alive"));
client.println(("Connection: Close"));
// client.println(("Cache-Control: no-cache"));
client.println(("Content-Type: text/xml; charset=utf-8"));
client.println(("Content-Length: 326"));
client.println(("SOAPAction: \"http://tempuri.org/getCities\""));
// client.println(("SOAPAction: \"mnsoft-001-site1.itempurl.com/getCities\""));
client.println();
client.println(("<?xml version=\"1.0\" encoding=\"utf-8\"?>"));
client.println(("<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"));
client.println(("<soap:Body>"));
client.println(("<getCities xmlns=\"http://tempuri.org/\">"));
client.println(("<companyId>\"1\"</companyId>"));
client.println(("</getCities>"));
client.println(("</soap:Body>"));
client.println(("</soap:Envelope>"));
}
}
void loop()
{
while (client.connected())
{
if (client.available())
{
char c = client.read();
Serial.print(c);
}
}
}
And i got this error
HTTP1.1 400 Bad Request
Cache-Control private
Content-Type textxml; charset=utf-8
Server Microsoft-IIS8.5
X-AspNet-Version 4.0.30319
X-Powered-By ASP.NET
Date Tue, 22 May 2018 195340 GMT
Connection close
Content-Length 0
I tried to use the commented lines in code but it did not work also.
Thanks for any help you can give to solve this error.