[SoapRMI] Element as parameter
Aleksander Slominski
aslom_at_cs.indiana.edu
Sat, 09 Nov 2002 02:57:51 -0500
"nodep_at_libero.it" wrote:
> Hi, thanks for your previous answers.
> Now I've an other: can xsoap use
> org.w3c.dom.Element as parameter of
> a call? (i.e. I've to call a sevice
> that wants an Element as parameter)
> And how to generate Element in xsoap?
> Thank you!
hi Stefano,
currently there is no serializer or deserializer for DOM Element
so it will network. however you should be able to serialize DOM
Element into String and recreate XmlNode (see function below
that converts XML string into XmlNode) and on receiving side you
would need to write a simple utility class to create DOM Element from XmlNode.
alternatively you can write DOM Element serializer/deserialzier
for XSOAP that could be included in next release (for examples
of (de)serialziers please soaprmi.soapenc package).
hope it helps,
alek
ps. this is taken from XSOAP sample GridServiceImpl.ajava
public static XmlNode converStringToXmlTree(String xmlString)
throws XmlPullParserException
{
try {
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
XmlPullParser pp = factory.newPullParser();
pp.setInput(new StringReader(xmlString));
pp.setNamespaceAware(true);
pp.next();
XmlNode nodeTree = factory.newNode(pp);
return nodeTree;
} catch(IOException ex) {
throw new XmlPullParserException("could not do conversion", ex);
}
}
--
The ancestor of every action is a thought. - Ralph Waldo Emerson