Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

BeanSerializer - Exception  RSS feed

 
Velayudhaperumal bhagavathikannu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam using axis engine. In my message i have some escape characters, when passed from client throwing

BeanSerializer - Exception:
java.lang.IllegalArgumentException: The char '0x17' after '' is not a valid XML character.

It is not possible to remove or replace all the non xml formatted characters from my message.
What should i do to pass my message through axis now?
If writing a custom serializer is the only way how to do that?
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you creating this message? If yes, then why dont you escape the characters while creating this message?

It is generally not a good idea to send invalid xmls to web services. It is really a waste of effort trying to put workarounds to handle things that are not correct.

Velayudha:It is not possible to remove or replace all the non xml formatted characters from my message.

Why do you say so, you would have an escape character for virtually everything. If it is really needed cant you put a CDATA in there?
 
Velayudhaperumal bhagavathikannu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.
The data iam passing is some encrpted data.So iam not able to replace escape characters.
Assume it would be like

call.invoke(new Object[]{"Encrypted data"})

Tryed with appending this encrypted string with "<![CDATA["... but still throwing
BeanSerializer - Exception:
java.lang.IllegalArgumentException: The char '0x17' after ' <![CDATA[' is not a valid XML character.
[ May 28, 2008: Message edited by: Velayudha Perumal Bhagavathikannu ]
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Velayudha:
The data iam passing is some encrpted data.

Okie. So encrypted data is a binary data, before putting the data in the xml you have to encode it. A simple base64 encode should do. You can use commons codec for encoding.
 
Velayudhaperumal bhagavathikannu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okie. So encrypted data is a binary data, before putting the data in the xml you have to encode it. A simple base64 encode should do. You can use commons codec for encoding.

That works Nitesh .But axis itself has base64 encoding.
Thanks Nitesh
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!