-
Nov 30th, 2007, 05:35 AM
#1
Special characters in soap request
Whenever i try to pass a special character like £ in my soap request the server throws an error instead of processing the request.Can anyone tell me how to resolve this problem
-
Dec 3rd, 2007, 05:18 AM
#2
If you send your requests as UTF-8, or even ISO 8859-1, there should be no problem. There character sets contain the £ sign.
-
Dec 3rd, 2007, 06:01 AM
#3
This is my request:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tws="http://test.com/types/TestEndpoint" env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<tws:InputRequest>TEST £ symbol
</tws:InputRequest>
</soapenv:Body>
</soapenv:Envelope>
No matter what encoding i use it gives me java.lang.ClassCastException: org.springframework.ws.soap.saaj.SaajSoapEnvelopeE xception
Last edited by roym; Dec 3rd, 2007 at 06:02 AM.
Reason: Code tags added by mistake
-
Dec 3rd, 2007, 06:28 AM
#4
The £ is a HTML entity, not an XML entity. See http://en.wikipedia.org/wiki/List_of...ity_references
In general, you don't have to think about escaping entities when dealing with XML. The XML API you use (DOM, StaX) takes care of it.
-
Dec 3rd, 2007, 06:39 AM
#5
When i pass in the £ symbol in my request I expect the endpoint(have used a marshaller) to fetch the content,but it throws an exception,and only works if i pass in the entity number £ instead of £.
Im a bit confused as to how to get this to work in my web service.
-
Dec 3rd, 2007, 06:59 AM
#6
See http://en.wikipedia.org/wiki/Pound_sign: you could try using & #163; in the request. (Make sure to remove the space in between the & and the #, i couldn't post it otherwise, because the forum escapes it). However - as stated earlier - any proper XML marshaller/parser should do this for you.
At any rate, Spring-WS is not at fault here.
-
Dec 3rd, 2007, 07:07 AM
#7
First of all I know spring web services is not at fault here but I was trying to get my web service to work with it.I use a jaxb marshaller to read the input request and then work with it.
I meant to type & # 163 last time instead of the pound symbol this works finebut I need to pass in the £ symbol by itself instead of asking my clients to use the entity number.Cant seem to understand why it does not work
-
Dec 3rd, 2007, 09:23 AM
#8
Dont bother Ive resolved this problem.Thanks for your help.
-
Jan 24th, 2011, 10:46 AM
#9
Very old thread, but it might interest one:
Hit the same problem while using XwsSecurityInterceptor when a username had a "+" sign in it.
Problem occured in Sun Java 1.5 (Linux) and OSX 10.6.6 Java 1.6.
Fix was to switch to Wss4jSecurityInterceptor, which supports these signs.
-
Jan 28th, 2011, 06:19 AM
#10
i am also facing this problem from some time, please suggest me any resolution of this problem
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules