BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Character encoding in SOAP-message

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi WebServices SOAP
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Mon Apr 02, 2007 8:12 am    Post subject: Character encoding in SOAP-message Reply with quote



Hi all,

We have a soap webservice built with Delphi 6.
The service has a funcion with three string-paramaters, one of which
is used to pass xml-data.

The service gets called by another party who uses Uniface to call our
webservice.
They get the following error when special character are used (like
"ë"):
"<SOAP-ENV:faultstring>An invalid character was found in text
content."

When I call the service with a testtool built with D6, I can use such
characters and no problem occurs.

So, the call doesn't get past the soap-middelware.

Here's an axample of a call, wich, when called from my machine gives
no error:

<?xml version='1.0' encoding='ISO-8859-1'?>
<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:SOAP-
ENC='http://schemas.xmlsoap.org/soap/encoding/'>
<SOAP-ENV:Body SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/
encoding/'>
<NS1:echoAdvies xmlns:NS1='urn:adviesIntf-Iadvies'>
<username xsi:type='xsd:string'>test</username>
<password xsi:type='xsd:string'>test</password>
<query xsi:type='xsd:string'><?xml version="1.0"
encoding="ISO-8859-1"?><vraag xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="c:\\source\\test\\xml\
\query.xsd"> <Special character: ë>BRN</bron></
vraag></query>
</NS1:echoAdvies>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Any ideas?
Back to top
Joe Fawcett
Guest





PostPosted: Tue Apr 03, 2007 8:13 am    Post subject: Re: Character encoding in SOAP-message Reply with quote



<berryv (AT) gmail (DOT) com> wrote in message
news:1175501188.146830.74710 (AT) p77g2000hsh (DOT) googlegroups.com...
Hi all,

We have a soap webservice built with Delphi 6.
The service has a funcion with three string-paramaters, one of which
is used to pass xml-data.

The service gets called by another party who uses Uniface to call our
webservice.
They get the following error when special character are used (like
"ë"):
"<SOAP-ENV:faultstring>An invalid character was found in text
content."

When I call the service with a testtool built with D6, I can use such
characters and no problem occurs.

So, the call doesn't get past the soap-middelware.

Here's an axample of a call, wich, when called from my machine gives
no error:

<?xml version='1.0' encoding='ISO-8859-1'?>
<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:SOAP-
ENC='http://schemas.xmlsoap.org/soap/encoding/'>
<SOAP-ENV:Body SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/
encoding/'>
<NS1:echoAdvies xmlns:NS1='urn:adviesIntf-Iadvies'>
<username xsi:type='xsd:string'>test</username>
<password xsi:type='xsd:string'>test</password>
<query xsi:type='xsd:string'><?xml version="1.0"
encoding="ISO-8859-1"?><vraag xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="c:\\source\\test\\xml\
\query.xsd"> <Special character: ë>BRN</bron></
vraag></query>
</NS1:echoAdvies>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Any ideas?

Errors like that normally mean that the encoding declared in the XML,
'ISO-8859-1', in this case is not the actual encoding used. How do you
specify the encoding in your service. I would suggest changing the
decalration to UTF-16 or UTF-8 anyway, why restrict yourselves?

--

Joe Fawcett (MVP - XML)

http://joe.fawcett.name
Back to top
Guest






PostPosted: Wed Apr 04, 2007 4:13 pm    Post subject: Re: Character encoding in SOAP-message Reply with quote



On Apr 3, 9:16 am, "Joe Fawcett" <joefawc...@newsgroup.nospam> wrote:
Quote:
Errors like that normally mean that the encoding declared in the XML,
'ISO-8859-1', in this case is not the actual encoding used. How do you
specify the encoding in your service. I would suggest changing the
decalration to UTF-16 or UTF-8 anyway, why restrict yourselves?


Thank you for answering.

I've used a sniffer to see what actually goes over the line. I've uses
different clients to test it. Using Perl I managed to reproduce the
problem.
When I use Perl (Soap::Lite) I can set the encoding. When I set the
encoding to ISO-8859-1 the client generates an http request with in
it's request-header this ISO encoding. The acual message (the soap-
envelope) uses ISO-encoding (I can see the codes using the sniffer).
This client generates no error. When I set the encoding to utf-8 the
http header states utf-8. The actual message, though, is encoded in
ISO. This version gives the soap-error.

When I use a javascript-client, I can set the http-header to ISO and
to utf-8. Both versions, however, code their content in uft-8!?!
Neither one of these clients gives an error. It seems that the
receiving soap-server knows which encoding is used, but it doesn't
look at the request-header. How can the server tell which encoding is
used?

Thanks.
Berry
Back to top
Joe Fawcett
Guest





PostPosted: Thu Apr 05, 2007 8:53 pm    Post subject: Re: Character encoding in SOAP-message Reply with quote

I'm not sure as I don't know much about Delphi or your web server.
If it ignores the request header for the encoding then it must be working it
out from the actual file, reading the first few characters and deciding.
Does that mean it's working now or do you still have a problem?

--

Joe Fawcett (MVP - XML)
http://joe.fawcett.name

<berryv (AT) gmail (DOT) com> wrote in message
news:1175685227.545085.53250 (AT) y66g2000hsf (DOT) googlegroups.com...
Quote:
On Apr 3, 9:16 am, "Joe Fawcett" <joefawc...@newsgroup.nospam> wrote:
Errors like that normally mean that the encoding declared in the XML,
'ISO-8859-1', in this case is not the actual encoding used. How do you
specify the encoding in your service. I would suggest changing the
decalration to UTF-16 or UTF-8 anyway, why restrict yourselves?


Thank you for answering.

I've used a sniffer to see what actually goes over the line. I've uses
different clients to test it. Using Perl I managed to reproduce the
problem.
When I use Perl (Soap::Lite) I can set the encoding. When I set the
encoding to ISO-8859-1 the client generates an http request with in
it's request-header this ISO encoding. The acual message (the soap-
envelope) uses ISO-encoding (I can see the codes using the sniffer).
This client generates no error. When I set the encoding to utf-8 the
http header states utf-8. The actual message, though, is encoded in
ISO. This version gives the soap-error.

When I use a javascript-client, I can set the http-header to ISO and
to utf-8. Both versions, however, code their content in uft-8!?!
Neither one of these clients gives an error. It seems that the
receiving soap-server knows which encoding is used, but it doesn't
look at the request-header. How can the server tell which encoding is
used?

Thanks.
Berry
Back to top
Guest






PostPosted: Thu Apr 05, 2007 10:32 pm    Post subject: Re: Character encoding in SOAP-message Reply with quote

On 5 apr, 17:53, "Joe Fawcett" <joefawc...@newsgroup.nospam> wrote:
Quote:
I'm not sure as I don't know much about Delphi or your web server.
If it ignores the request header for the encoding then it must be working it
out from the actual file, reading the first few characters and deciding.
Does that mean it's working now or do you still have a problem?

I still have the problem. I've compared the http-contents. It seems
that the http-header goes over the line first., then the actual
content goes over the line. The content can have a different
character-encoding than the header. The first few bytes of the content
are binary-data. Maybe that's how the server knows the encoding used.
With my perl-testclient I can workt around the problem, but the party
who's connecting to our soapserver does not (for the moment, that is.
Their main developer is on vacation this week. He'll be back next
week. Then I'll ask him if he can alter the http-header to see if that
helps).

Berry
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi WebServices SOAP All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.