Hi Laurent, In performance wise , creating a org.w3c.dom.Document inside the service method is not much good thing to do. Axiom also full featured light-weight object model for XML , so i wonder why you want to convert your incoming message from Axiom to W3C DOM .
BTW if you relay want to do this conversion you can try for DOOM , it is a OM compatible W3C DOM implementation available with Axiom. performance wise that is a good option , please refer [1] . [1] - http://wso2.org/library/2506 Thanks , 2009/5/20 Laurent Even <laurent-e...@sab2i.com>: > Hi all, > > I've created a web service which takes a XML document in parameter (more > precisely an OMElement). > This web service has 2 wsdl (message and document type) linked to a XSD. > I've generated stubs for each wsdl and they look fine to me > Then, I needed to test this web service from: > > a Internet explorer by passing the xml string to the web service like this: > http://localhost:8080/app/services/service/read?xml=<aa>....</aa> > a the message stub from a test program > a the document stub from a test program > > So... : > > I call the web service from an Internet explorer > I wrote a message test program: > ... > org.apache.axis.message.SOAPBodyElement soapObjReturn = > (org.apache.axis.message.SOAPBodyElement)messageService.read(xml); > .... > Where xml is a org.w3c.dom.Document > I wrote a Document test program in which I've just used the generated type > to call the service > > My web service method looks like this : > > public OMElement read(OMElement xml){ > ... > Conversion of OMElement to org.w3c.dom.Document > ... > } > > So far so good .... but .... I've noticed that depending on the way I'm > calling the stub, the OMElement in the web service method is populated > differently > For instance, to get the XML string in order to convert it into a > org.w3c.dom.Document, I had to developp some "ugly" code > if (!xml.getText().equals("")){ > xmlToParse=xml.getText(); > }else if (!xml.getFirstElement().getText().equals("")){ > xmlToParse=xml.getFirstElement().getText(); > }else if (!xml.toString().equals("")){ > xmlToParse=xml.toString(); > } > > It works fine but I think I'm missing something really important on how to > handle org.w3c.dom.Document with OMElement > > Does someone have best practices on OMElement and w3c document? > > Thanks > > > Here an extract of the message WSDL (type part) > <wsdl:types> > <schema targetNamespace="http://XXXX.com" > xmlns="http://www.w3.org/2001/XMLSchema"> > <element name="read" type="xsd:anyType" /> > </schema> > <schema > targetNamespace="http://XXXX.com/ws/stub/XXX/message/literal" > xmlns="http://www.w3.org/2001/XMLSchema"> > <element name="readReturn" type="xsd:anyType" /> > </schema> > </wsdl:types> > <wsdl:message name="readRequest"> > <wsdl:part name="part" element="tns1:read"/> > </wsdl:message> > <wsdl:message name="readResponse"> > <wsdl:part element="impl:readReturn" name="readReturn" /> > </wsdl:message> > <wsdl:portType name="XXXPortType"> > <wsdl:operation name="read"> > <wsdl:input message="axis2:readRequest" wsaw:Action="urn:read"/> > <wsdl:output message="axis2:readResponse" > wsaw:Action="urn:readResponse"/> > </wsdl:operation> > </wsdl:portType> > > > Here the extract for WSDL document "wsdl:types" part. > <wsdl:types> > <schema xmlns="http://www.w3.org/2001/XMLSchema" > xmlns:xsdXXX="http://XXXX.com/schema"> > <xsd:import namespace="http://XXXX.com/schema/XXXX" > schemaLocation="XXXXX.xsd"/> > </schema> > </wsdl:types> > <wsdl:message name="readRequest"> > <wsdl:part element="xsdXXX:XXX" name="part" /> > </wsdl:message> > <wsdl:message name="readResponse"> > <wsdl:part element="xsdXXX:XXX" name="readReturn" /> > </wsdl:message> > <wsdl:portType name="XXXXXXPortType"> > <wsdl:operation name="read"> > <wsdl:input message="axis2:readRequest" wsaw:Action="urn:read"/> > <wsdl:output message="axis2:readResponse" > wsaw:Action="urn:readResponse"/> > </wsdl:operation> > </wsdl:portType> > > ----------------------------------------------------------- > Un geste responsable aujourd hui pour preserver demain. > N'imprimez ce message que si necessaire. > > Please, consider the environment before printing this email. > ------------------------------------------------------------ > -- Sagara Gunathunga Blog - http://ssagara.blogspot.com Web - http://sagaras.awardspace.com/