WebService Response Encoding

WebService Response Encoding

Post by JB Wals » Wed, 17 Jul 2002 06:36:58



The project that I am currently working on uses a custom
component for requesting content via http from a web
service.  The component is used similar to the Load
function on the Microsoft IE parser (which I would love to
use but cannot due to project requirements).  

Unfortunately, the component seems to not like data being
returned to it unless the encoding is utf-8. It returns a
successful status code (meaning it successfully called the
page) but no content is returned when I call my web
service.

I am guessing that encoding is the issue because when I
call a static xml file, html file or classic asp page
containing the same content it pulls the data
successfully.  In addition, if I call an ASP.NET page for
the content it will only return the data if I put the
following meta tag within the content:
<META http-equiv="Content-Type" content="charset=utf-8">

So, that being said ... I have checked the machine.config
file encoding settings, the web.config file encoding
settings and even tried putting the above string in the
response from my service ... none works ...

I would like to know all of the possible ways to set the
output response encoding for the web service or other ways
to insert meta data into the response (aside from
appending it to my output string). In addition, if someone
thinks I am barking up the wrong tree please let me
know ...

Thanks in advance.

PS: Please don't tell me I am a fool or something because
I am not using SOAP to make the calls, etc. I would love
to ditch this component but my requirments dictate
otherwise.

 
 
 

WebService Response Encoding

Post by Jayme C. Edwards [MVP » Wed, 17 Jul 2002 07:04:31


So you are trying to download existing HTML files and use
them kind of like a web service, but you need them to
have the META tag that specifies UTF-8 encoding for your
client to work? The only ways I can think of
accomplishing this is:

A) Write an .aspx page that takes as a QueryString
parameter the URL of the real file you want, and using
the Regular Expression packages in .NET download that
file, parse it, and insert the META tag into the document
before returning it.

B) Get access to the source code for each static HTML
file and add the META tag manually.

You are correct, SOAP is a better solution for you if you
were able to use it per your project requirements.

Jayme C. Edwards
Software Architect
Rockwell Software
Microsoft MVP for Microsoft.NET

Quote:>-----Original Message-----
>The project that I am currently working on uses a custom
>component for requesting content via http from a web
>service.  The component is used similar to the Load
>function on the Microsoft IE parser (which I would love
to
>use but cannot due to project requirements).  

>Unfortunately, the component seems to not like data
being
>returned to it unless the encoding is utf-8. It returns
a
>successful status code (meaning it successfully called
the
>page) but no content is returned when I call my web
>service.

>I am guessing that encoding is the issue because when I
>call a static xml file, html file or classic asp page
>containing the same content it pulls the data
>successfully.  In addition, if I call an ASP.NET page
for
>the content it will only return the data if I put the
>following meta tag within the content:
><META http-equiv="Content-Type" content="charset=utf-8">

>So, that being said ... I have checked the
machine.config
>file encoding settings, the web.config file encoding
>settings and even tried putting the above string in the
>response from my service ... none works ...

>I would like to know all of the possible ways to set the
>output response encoding for the web service or other
ways
>to insert meta data into the response (aside from
>appending it to my output string). In addition, if
someone
>thinks I am barking up the wrong tree please let me
>know ...

>Thanks in advance.

>PS: Please don't tell me I am a fool or something
because
>I am not using SOAP to make the calls, etc. I would love
>to ditch this component but my requirments dictate
>otherwise.
>.


 
 
 

WebService Response Encoding

Post by JB Wals » Thu, 18 Jul 2002 06:23:11


Actually no, one of my examples that I am able to already
do is add the meta tag to an asp.net page ... that works.  

What I cant do ... but need to do ... is call a webservice
to get the data.  Unfortunately, the component that I am
using will not consume the data from the webservice
because the component does not think it is utf-8 encoded
(because of the missing meta tag) ...

Unfortunately, because webservice responses are strongly
typed there is a wrapper tag around the data that is
returned signifying the response is a string.  The wrapper
tag causes makes it so that when i add the utf-8 meta tag
to my string ... the component ignores it ... and thinks
it is not encoded properly ...

If I could get the header information to contain the meta
tag by setting some .net config settings etc ... maybe
that would work but I have already set the response
encoding properties in the web.config file, etc ... and it
still doesnt work ... just looking for some additional
settings that I may not be aware of that affect output
encoding from the web service ...

thanks ...

Quote:>-----Original Message-----
>So you are trying to download existing HTML files and use
>them kind of like a web service, but you need them to
>have the META tag that specifies UTF-8 encoding for your
>client to work? The only ways I can think of
>accomplishing this is:

>A) Write an .aspx page that takes as a QueryString
>parameter the URL of the real file you want, and using
>the Regular Expression packages in .NET download that
>file, parse it, and insert the META tag into the document
>before returning it.

>B) Get access to the source code for each static HTML
>file and add the META tag manually.

>You are correct, SOAP is a better solution for you if you
>were able to use it per your project requirements.

>Jayme C. Edwards
>Software Architect
>Rockwell Software
>Microsoft MVP for Microsoft.NET

>>-----Original Message-----
>>The project that I am currently working on uses a custom
>>component for requesting content via http from a web
>>service.  The component is used similar to the Load
>>function on the Microsoft IE parser (which I would love
>to
>>use but cannot due to project requirements).  

>>Unfortunately, the component seems to not like data
>being
>>returned to it unless the encoding is utf-8. It returns
>a
>>successful status code (meaning it successfully called
>the
>>page) but no content is returned when I call my web
>>service.

>>I am guessing that encoding is the issue because when I
>>call a static xml file, html file or classic asp page
>>containing the same content it pulls the data
>>successfully.  In addition, if I call an ASP.NET page
>for
>>the content it will only return the data if I put the
>>following meta tag within the content:
>><META http-equiv="Content-Type" content="charset=utf-8">

>>So, that being said ... I have checked the
>machine.config
>>file encoding settings, the web.config file encoding
>>settings and even tried putting the above string in the
>>response from my service ... none works ...

>>I would like to know all of the possible ways to set the
>>output response encoding for the web service or other
>ways
>>to insert meta data into the response (aside from
>>appending it to my output string). In addition, if
>someone
>>thinks I am barking up the wrong tree please let me
>>know ...

>>Thanks in advance.

>>PS: Please don't tell me I am a fool or something
>because
>>I am not using SOAP to make the calls, etc. I would love
>>to ditch this component but my requirments dictate
>>otherwise.
>>.

>.

 
 
 

1. XML encoding in SOAP response.

Hello all,
     I have written a web-service which has a method that has return value
as a structure.
I have a VC++ proxy class for this web-service which calls this web-service
method to get the SOAP
response in an XML.
 The default XML encoding in the SOAP response seems to be "utf-8".
How can I change it to something else ?
 I have tried modifying Globalization settings in the web.config of the
web-service to change the
'responseEncoding' setting , but that doesn't seem to help.

Thanks in advance.

-Rishi

2. Need help interpreting a formula. Please!

3. Getting desperate...soap header encoding - xml webservice - iso-8859-2

4. External Modem on Toshiba Laptop problem

5. xmlDeclaration encoding webservice

6. Borland C++ 5.5 and CPU optimizations

7. How can I force .NET Beta 2 WebService to use an encoding scheme?

8. US-IL-CHICAGO ORACLE DBA, Client/Server P/A

9. XMLDSO, Webservices and encoding

10. webservice.htc and encoding problem

11. Getting desperate...soap header encoding - xml webservice - iso-8859-2

12. Webservice html encodes String datatype

13. Getting desperate...soap header encoding - xml webservice - iso-8859-2