Content type failure in webservice call

P

Pedro Gonçalves

Hi,

I developed a web service and a mobile application to access to it.

When the mobile application call the webservice it raises the error message
'server found request content to be 'text/html;charset=utf-8', but expected
'text/xml'.

Is there anyone that can help me find out how to solve this problem?

Regards,
Pedro Gonçalves
 
R

recoil

Hello Pedro. Can you be more clear on how you are accessing the Web Service.
Are you using the proxy generated by Visual Studio? are you using some soap
library? Are you using some HTTP GET/POST methods?

Thanks.
 
P

Pedro Gonçalves

Hi all,

I think I found the problem:

I was calling the webservice to pass a string that was a code bar EAN128. It
happens that that code bar has a ASCII 29 char on it, and it seams that the
serialization of that char was bad, and generated the error.

First I tried to replace that char before call the web service by a ASCII
200 and then on the web service replace it again. It worked!

Now I first convert the code bar to a byte array before call the webservice
that now receives a byte array instead of a string.

I was using a string simply because the code bar reader gives me a string.

Thanks for all your help.

Regards,
Pedro Gonçalves
 
P

Pedro Gonçalves

Hi again,

After all, the problem is not solved. I still getting the same error in
other calls that use strings as parameters.

To answer to Gaurav, I use the proxy created automatically by VS2003.

And this problem sometimes occurs other times no. I think this have
something to do with compilation of the application.

My web server is a Win2003 with IIS 6.0. I'm using 2.0 version of the .NET
Framework in the webservice application.

I hope this extra information helps.

Regards,
Pedro Gonçalves
 
P

Pedro Gonçalves

I'm sorry, I was wrong. It still hapening.

Pedro Gonçalves said:
Hi all,

I think I found the problem:

I was calling the webservice to pass a string that was a code bar EAN128. It
happens that that code bar has a ASCII 29 char on it, and it seams that the
serialization of that char was bad, and generated the error.

First I tried to replace that char before call the web service by a ASCII
200 and then on the web service replace it again. It worked!

Now I first convert the code bar to a byte array before call the webservice
that now receives a byte array instead of a string.

I was using a string simply because the code bar reader gives me a string.

Thanks for all your help.

Regards,
Pedro Gonçalves
 
R

recoil

Hello Pedro. You may be onto something when you stated that it was character
encoding. There is a function that converts bytes to Base64 Strings. I would
advise trying to see if doing this solves the problem.
Convert.ToBase64String/Convert.ToFrom64String. If you look at the msdn
documetnationf or the Convert namespace you will see 4 methods for converting
to and from base64. Also what might be useful is packet sniffing and
comparing the packet sniffs of something that works versus one that doesn't
and seeing the data that transpires between them.
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top