views:

522

answers:

2

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!

+2  A: 

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).

Brian
+1 and if that doesn't find the problem, try using a SOAP test client to debug the request itself. Likely the service isn't getting a field it wants, or getting something in a format it doesn't like.
Dana the Sane
A: 

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

Oscar Cabrero
This is not a SOAP web service, so WSDL.EXE won't help.
John Saunders