Re: Exchanging XML Documents
Fatima My apologies for not getting back sooner. If you want to return XML from a file you can read it into an OMElement like this: File file = new File("path"); // your file FileInputStream fis; StAXOMBuilder builder; OMElement el ; try { fis = new FileInputStream(file); builder = new StAXOMBuilder(fis); el = builder.getDocumentElement(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XMLStreamException e) { // TODO Auto-generated catch block e.printStackTrace(); } Paul On 9/26/07, Fátima Milla Olaya <[EMAIL PROTECTED]> wrote: > Paul Fremantle a écrit : > > Hi > > > > OMElement is the represenation of XML that Axis2 uses. It is similar to DOM. > > > > Do you already have the XML in an object (DOM, SAX, StAX, String, > > byte[]), or do you want to create the XML in your program? > > > > There are answers for all of these but I figured it would be easier to > > start with your scenario. > > > > Paul > > > > On 9/26/07, Fátima Milla Olaya <[EMAIL PROTECTED]> wrote: > > > >> Hi, I want to exchange arbitrary XML documents with my webservice. In > >> the WSDL definition I use xsd:anytype and when I create the java classes > >> with wsdl2java the object is OMElement. How can I manage this object to > >> parse to an XML file? Thanks > >> > >> - > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > >> > > > > > > > Thanks for the answer, my service sends the xml name and returns the > corresponding xml document. I don't know how to do this with an > OMElement. I have started to programme this but I don't know if it is > correct. > > * FilexmltransferSkeleton.java > * > * This file was auto-generated from WSDL > * by the Apache Axis2 version: 1.3 Built on : Aug 10, 2007 (04:45:47 LKT) > */ > package com.evidian.www.filexmltransfer_wsdl; > > import com.evidian.www.filexmltransfer_xsd1.*; > import org.apache.axiom.om.*; > import org.apache.axiom.om.impl.builder.*; > > /** > * FilexmltransferSkeleton java skeleton for the axisService > */ > public class FilexmltransferSkeleton { > /** > * Auto generated method signature > * @param filename > */ > public com.evidian.www.filexmltransfer_xsd1.Filexml transfer( > com.evidian.www.filexmltransfer_xsd1.Filename filename) { > String fileName=filename.getFilename(); > OMElement omElem=null; > try{ > //Create the new builder > StAXOMBuilder doomBuilder = new StAXOMBuilder(fileName); > //Get the document element > omElem = doomBuilder.getDocumentElement(); > }catch (Exception e){ > } > Filexml fileXml=new Filexml(); > fileXml.setFilexml(omElem); > return fileXml; > } > } > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Paul Fremantle Co-Founder and VP of Technical Sales, WSO2 OASIS WS-RX TC Co-chair blog: http://pzf.fremantle.org [EMAIL PROTECTED] "Oxygenating the Web Service Platform", www.wso2.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Exchanging XML Documents
Paul Fremantle a écrit : Hi OMElement is the represenation of XML that Axis2 uses. It is similar to DOM. Do you already have the XML in an object (DOM, SAX, StAX, String, byte[]), or do you want to create the XML in your program? There are answers for all of these but I figured it would be easier to start with your scenario. Paul On 9/26/07, Fátima Milla Olaya <[EMAIL PROTECTED]> wrote: Hi, I want to exchange arbitrary XML documents with my webservice. In the WSDL definition I use xsd:anytype and when I create the java classes with wsdl2java the object is OMElement. How can I manage this object to parse to an XML file? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Thanks for the answer, my service sends the xml name and returns the corresponding xml document. I don't know how to do this with an OMElement. I have started to programme this but I don't know if it is correct. * FilexmltransferSkeleton.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: 1.3 Built on : Aug 10, 2007 (04:45:47 LKT) */ package com.evidian.www.filexmltransfer_wsdl; import com.evidian.www.filexmltransfer_xsd1.*; import org.apache.axiom.om.*; import org.apache.axiom.om.impl.builder.*; /** * FilexmltransferSkeleton java skeleton for the axisService */ public class FilexmltransferSkeleton { /** * Auto generated method signature * @param filename */ public com.evidian.www.filexmltransfer_xsd1.Filexml transfer( com.evidian.www.filexmltransfer_xsd1.Filename filename) { String fileName=filename.getFilename(); OMElement omElem=null; try{ //Create the new builder StAXOMBuilder doomBuilder = new StAXOMBuilder(fileName); //Get the document element omElem = doomBuilder.getDocumentElement(); }catch (Exception e){ } Filexml fileXml=new Filexml(); fileXml.setFilexml(omElem); return fileXml; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Exchanging XML Documents
Hi OMElement is the represenation of XML that Axis2 uses. It is similar to DOM. Do you already have the XML in an object (DOM, SAX, StAX, String, byte[]), or do you want to create the XML in your program? There are answers for all of these but I figured it would be easier to start with your scenario. Paul On 9/26/07, Fátima Milla Olaya <[EMAIL PROTECTED]> wrote: > Hi, I want to exchange arbitrary XML documents with my webservice. In > the WSDL definition I use xsd:anytype and when I create the java classes > with wsdl2java the object is OMElement. How can I manage this object to > parse to an XML file? Thanks > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Paul Fremantle Co-Founder and VP of Technical Sales, WSO2 OASIS WS-RX TC Co-chair blog: http://pzf.fremantle.org [EMAIL PROTECTED] "Oxygenating the Web Service Platform", www.wso2.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]