ASI
ASI

Reputation:

Consuming PHP Web Service From C# Client

I am trying to consume a web service on an Apache/PHP server for which I only have the following example request as documentation.

POST /server/service.php HTTP/1.1
Host: server.example.com
ContentType: text/xml
ContentLength: xxx
<?xml version=\"1.0\"?>
<command>
    <parameters />
</command>

Every time I try to consume the service I get a HTTP 400 error. I have contacted the vendor of the software and they replied there is no problem with the server and attached a successful reply.

HTTP/1.1 200 OK
Date: 
Server: Apache/2.2.3 (Debian) PHP/5.2.0-8+etch7
X-Powered-By: PHP/5.2.0-8+etch7
Content-Length: 205
Connection: close
Content-Type: text/xml;charset=ISO-8859-1

<?xml version=\"1.0\"?>
<reply>
      <reply stuff />
</reply>

I have no idea what might be causing the HTTP 400 (Bad Request) response on my side. My best guess could either be an encoding problem of some sort or some incompatibility on the protocol side (or of course, bad programming).

Any help will be greatly appreciated!

Upvotes: 0

Views: 2271

Answers (2)

Oscar Cabrero
Oscar Cabrero

Reputation: 4169

you can use the WSDL.exe tool that microsoft provides, this tool can generate the proxy classes you need to connect to any web service that is SOAP compliant

also check that your XmlCommand is well formed

Upvotes: -1

Brian
Brian

Reputation: 118935

Consider using Fiddler to see exactly what your code is sending as the request (and consider sending the request to a service on your own box for testing).

Upvotes: 2

Related Questions