• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to handle xml as strings?

 
Ranch Hand
Posts: 548
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hava rpc encoded style web service that returns a string as response. In the string I'll storing a xml file which has CDATA sections and some inline DTD. My problem is sometimes I am getting an error from axis serialization classes saying that there is an invalid character in xml.

So is it better to convert the xml data into a BASE64 string (may be using AXIS API Or Jakarta Commons API) and return that string as response ? or is there any other way of returning xml files as strings ?

Please suggest.
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This may be of some relevance.

Processing XML with Java - Elliotte Rusty Harold
The CDATASection Interface

In essence, consider escaping (encoding) the offending characters in the text and stop using CDATA sections altogether. This of course means that you will have to decode the content on the other end.
 
Rr Kumaran
Ranch Hand
Posts: 548
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peers-

That is a nice explanation. I dont have any CDATA sections in my XML. I am wondering are there any best practices of sending xml file in SOAP messages?
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by RR Kumaran:
I dont have any CDATA sections in my XML.



Originally posted by RR Kumaran:
a xml file which has CDATA sections and some inline DTD


Data Type Definition language isn't XML. So by definition a well-formed XML document (SOAP envelope) cannot contain an inline DTD unless the inline DTD is encoded/escaped (this is why XML schema was created).

Originally posted by RR Kumaran:
I am wondering are there any best practices of sending xml file in SOAP messages?


You may be interested in
3.7 Handling XML Documents in a Web Service
If you are exchanging XML documents you may want to consider using a document-style Web service instead of an RPC-style web service.
Patterns and Strategies for Building Document-Based Web Services
[ June 27, 2006: Message edited by: Peer Reynders ]
 
Rr Kumaran
Ranch Hand
Posts: 548
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peers -

You have given me the correct answers. Thank you for all the links.
reply
    Bookmark Topic Watch Topic
  • New Topic