471,603 Members | 1,484 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,603 software developers and data experts.

Web services - InvalidOperationException

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,

--
Daan
Dec 1 '05 #1
2 2536
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Daan" <d_*****@IDONTLIKESPAMhotmail.com> wrote in message
news:dm**********@netlx020.civ.utwente.nl...
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,

--
Daan

Dec 1 '05 #2
Nicholas Paldino [.NET/C# MVP] wrote:
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
Dec 3 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Bryan Dickerson | last post: by
reply views Thread by Perjan | last post: by
2 posts views Thread by koredump | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.