Discussion:
WebService charset problem
(too old to reply)
Arndt
2010-09-02 08:14:51 UTC
Permalink
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
'SOAP:DOC' 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
Arndt
2010-09-03 10:18:27 UTC
Permalink
This sounds like it could be something as simple as adding
HEADER Accept-Charset=utf8
after your
type 'SOAP:DOC'
http://dcx.sybase.com/index.html#1101en/dbreference_en11/create-procedure-statement.html*d5e32090
http://dcx.sybase.com/index.html#1101en/dbprogramming_en11/headers-http.html
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.2
Post by Arndt
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
'SOAP:DOC' 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
'SOAP:DOC' 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.
"Nick Elson [Sybase An SAP Company]" <@@@@com@>
2010-09-03 20:31:06 UTC
Permalink
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#1101en/dbreference_en11/sa-set-http-option1.html

Hope that helps.
Post by Arndt
This sounds like it could be something as simple as adding
HEADER Accept-Charset=utf8
after your
type 'SOAP:DOC'
http://dcx.sybase.com/index.html#1101en/dbreference_en11/create-procedure-statement.html*d5e32090
http://dcx.sybase.com/index.html#1101en/dbprogramming_en11/headers-http.html
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.2
Post by Arndt
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
'SOAP:DOC' 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.
ALTER PROCEDURE "entwickler"."StringReverser.ReverseString"(
value long varchar )
url 'http://localhost:8000/Reverse' type
'SOAP:DOC' 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.
Arndt
2010-09-06 05:38:09 UTC
Permalink
Post by "Nick Elson [Sybase An SAP Company]" <@@@@com@>
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#1101en/dbreference_en11/sa-set-http-option1.html
Hope that helps.
Post by Arndt
This sounds like it could be something as simple as adding
HEADER Accept-Charset=utf8
after your
type 'SOAP:DOC'
http://dcx.sybase.com/index.html#1101en/dbreference_en11/create-procedure-statement.html*d5e32090
http://dcx.sybase.com/index.html#1101en/dbprogramming_en11/headers-http.html
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.2
Post by Arndt
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
'SOAP:DOC' 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.
ALTER PROCEDURE "entwickler"."StringReverser.ReverseString"(
value long varchar )
url 'http://localhost:8000/Reverse' type
'SOAP:DOC' 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

"Nick Elson [Sybase An SAP Company]" <@@@@com@>
2010-09-02 21:17:06 UTC
Permalink
This sounds like it could be something as simple as adding

HEADER Accept-Charset=utf8

after your
type 'SOAP:DOC'

http://dcx.sybase.com/index.html#1101en/dbreference_en11/create-procedure-statement.html*d5e32090
http://dcx.sybase.com/index.html#1101en/dbprogramming_en11/headers-http.html
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.2
Post by Arndt
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
'SOAP:DOC' 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
Loading...