You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Jesper Jensen <ax...@gmail.com> on 2008/09/10 09:16:54 UTC
Problem generating CData Section
Hi Axis2 Mailing list
I am trying to generate a Soap Response with a CData section.
My goal is this response:
<getDocumentInfo>
<code>0</code>
<link><![CDATA[
http://bess/bess/webservicelinks.do?action=PRINT&token=1234567890]]></link>
</getDocumentInfo>
I have rebuilt my Axis2Webservice using a selfmade aar file.
My META-INF\services.xml file looks like this:
<service name="UserGuideSampleService">
<description>
Bess APV Webservice
</description>
<parameter name="ServiceClass" >
dk.bess.Webservice
</parameter>
<operation name="getDocumentInfo">
<messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
</operation>
</service>
My Webservicefile looks like this:
*package* dk.bess;
*import* org.apache.axiom.om.*;
*import* org.apache.axiom.om.impl.llom.OMTextImpl;
*import* org.apache.xmlbeans.xml.stream.XMLStreamException;
*import* dk.bording.bess.schema.SchemaAPI;
*public* *class* Webservice {
@SuppressWarnings("unused")
*private* *final* *static* String *NAME_SPACE* = "Bess
Webservice";
*public* OMElement getDocumentInfo(OMElement element)
*throws*XMLStreamException {
…}
}
I have successfully installed the Webservice and invoked the method using
SoapUI as a testing platform.
The problem is that the CData section is not generated.
My code for generating the output is:
OMFactory fac = OMAbstractFactory.*getOMFactory*();
OMNamespace ns = fac.createOMNamespace("http://bess/", "bess");
OMElement method = fac.createOMElement("getDocumentInfoResponse",
ns);
OMElement code = fac.createOMElement("code", ns);
code.addChild(fac.createOMText("0"));
OMElement link = fac.createOMElement("link", ns);
OMTextImpl link_text = (OMTextImpl)fac.createOMText("
http://bess/bess/webservicelinks.do?action=PRINT&token=123456789", OMNode.*
CDATA_SECTION_NODE* );
link_text.build();
link_text.setType(OMText.*CDATA_SECTION_NODE*);
link.addChild(link_text);
method.addChild(code);
method.addChild(link);
method.build();
*return* method;
Neither factory.createOMText("", OMNode.CDATA_SECTION_NODE) nor
OMTextImpl.setType(OMNode.CDATA_SECTION_NODE) works
I can successfully invoke the function. I can change and deploy new code.
But i cannot generate the CDATA section.
Does anyone have any ideas?
Could i have installed the wrong libraries? Missing libraries?
Am using the wrong method to generate a CData section?
With kind regards
Jesper Jensen