dbTalk Databases Forums  

WebService charset problem

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss WebService charset problem in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Arndt
 
Posts: n/a

Default WebService charset problem - 09-02-2010 , 03:14 AM






Hi,

i wrote this simple Procedure to consume a WebService.
When I call it it throws an Error 415 because of an unexpected charset
(see Log below)

How must I change the procedure to set the charset to utf-8?
If I create a new database with utf-8 collation the procedure works fine.


ALTER PROCEDURE "entwickler"."StringReverser.ReverseString"(
value long varchar )
url 'http://localhost:8000/Reverse' type
'SOAPOC' set
'SOAP(OP=ReverseString)' header
'SOAPAction:"http://tempuri.org/IStringReverser/ReverseString"' namespace
'http://tempuri.org/'

<?xml version="1.0"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://tempuri.org/">
<SOAP-ENV:Body>
<m:ReverseString>
<m:value>test</m:value>
</m:ReverseString>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
[connid = 14, 02.09 10:00:51.178, RESPONSE]
HTTP/1.1 415 Cannot process the message because the content type
'text/xml; charset=ISO-8859-15' was not the expected type 'text/xml;
charset=utf-8'.
Keep-Alive: true
Content-Length: 0
Server: Microsoft-HTTPAPI/2.0
Date: Thu, 02 Sep 2010 08:00:51 GMT
Connection: close

Thanks

Reply With Quote
  #2  
Old   
Nick Elson [Sybase An SAP Company]
 
Posts: n/a

Default Re: WebService charset problem - 09-02-2010 , 04:17 PM






This sounds like it could be something as simple as adding

HEADER Accept-Charset=utf8

after your
type 'SOAPOC'

http://dcx.sybase.com/index.html#110....html*d5e32090
http://dcx.sybase.com/index.html#110...ders-http.html
http://www.w3.org/Protocols/rfc2616/...4.html#sec14.2


"Arndt" <elke-arndt (AT) web (DOT) de> wrote

Quote:
Hi,

i wrote this simple Procedure to consume a WebService.
When I call it it throws an Error 415 because of an unexpected charset
(see Log below)

How must I change the procedure to set the charset to utf-8?
If I create a new database with utf-8 collation the procedure works fine.


ALTER PROCEDURE "entwickler"."StringReverser.ReverseString"(
value long varchar )
url 'http://localhost:8000/Reverse' type
'SOAPOC' set
'SOAP(OP=ReverseString)' header
'SOAPAction:"http://tempuri.org/IStringReverser/ReverseString"' namespace
'http://tempuri.org/'

?xml version="1.0"?
SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://tempuri.org/"
SOAP-ENV:Body
m:ReverseString
m:value>test</m:value
/m:ReverseString
/SOAP-ENV:Body
/SOAP-ENV:Envelope
[connid = 14, 02.09 10:00:51.178, RESPONSE]
HTTP/1.1 415 Cannot process the message because the content type
'text/xml; charset=ISO-8859-15' was not the expected type 'text/xml;
charset=utf-8'.
Keep-Alive: true
Content-Length: 0
Server: Microsoft-HTTPAPI/2.0
Date: Thu, 02 Sep 2010 08:00:51 GMT
Connection: close

Thanks

Reply With Quote
  #3  
Old   
Arndt
 
Posts: n/a

Default Re: WebService charset problem - 09-03-2010 , 05:18 AM



Am 02.09.2010 23:17, schrieb Nick Elson [Sybase An SAP Company]:
Quote:
This sounds like it could be something as simple as adding

HEADER Accept-Charset=utf8

after your
type 'SOAPOC'

http://dcx.sybase.com/index.html#110....html*d5e32090

http://dcx.sybase.com/index.html#110...ders-http.html

http://www.w3.org/Protocols/rfc2616/...4.html#sec14.2


"Arndt" <elke-arndt (AT) web (DOT) de> wrote in message
news:4c7f5cfb$1 (AT) forums-1-dub (DOT) ..
Hi,

i wrote this simple Procedure to consume a WebService.
When I call it it throws an Error 415 because of an unexpected charset
(see Log below)

How must I change the procedure to set the charset to utf-8?
If I create a new database with utf-8 collation the procedure works fine.


ALTER PROCEDURE "entwickler"."StringReverser.ReverseString"(
value long varchar )
url 'http://localhost:8000/Reverse' type
'SOAPOC' set
'SOAP(OP=ReverseString)' header
'SOAPAction:"http://tempuri.org/IStringReverser/ReverseString"' namespace
'http://tempuri.org/'

?xml version="1.0"?
SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://tempuri.org/"
SOAP-ENV:Body
m:ReverseString
m:value>test</m:value
/m:ReverseString
/SOAP-ENV:Body
/SOAP-ENV:Envelope
[connid = 14, 02.09 10:00:51.178, RESPONSE]
HTTP/1.1 415 Cannot process the message because the content type
'text/xml; charset=ISO-8859-15' was not the expected type 'text/xml;
charset=utf-8'.
Keep-Alive: true
Content-Length: 0
Server: Microsoft-HTTPAPI/2.0
Date: Thu, 02 Sep 2010 08:00:51 GMT
Connection: close

Thanks

Thanks Nick,

but I don't get it to work.
Your links are very informatively. I think the right syntax has to be:
ALTER PROCEDURE "entwickler"."StringReverser.ReverseString"(
value long varchar )
url 'http://localhost:8000/Reverse' type
'SOAPOC' set
'SOAP(OP=ReverseString)' header
'Accept-Charset:utf-8\nSOAPAction:"http://tempuri.org/IStringReverser/ReverseString"'
namespace
'http://tempuri.org/'

I tried several others, but the Error is still the same.

Reply With Quote
  #4  
Old   
Nick Elson [Sybase An SAP Company]
 
Posts: n/a

Default Re: WebService charset problem - 09-03-2010 , 03:31 PM



It seems you will want to investigate the use of

sa_set_http_option( )

for this. In my rush I rejected that thinking it would
only be of use for HTTP responses but according to
the docs the Accept-Charset request header can
also be set using this (that and the very next paragraph
describes the behaviour you are currently seeing
as well).

http://dcx.sybase.com/index.html#110...p-option1.html

Hope that helps.

"Arndt" <elke-arndt (AT) web (DOT) de> wrote

Quote:
Am 02.09.2010 23:17, schrieb Nick Elson [Sybase An SAP Company]:
This sounds like it could be something as simple as adding

HEADER Accept-Charset=utf8

after your
type 'SOAPOC'

http://dcx.sybase.com/index.html#110....html*d5e32090

http://dcx.sybase.com/index.html#110...ders-http.html

http://www.w3.org/Protocols/rfc2616/...4.html#sec14.2


"Arndt" <elke-arndt (AT) web (DOT) de> wrote in message
news:4c7f5cfb$1 (AT) forums-1-dub (DOT) ..
Hi,

i wrote this simple Procedure to consume a WebService.
When I call it it throws an Error 415 because of an unexpected charset
(see Log below)

How must I change the procedure to set the charset to utf-8?
If I create a new database with utf-8 collation the procedure works
fine.


ALTER PROCEDURE "entwickler"."StringReverser.ReverseString"(
value long varchar )
url 'http://localhost:8000/Reverse' type
'SOAPOC' set
'SOAP(OP=ReverseString)' header
'SOAPAction:"http://tempuri.org/IStringReverser/ReverseString"'
namespace
'http://tempuri.org/'

?xml version="1.0"?
SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://tempuri.org/"
SOAP-ENV:Body
m:ReverseString
m:value>test</m:value
/m:ReverseString
/SOAP-ENV:Body
/SOAP-ENV:Envelope
[connid = 14, 02.09 10:00:51.178, RESPONSE]
HTTP/1.1 415 Cannot process the message because the content type
'text/xml; charset=ISO-8859-15' was not the expected type 'text/xml;
charset=utf-8'.
Keep-Alive: true
Content-Length: 0
Server: Microsoft-HTTPAPI/2.0
Date: Thu, 02 Sep 2010 08:00:51 GMT
Connection: close

Thanks

Thanks Nick,

but I don't get it to work.
Your links are very informatively. I think the right syntax has to be:
ALTER PROCEDURE "entwickler"."StringReverser.ReverseString"(
value long varchar )
url 'http://localhost:8000/Reverse' type
'SOAPOC' set
'SOAP(OP=ReverseString)' header
'Accept-Charset:utf-8\nSOAPAction:"http://tempuri.org/IStringReverser/ReverseString"'
namespace
'http://tempuri.org/'

I tried several others, but the Error is still the same.


Reply With Quote
  #5  
Old   
Arndt
 
Posts: n/a

Default Re: WebService charset problem - 09-06-2010 , 12:38 AM



Am 03.09.2010 22:31, schrieb Nick Elson [Sybase An SAP Company]:
Quote:
It seems you will want to investigate the use of

sa_set_http_option( )

for this. In my rush I rejected that thinking it would
only be of use for HTTP responses but according to
the docs the Accept-Charset request header can
also be set using this (that and the very next paragraph
describes the behaviour you are currently seeing
as well).

http://dcx.sybase.com/index.html#110...p-option1.html


Hope that helps.

"Arndt" <elke-arndt (AT) web (DOT) de> wrote

Am 02.09.2010 23:17, schrieb Nick Elson [Sybase An SAP Company]:
This sounds like it could be something as simple as adding

HEADER Accept-Charset=utf8

after your
type 'SOAPOC'

http://dcx.sybase.com/index.html#110....html*d5e32090


http://dcx.sybase.com/index.html#110...ders-http.html


http://www.w3.org/Protocols/rfc2616/...4.html#sec14.2


"Arndt" <elke-arndt (AT) web (DOT) de> wrote in message
news:4c7f5cfb$1 (AT) forums-1-dub (DOT) ..
Hi,

i wrote this simple Procedure to consume a WebService.
When I call it it throws an Error 415 because of an unexpected charset
(see Log below)

How must I change the procedure to set the charset to utf-8?
If I create a new database with utf-8 collation the procedure works
fine.


ALTER PROCEDURE "entwickler"."StringReverser.ReverseString"(
value long varchar )
url 'http://localhost:8000/Reverse' type
'SOAPOC' set
'SOAP(OP=ReverseString)' header
'SOAPAction:"http://tempuri.org/IStringReverser/ReverseString"'
namespace
'http://tempuri.org/'

?xml version="1.0"?
SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://tempuri.org/"
SOAP-ENV:Body
m:ReverseString
m:value>test</m:value
/m:ReverseString
/SOAP-ENV:Body
/SOAP-ENV:Envelope
[connid = 14, 02.09 10:00:51.178, RESPONSE]
HTTP/1.1 415 Cannot process the message because the content type
'text/xml; charset=ISO-8859-15' was not the expected type 'text/xml;
charset=utf-8'.
Keep-Alive: true
Content-Length: 0
Server: Microsoft-HTTPAPI/2.0
Date: Thu, 02 Sep 2010 08:00:51 GMT
Connection: close

Thanks

Thanks Nick,

but I don't get it to work.
Your links are very informatively. I think the right syntax has to be:
ALTER PROCEDURE "entwickler"."StringReverser.ReverseString"(
value long varchar )
url 'http://localhost:8000/Reverse' type
'SOAPOC' set
'SOAP(OP=ReverseString)' header
'Accept-Charset:utf-8\nSOAPAction:"http://tempuri.org/IStringReverser/ReverseString"'
namespace
'http://tempuri.org/'

I tried several others, but the Error is still the same.



Hi Nick,

i find the solution.
As you assume I have to overwrite the soap header. But I have to use the
content-type attribute.
header 'Content-Type: text/xml;
charset=utf-8\nAccept-Charset:utf-8\x0ASOAPAction:"http://tempuri.org/IStringReverser/ReverseString"'

BTW the sa_set_http_option( ) will only help if i am the WebService
Server and not the Client.

Thanks for help

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.