Web services - InvalidOperationException

D

Daan

Hello all,

I have a project in Visual Studio, developing a .NET application for a
Windows Mobile 2003 device. This application needs to call a Web service
that is written in PHP, using the PEAR SOAP extensions (in my project,
this is a Web Reference pointing to the WSDL file of the PHP Web
service). Now I get the following Exception when running the app in an
emulator:

InvalidOperationException
client found response content type of 'text/html', but expected 'text/xml'

The strange thing is, that when I test the web service in a test tool
(Webservicestudio, SOAPsonar), it nicely returns text/xml, both with the
WSDL file and with the result from a request. Does anyone know these
symptoms and have a solution?

Thanks for any help or pointers,
 
N

Nicholas Paldino [.NET/C# MVP]

Daan,

On the server side, can you intercept the requests coming in, from both
your deployed app, and your test tool? If you could, then it would help
tremendously, since you could compare the requests side by side, and see
what differs.

Hope this helps.
 
D

Daan

Nicholas said:
Daan,

On the server side, can you intercept the requests coming in, from both
your deployed app, and your test tool? If you could, then it would help
tremendously, since you could compare the requests side by side, and see
what differs.

Hope this helps.

When the VS emulator sends the request, this happens:
1. HTTP POST request: Content-type: text/xml; charset=utf-8\r\n
Expect: 100-continue\r\n is sent

2. HTTP 100 Continue is received

3. HTTP packet is sent, but tool identifies content as "Data (256 bytes)"
It looks like this is sent:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schema.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:LoginServer" xmlns:types="urn:LoginServer/encodedTypes"
xmlns :xsi="http://w

4. Then another continuation is sent, also with "data", that looks like
this:
ww.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:q1="http://microsoft.com/wsdl/types/"><soap:Body
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><tns:login><username
xsi:type="sxd:string">ivarname</usrname><password
xsi:type="xsd:string">ivarpass</password><lastupdate
xsi:type="sxd:string">11/29/05 9:00:00
PM</lastupdate></tns:login></soap:Body></soap:Envelope>

5. An HTTP 200 OK (text/html) is sent back, containing some PHP
generated warnings (this explains the text/html exception, but I still
don't know why it is generated in case of the VS request, but not in
case of the test tool request)

6. The reponse from the web service is sent.

When the test clients sends the request, the following happens:

1. HTTP POST request: Content-type: text/xml; charset=utf-8\r\n
Expect: 100-continue\r\n is sent

2. HTTP 100 Continue is received

3. HTTP packet is sent, but tool identifies content as "Data (595 bytes)"
It looks like this is sent:

<xml version="1.0" encoding="utf-8">.<soap:Envelope
xmlns:soap="http://schames.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:LoginServer">. <soap:Body
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">.
<tns:login>.<username xsi:type="xsd:string">ivarname</username>.
<password xsi:type="xsd:string">ivarpass</password>.<lastupdate
xsd:type="sxd:dayTime"/> . </tns:login>. </soap:Body> .</soap:Envelope>

(strange that now these dots . appear sometimes)

4. A response is returned, which my tool can identify as xml in a HTTP
200 packet.

5. Two 'continuation of non-http traffic' messages are received,
containing the last bytes of the response that started with 4, but this
time it is just recongnised as 'data' instead of xml code.

Hope you can make sense of this and help me identify the problem.
Thanks for any input. Regards,

Daan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top