Calling web service


I am trying to call an web service.
This is my web service link:
The web service should return string list and it is tested before and working.
And this is my code:

char servername[] = "";
// char servername[] = "";

void setup() 
   //***** Wifi connection code

    if (client.connect(servername, 80)) 
        client.println(("POST /iSite.asmx HTTP/1.1"));
//     client.println(("Host:"));
//      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: \"\""));
//        client.println(("SOAPAction: \"\""));
        client.println(("<?xml version=\"1.0\" encoding=\"utf-8\"?>"));
        client.println(("<soap:Envelope xmlns:xsi=\"\" xmlns:xsd=\"\" xmlns:soap=\"\">"));
        client.println(("<getCities xmlns=\"\">"));

void loop() 

  while (client.connected())
    if (client.available())
      char 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.

You should post your code in the </> tags.

You actually got a response so you are more than 50% there :slight_smile:

Try to find out what a system that works actually sends and receives. Wireshark may help in this.

If possible try your own code first against a webserver that you control so that you can look at its logs.

Any help please?