You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2005/01/27 06:31:13 UTC
svn commit: r126587 - /webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/utils/OMUtil.java
Author: chinthaka
Date: Wed Jan 26 21:31:10 2005
New Revision: 126587
URL: http://svn.apache.org/viewcvs?view=rev&rev=126587
Log:
implemented getEmptySoapEnvelop
Modified:
webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/utils/OMUtil.java
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/utils/OMUtil.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/utils/OMUtil.java?view=diff&rev=126587&p1=webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/utils/OMUtil.java&r1=126586&p2=webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/utils/OMUtil.java&r2=126587
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/utils/OMUtil.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/utils/OMUtil.java Wed Jan 26 21:31:10 2005
@@ -16,15 +16,34 @@
package org.apache.axis.samples.utils;
import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMException;
+import org.apache.axis.impl.llom.builder.StAXSOAPModelBuilder;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import java.io.StringReader;
+
-/**
- * @author chathura@opensource.lk
- *
- */
public class OMUtil {
-
- public static SOAPEnvelope getEmptySoapEnvelop(){
- throw new UnsupportedOperationException("To be implemented");
+
+ private String basicSOAPXML = "<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\"> \n" +
+ " <env:Header>\n" +
+ " </env:Header>\n" +
+ " <env:Body>\n" +
+ " </env:Body>\n" +
+ "</env:Envelope>";
+
+ public SOAPEnvelope getEmptySoapEnvelop(){
+ XMLStreamReader parser = null;
+ try {
+ parser = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(basicSOAPXML));
+ } catch (XMLStreamException e) {
+ throw new OMException("Exception in StAX parser", e);
+ }
+ StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(OMFactory.newInstance(),parser);
+ return builder.getSOAPEnvelope();
}
}