Hi Jesper,
I had a similar problem and solved it by replacing my XMLBeans-based
implementation with AXIOM. I used the RawXMLINOutMessageReceiver and a
ServiceClass that built the output message using AXIOM calls
(addChild(), createOMElement()). That way, I could force the
implementation to add the text as a CDATA_SECTION.
Something like this should work.
OMFactory f = OMAbstractFactory.getOMFactory();
OMNamespace ns = f.createOMNamespace(YOUR_NAMESPACE, "ns");
OMElement response, link, text; // HandleEventResponse
response = factory.createOMElement("response");
link = factory.createOMElement("link");
text = factory.createOMText(", OMElement.CDATA_SECTION_NODE)
link.addChild(text);
response.addChild(response);
________________________________
From: Jesper Guldbrand Jensen [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 28, 2008 5:32 AM
To: [email protected]
Subject: Generation Cdata
I have a webservice function that returns a link.
Currently it returns a link like this:
<link
xmlns="">http://bess/bess/webservicelinks.do?action=PRINT&token=-5-7
4-12545112103894622-43847-5666-38-96</link
<http://bess/bess/webservicelinks.do?action=PRINT&token=-5-74-125451
12103894622-43847-5666-38-96%3c/link> >
This link is not valid in a Browser, since & is not converted into
&.
As far as i know i cannot use the same code for encoding & in XML
encoding and URL encoding.
My solution would be to enclose the xml link in CDATA
<link
xmlns=""><![CDATA[http://bess/bess/webservicelinks.do?action=PRINT&token
=-1109610571849-56-8525-67-114-68-946950-48]]></link>
Unfortunately, Axis2 will convert part of this line for me, so instead i
receive:
<link
xmlns=""><![CDATA[http://bess/bess/webservicelinks.do?action=PRINT&am
p;token=-1109610571849-56-8525-67-114-68-946950-48]]></link>
On the server end im manually addding the CDATA part:
response.setLink("<![CDATA[http://bess/bess/webservicelinks.do?action=PR
INT&token="+token+"]]>");
Does anyone know what i can change to get Axis2 or Soap to enclose the
data in CDATA tags for me?
Should i change my WSDL file? What should i change?
Can i do it from my Java code on the server side? What should i do?
Any help is very much appreciated
With kind regards
Jesper Jensen
Confidentiality Notice: This email, including attachments, may include
non-public, proprietary, confidential or legally privileged information. If
you are not an intended recipient or an authorized agent of an intended
recipient, you are hereby notified that any dissemination, distribution or
copying of the information contained in or transmitted with this e-mail is
unauthorized and strictly prohibited. If you have received this email in
error, please notify the sender by replying to this message and permanently
delete this e-mail, its attachments, and any copies of it immediately. You
should not retain, copy or use this e-mail or any attachment for any purpose,
nor disclose all or any part of the contents to any other person. Thank you