I have to code a Web service client, compliant to Axis2 1.5.4. The part of code giving the problem is as follows:
String my_var = "some value";
MetaDataEntry metaDataEntry = MetaDataEntry.Factory.newInstance();
metaDataEntry.setKey(MetaDataKey.Enum.forInt(key));
metaDataEntry.setValue(my_var);
Now basically the setKey woks fine but setValue expects an XmlObject value while according to the sample response document I have got, the xml structure should be like :
....
<MetaDataEntry>
<key>some_key_enum</key>
<value>some _value</value>
</MetaDataEntry>
....
I've tried using :
MetaDataEntry.setValue(XmlObject.Factory.parse("<value>"+my_var+"</value>"));
but it formats the value tag as <value><value>some_value</value></value>. I've also tried :
metaDataEntry.setValue(XmlObject.Factory.parse(my_var));
but it gives the exception: Unexpected Element: CDATA. Can anybody please help me write the correct statement?