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 di...@apache.org on 2005/07/14 02:30:59 UTC
svn commit: r216290 [3/8] - in /webservices/axis/trunk/java/modules:
core/src/org/apache/axis2/transport/
core/src/org/apache/axis2/transport/http/ core/webapp/
saaj/src/org/apache/axis2/saaj/ samples/src/sample/amazon/search/
samples/src/userguide/cli...
Modified: webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingClient.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingClient.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingClient.java Wed Jul 13 17:30:55 2005
@@ -1,64 +1,61 @@
-package userguide.clients;
-
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.clientapi.Call;
-import org.apache.axis2.engine.AxisFault;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMOutput;
-
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import java.io.StringWriter;
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class EchoBlockingClient {
- private static EndpointReference targetEPR = new EndpointReference(
- AddressingConstants.WSA_TO,
- "http://127.0.0.1:8080/axis2/services/MyService/echo");
-
- public static void main(String[] args) {
- try {
- OMElement payload = ClientUtil.getEchoOMElement();
- Call call = new Call();
- call.setTo(targetEPR);
- call.setTransportInfo(Constants.TRANSPORT_HTTP,
- Constants.TRANSPORT_HTTP,
- false);
-
- //Blocking invocation
- OMElement result = (OMElement) call.invokeBlocking("echo",
- payload);
-
- StringWriter writer = new StringWriter();
- result.serializeWithCache(
- new OMOutput(
- XMLOutputFactory.newInstance()
- .createXMLStreamWriter(writer)));
- writer.flush();
-
- System.out.println(writer.toString());
-
- } catch (AxisFault axisFault) {
- axisFault.printStackTrace();
- } catch (XMLStreamException e) {
- e.printStackTrace();
- }
- }
-}
+package userguide.clients;
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.clientapi.Call;
+import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.om.OMElement;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import java.io.StringWriter;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class EchoBlockingClient {
+ private static EndpointReference targetEPR = new EndpointReference(
+ AddressingConstants.WSA_TO,
+ "http://127.0.0.1:8080/axis2/services/MyService/echo");
+
+ public static void main(String[] args) {
+ try {
+ OMElement payload = ClientUtil.getEchoOMElement();
+ Call call = new Call();
+ call.setTo(targetEPR);
+ call.setTransportInfo(Constants.TRANSPORT_HTTP,
+ Constants.TRANSPORT_HTTP,
+ false);
+
+ //Blocking invocation
+ OMElement result = (OMElement) call.invokeBlocking("echo",
+ payload);
+
+ StringWriter writer = new StringWriter();
+ result.serializeWithCache(XMLOutputFactory.newInstance()
+ .createXMLStreamWriter(writer));
+ writer.flush();
+
+ System.out.println(writer.toString());
+
+ } catch (AxisFault axisFault) {
+ axisFault.printStackTrace();
+ } catch (XMLStreamException e) {
+ e.printStackTrace();
+ }
+ }
+}
Modified: webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingDualClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingDualClient.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingDualClient.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingDualClient.java Wed Jul 13 17:30:55 2005
@@ -1,63 +1,60 @@
-package userguide.clients;
-
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.clientapi.Call;
-import org.apache.axis2.engine.AxisFault;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMOutput;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLOutputFactory;
-import java.io.StringWriter;
-
-/**
- * Created by IntelliJ IDEA.
- * User: Jaliya
- * Date: Jun 4, 2005
- * Time: 5:47:37 PM
- */
-public class EchoBlockingDualClient {
- private static EndpointReference targetEPR = new EndpointReference(
- AddressingConstants.WSA_TO,
- "http://127.0.0.1:8080/axis2/services/MyService/echo");
-
- public static void main(String[] args) {
- try {
- OMElement payload = ClientUtil.getEchoOMElement();
-
- Call call = new Call();
- call.setTo(targetEPR);
-
- //The boolean flag informs the axis2 engine to use two separate transport connection
- //to retrieve the response.
- call.engageModule(new QName(Constants.MODULE_ADDRESSING));
- call.setTransportInfo(Constants.TRANSPORT_HTTP,
- Constants.TRANSPORT_HTTP,
- true);
-
- //Blocking Invocation
- OMElement result = (OMElement) call.invokeBlocking("echo",
- payload);
-
- StringWriter writer = new StringWriter();
- result.serializeWithCache(
- new OMOutput(
- XMLOutputFactory.newInstance()
- .createXMLStreamWriter(writer)));
- writer.flush();
-
- System.out.println(writer.toString());
-
- //Need to close the Client Side Listener.
- call.close();
-
- } catch (AxisFault axisFault) {
- axisFault.printStackTrace();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- }
-}
+package userguide.clients;
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.clientapi.Call;
+import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.om.OMElement;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+import java.io.StringWriter;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jaliya
+ * Date: Jun 4, 2005
+ * Time: 5:47:37 PM
+ */
+public class EchoBlockingDualClient {
+ private static EndpointReference targetEPR = new EndpointReference(
+ AddressingConstants.WSA_TO,
+ "http://127.0.0.1:8080/axis2/services/MyService/echo");
+
+ public static void main(String[] args) {
+ try {
+ OMElement payload = ClientUtil.getEchoOMElement();
+
+ Call call = new Call();
+ call.setTo(targetEPR);
+
+ //The boolean flag informs the axis2 engine to use two separate transport connection
+ //to retrieve the response.
+ call.engageModule(new QName(Constants.MODULE_ADDRESSING));
+ call.setTransportInfo(Constants.TRANSPORT_HTTP,
+ Constants.TRANSPORT_HTTP,
+ true);
+
+ //Blocking Invocation
+ OMElement result = (OMElement) call.invokeBlocking("echo",
+ payload);
+
+ StringWriter writer = new StringWriter();
+ result.serializeWithCache(XMLOutputFactory.newInstance()
+ .createXMLStreamWriter(writer));
+ writer.flush();
+
+ System.out.println(writer.toString());
+
+ //Need to close the Client Side Listener.
+ call.close();
+
+ } catch (AxisFault axisFault) {
+ axisFault.printStackTrace();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ }
+}
Modified: webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingClient.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingClient.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingClient.java Wed Jul 13 17:30:55 2005
@@ -1,76 +1,74 @@
-package userguide.clients;
-
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.clientapi.AsyncResult;
-import org.apache.axis2.clientapi.Call;
-import org.apache.axis2.clientapi.Callback;
-import org.apache.axis2.engine.AxisFault;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMOutput;
-
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import java.io.StringWriter;
-
-/**
- * Created by IntelliJ IDEA.
- * User: Jaliya
- * Date: Jun 4, 2005
- * Time: 5:08:44 PM
- */
-public class EchoNonBlockingClient {
- private static EndpointReference targetEPR = new EndpointReference(
- AddressingConstants.WSA_TO,
- "http://127.0.0.1:8080/axis2/services/MyService/echo");
-
- public static void main(String[] args) {
- try {
- OMElement payload = ClientUtil.getEchoOMElement();
-
- Call call = new Call();
- call.setTo(targetEPR);
- call.setTransportInfo(Constants.TRANSPORT_HTTP,
- Constants.TRANSPORT_HTTP,
- false);
-
- //Callback to handle the response
- Callback callback = new Callback() {
- public void onComplete(AsyncResult result) {
- try {
- StringWriter writer = new StringWriter();
- result.getResponseEnvelope().serializeWithCache(
- new OMOutput(
- XMLOutputFactory.newInstance()
- .createXMLStreamWriter(writer)));
- writer.flush();
-
- System.out.println(writer.toString());
-
- } catch (XMLStreamException e) {
- reportError(e);
- }
- }
-
- public void reportError(Exception e) {
- e.printStackTrace();
- }
- };
-
- //Non-Blocking Invocation
- call.invokeNonBlocking("echo", payload, callback);
-
- //Wait till the callback receives the response.
- while (!callback.isComplete()) {
- Thread.sleep(1000);
- }
-
- } catch (AxisFault axisFault) {
- axisFault.printStackTrace();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- }
-}
+package userguide.clients;
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.clientapi.AsyncResult;
+import org.apache.axis2.clientapi.Call;
+import org.apache.axis2.clientapi.Callback;
+import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.OMOutputImpl;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import java.io.StringWriter;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jaliya
+ * Date: Jun 4, 2005
+ * Time: 5:08:44 PM
+ */
+public class EchoNonBlockingClient {
+ private static EndpointReference targetEPR = new EndpointReference(
+ AddressingConstants.WSA_TO,
+ "http://127.0.0.1:8080/axis2/services/MyService/echo");
+
+ public static void main(String[] args) {
+ try {
+ OMElement payload = ClientUtil.getEchoOMElement();
+
+ Call call = new Call();
+ call.setTo(targetEPR);
+ call.setTransportInfo(Constants.TRANSPORT_HTTP,
+ Constants.TRANSPORT_HTTP,
+ false);
+
+ //Callback to handle the response
+ Callback callback = new Callback() {
+ public void onComplete(AsyncResult result) {
+ try {
+ StringWriter writer = new StringWriter();
+ result.getResponseEnvelope().serializeWithCache(XMLOutputFactory.newInstance()
+ .createXMLStreamWriter(writer));
+ writer.flush();
+
+ System.out.println(writer.toString());
+
+ } catch (XMLStreamException e) {
+ reportError(e);
+ }
+ }
+
+ public void reportError(Exception e) {
+ e.printStackTrace();
+ }
+ };
+
+ //Non-Blocking Invocation
+ call.invokeNonBlocking("echo", payload, callback);
+
+ //Wait till the callback receives the response.
+ while (!callback.isComplete()) {
+ Thread.sleep(1000);
+ }
+
+ } catch (AxisFault axisFault) {
+ axisFault.printStackTrace();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ }
+}
Modified: webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingDualClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingDualClient.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingDualClient.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingDualClient.java Wed Jul 13 17:30:55 2005
@@ -1,83 +1,81 @@
-package userguide.clients;
-
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.clientapi.AsyncResult;
-import org.apache.axis2.clientapi.Call;
-import org.apache.axis2.clientapi.Callback;
-import org.apache.axis2.engine.AxisFault;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMOutput;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import java.io.StringWriter;
-
-/**
- * Created by IntelliJ IDEA.
- * User: Jaliya
- * Date: Jun 4, 2005
- * Time: 5:30:52 PM
- */
-public class EchoNonBlockingDualClient {
- private static EndpointReference targetEPR = new EndpointReference(
- AddressingConstants.WSA_TO,
- "http://127.0.0.1:8080/axis2/services/MyService/echo");
-
- public static void main(String[] args) {
- try {
- OMElement payload = ClientUtil.getEchoOMElement();
-
- Call call = new Call();
- call.setTo(targetEPR);
-
- //The boolean flag informs the axis2 engine to use two separate transport connection
- //to retrieve the response.
- call.engageModule(new QName(Constants.MODULE_ADDRESSING));
- call.setTransportInfo(Constants.TRANSPORT_HTTP,
- Constants.TRANSPORT_HTTP,
- true);
-
- //Callback to handle the response
- Callback callback = new Callback() {
- public void onComplete(AsyncResult result) {
- try {
- StringWriter writer = new StringWriter();
- result.getResponseEnvelope().serializeWithCache(
- new OMOutput(
- XMLOutputFactory.newInstance()
- .createXMLStreamWriter(writer)));
- writer.flush();
-
- System.out.println(writer.toString());
-
- } catch (XMLStreamException e) {
- reportError(e);
- }
- }
-
- public void reportError(Exception e) {
- e.printStackTrace();
- }
- };
-
- //Non-Blocking Invocation
- call.invokeNonBlocking("echo", payload, callback);
-
- //Wait till the callback receives the response.
- while (!callback.isComplete()) {
- Thread.sleep(1000);
- }
- //Need to close the Client Side Listener.
- call.close();
-
- } catch (AxisFault axisFault) {
- axisFault.printStackTrace();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- }
-}
+package userguide.clients;
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.clientapi.AsyncResult;
+import org.apache.axis2.clientapi.Call;
+import org.apache.axis2.clientapi.Callback;
+import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.OMOutputImpl;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import java.io.StringWriter;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jaliya
+ * Date: Jun 4, 2005
+ * Time: 5:30:52 PM
+ */
+public class EchoNonBlockingDualClient {
+ private static EndpointReference targetEPR = new EndpointReference(
+ AddressingConstants.WSA_TO,
+ "http://127.0.0.1:8080/axis2/services/MyService/echo");
+
+ public static void main(String[] args) {
+ try {
+ OMElement payload = ClientUtil.getEchoOMElement();
+
+ Call call = new Call();
+ call.setTo(targetEPR);
+
+ //The boolean flag informs the axis2 engine to use two separate transport connection
+ //to retrieve the response.
+ call.engageModule(new QName(Constants.MODULE_ADDRESSING));
+ call.setTransportInfo(Constants.TRANSPORT_HTTP,
+ Constants.TRANSPORT_HTTP,
+ true);
+
+ //Callback to handle the response
+ Callback callback = new Callback() {
+ public void onComplete(AsyncResult result) {
+ try {
+ StringWriter writer = new StringWriter();
+ result.getResponseEnvelope().serializeWithCache(XMLOutputFactory.newInstance()
+ .createXMLStreamWriter(writer));
+ writer.flush();
+
+ System.out.println(writer.toString());
+
+ } catch (XMLStreamException e) {
+ reportError(e);
+ }
+ }
+
+ public void reportError(Exception e) {
+ e.printStackTrace();
+ }
+ };
+
+ //Non-Blocking Invocation
+ call.invokeNonBlocking("echo", payload, callback);
+
+ //Wait till the callback receives the response.
+ while (!callback.isComplete()) {
+ Thread.sleep(1000);
+ }
+ //Need to close the Client Side Listener.
+ call.close();
+
+ } catch (AxisFault axisFault) {
+ axisFault.printStackTrace();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ }
+}
Modified: webservices/axis/trunk/java/modules/samples/src/userguide/clients/RESTClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/RESTClient.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/RESTClient.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/RESTClient.java Wed Jul 13 17:30:55 2005
@@ -24,7 +24,6 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMOutput;
import javax.xml.stream.FactoryConfigurationError;
import javax.xml.stream.XMLOutputFactory;
@@ -52,7 +51,7 @@
try {
XMLStreamWriter writer = XMLOutputFactory.newInstance()
.createXMLStreamWriter(System.out);
- result.serializeWithCache(new OMOutput(writer));
+ result.serializeWithCache(writer);
writer.flush();
} catch (XMLStreamException e) {
e.printStackTrace();
Modified: webservices/axis/trunk/java/modules/samples/src/userguide/clients/TCPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/TCPClient.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/TCPClient.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/TCPClient.java Wed Jul 13 17:30:55 2005
@@ -24,7 +24,6 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMOutput;
import javax.xml.stream.FactoryConfigurationError;
import javax.xml.stream.XMLOutputFactory;
@@ -52,7 +51,7 @@
try {
XMLStreamWriter writer = XMLOutputFactory.newInstance()
.createXMLStreamWriter(System.out);
- result.serializeWithCache(new OMOutput(writer));
+ result.serializeWithCache(writer);
writer.flush();
} catch (XMLStreamException e) {
e.printStackTrace();
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/HandlerFailureTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/HandlerFailureTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/HandlerFailureTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/HandlerFailureTest.java Wed Jul 13 17:30:55 2005
@@ -31,7 +31,6 @@
import org.apache.axis2.om.OMAbstractFactory;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMOutput;
import org.apache.axis2.phaseresolver.PhaseMetadata;
import org.apache.axis2.soap.SOAPFactory;
import org.apache.axis2.transport.http.SimpleHTTPServer;
@@ -174,11 +173,8 @@
call.setTo(targetEPR);
OMElement result = call.invokeBlocking(
operationName.getLocalPart(), method);
- OMOutput omOutput = new OMOutput(
- XMLOutputFactory.newInstance().createXMLStreamWriter(
+ result.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(
System.out));
- result.serialize(omOutput);
- omOutput.flush();
fail("the test must fail due to bad service Name");
} catch (AxisFault e) {
e.printStackTrace();
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/SOAPversionTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/SOAPversionTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/SOAPversionTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/SOAPversionTest.java Wed Jul 13 17:30:55 2005
@@ -1,165 +1,165 @@
-package org.apache.axis2.engine;
-
-import junit.framework.TestCase;
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.description.ServiceDescription;
-import org.apache.axis2.engine.util.MyInOutMEPClient;
-import org.apache.axis2.integration.UtilServer;
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMFactory;
-import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMOutput;
-import org.apache.axis2.soap.SOAPEnvelope;
-import org.apache.axis2.soap.SOAPFactory;
-import org.apache.axis2.soap.impl.llom.soap11.SOAP11Constants;
-import org.apache.axis2.soap.impl.llom.soap12.SOAP12Constants;
-import org.apache.axis2.util.Utils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * author : Eran Chinthaka (chinthaka@apache.org)
- */
-
-public class SOAPversionTest extends TestCase {
- private EndpointReference targetEPR =
- new EndpointReference(AddressingConstants.WSA_TO,
- "http://127.0.0.1:"
- + (UtilServer.TESTING_PORT)
- + "/axis/services/EchoXMLService/echoOMElement");
- private Log log = LogFactory.getLog(getClass());
- private QName serviceName = new QName("EchoXMLService");
- private QName operationName = new QName("echoOMElement");
- private QName transportName = new QName("http://localhost/my",
- "NullTransport");
-
- private AxisConfiguration engineRegistry;
- private MessageContext mc;
- //private Thread thisThread;
- // private SimpleHTTPServer sas;
- private ServiceContext serviceContext;
- private ServiceDescription service;
-
- private boolean finish = false;
-
- protected void setUp() throws Exception {
- UtilServer.start();
- service =
- Utils.createSimpleService(serviceName,
- Echo.class.getName(),
- operationName);
- UtilServer.deployService(service);
- serviceContext =
- UtilServer.getConfigurationContext().createServiceContext(
- service.getName());
-
- }
-
- public void testSOAP11() throws AxisFault {
- SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
-
- OMElement payload = createEnvelope();
- MyInOutMEPClient inOutMEPClient = new MyInOutMEPClient();
- inOutMEPClient.setSoapVersionURI(
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
- inOutMEPClient.setTo(targetEPR);
- inOutMEPClient.setTransportInfo(Constants.TRANSPORT_HTTP,
- Constants.TRANSPORT_HTTP,
- false);
-
- SOAPEnvelope result =
- inOutMEPClient.invokeBlockingWithEnvelopeOut(
- operationName.getLocalPart(), payload);
- assertEquals("SOAP Version received is not compatible",
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
- result.getNamespace().getName());
- inOutMEPClient.close();
- }
-
- public void testSOAP12() throws AxisFault {
- SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
-
- OMElement payload = createEnvelope();
- MyInOutMEPClient inOutMEPClient = new MyInOutMEPClient();
- inOutMEPClient.setSoapVersionURI(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
- inOutMEPClient.setTo(targetEPR);
- inOutMEPClient.setTransportInfo(Constants.TRANSPORT_HTTP,
- Constants.TRANSPORT_HTTP,
- false);
-
- SOAPEnvelope result =
- inOutMEPClient.invokeBlockingWithEnvelopeOut(
- operationName.getLocalPart(), payload);
- assertEquals("SOAP Version received is not compatible",
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
- result.getNamespace().getName());
-
-
- inOutMEPClient.close();
- }
-
- public void testSOAPfault() throws AxisFault {
- SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
-
- OMElement payload = createEnvelope();
- MyInOutMEPClient inOutMEPClient = new MyInOutMEPClient();
- inOutMEPClient.setSoapVersionURI(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-
- inOutMEPClient.setTo(targetEPR);
- inOutMEPClient.setTransportInfo(Constants.TRANSPORT_HTTP,
- Constants.TRANSPORT_HTTP,
- false);
-
- SOAPEnvelope result =
- inOutMEPClient.invokeBlockingWithEnvelopeOut(
- operationName.getLocalPart(), payload);
-// assertEquals("SOAP Version received is not compatible", SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, result.getNamespace().getName());
- try {
- OMOutput output = new OMOutput(System.out, false);
- result.serializeWithCache(output);
- output.flush();
- } catch (XMLStreamException e) {
- e.printStackTrace();
- }
-
- inOutMEPClient.close();
- }
-
- private OMElement createEnvelope() {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
- OMElement method = fac.createOMElement("echoOMElement", omNs);
- OMElement value = fac.createOMElement("myValue", omNs);
- value.addChild(
- fac.createText(value, "Isaac Assimov, the foundation Sega"));
- method.addChild(value);
-
- return method;
- }
-
-
-}
+package org.apache.axis2.engine;
+
+import junit.framework.TestCase;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.engine.util.MyInOutMEPClient;
+import org.apache.axis2.integration.UtilServer;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.impl.OMOutputImpl;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.soap.impl.llom.soap11.SOAP11Constants;
+import org.apache.axis2.soap.impl.llom.soap12.SOAP12Constants;
+import org.apache.axis2.util.Utils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * author : Eran Chinthaka (chinthaka@apache.org)
+ */
+
+public class SOAPversionTest extends TestCase {
+ private EndpointReference targetEPR =
+ new EndpointReference(AddressingConstants.WSA_TO,
+ "http://127.0.0.1:"
+ + (UtilServer.TESTING_PORT)
+ + "/axis/services/EchoXMLService/echoOMElement");
+ private Log log = LogFactory.getLog(getClass());
+ private QName serviceName = new QName("EchoXMLService");
+ private QName operationName = new QName("echoOMElement");
+ private QName transportName = new QName("http://localhost/my",
+ "NullTransport");
+
+ private AxisConfiguration engineRegistry;
+ private MessageContext mc;
+ //private Thread thisThread;
+ // private SimpleHTTPServer sas;
+ private ServiceContext serviceContext;
+ private ServiceDescription service;
+
+ private boolean finish = false;
+
+ protected void setUp() throws Exception {
+ UtilServer.start();
+ service =
+ Utils.createSimpleService(serviceName,
+ Echo.class.getName(),
+ operationName);
+ UtilServer.deployService(service);
+ serviceContext =
+ UtilServer.getConfigurationContext().createServiceContext(
+ service.getName());
+
+ }
+
+ public void testSOAP11() throws AxisFault {
+ SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
+
+ OMElement payload = createEnvelope();
+ MyInOutMEPClient inOutMEPClient = new MyInOutMEPClient();
+ inOutMEPClient.setSoapVersionURI(
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ inOutMEPClient.setTo(targetEPR);
+ inOutMEPClient.setTransportInfo(Constants.TRANSPORT_HTTP,
+ Constants.TRANSPORT_HTTP,
+ false);
+
+ SOAPEnvelope result =
+ inOutMEPClient.invokeBlockingWithEnvelopeOut(
+ operationName.getLocalPart(), payload);
+ assertEquals("SOAP Version received is not compatible",
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+ result.getNamespace().getName());
+ inOutMEPClient.close();
+ }
+
+ public void testSOAP12() throws AxisFault {
+ SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
+
+ OMElement payload = createEnvelope();
+ MyInOutMEPClient inOutMEPClient = new MyInOutMEPClient();
+ inOutMEPClient.setSoapVersionURI(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ inOutMEPClient.setTo(targetEPR);
+ inOutMEPClient.setTransportInfo(Constants.TRANSPORT_HTTP,
+ Constants.TRANSPORT_HTTP,
+ false);
+
+ SOAPEnvelope result =
+ inOutMEPClient.invokeBlockingWithEnvelopeOut(
+ operationName.getLocalPart(), payload);
+ assertEquals("SOAP Version received is not compatible",
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+ result.getNamespace().getName());
+
+
+ inOutMEPClient.close();
+ }
+
+ public void testSOAPfault() throws AxisFault {
+ SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
+
+ OMElement payload = createEnvelope();
+ MyInOutMEPClient inOutMEPClient = new MyInOutMEPClient();
+ inOutMEPClient.setSoapVersionURI(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+ inOutMEPClient.setTo(targetEPR);
+ inOutMEPClient.setTransportInfo(Constants.TRANSPORT_HTTP,
+ Constants.TRANSPORT_HTTP,
+ false);
+
+ SOAPEnvelope result =
+ inOutMEPClient.invokeBlockingWithEnvelopeOut(
+ operationName.getLocalPart(), payload);
+// assertEquals("SOAP Version received is not compatible", SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, result.getNamespace().getName());
+ try {
+ OMOutputImpl output = new org.apache.axis2.om.impl.OMOutputImpl(System.out, false);
+ result.serializeWithCache(output);
+ output.flush();
+ } catch (XMLStreamException e) {
+ e.printStackTrace();
+ }
+
+ inOutMEPClient.close();
+ }
+
+ private OMElement createEnvelope() {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
+ OMElement method = fac.createOMElement("echoOMElement", omNs);
+ OMElement value = fac.createOMElement("myValue", omNs);
+ value.addChild(
+ fac.createText(value, "Isaac Assimov, the foundation Sega"));
+ method.addChild(value);
+
+ return method;
+ }
+
+
+}
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailRequestResponseRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailRequestResponseRawXMLTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailRequestResponseRawXMLTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailRequestResponseRawXMLTest.java Wed Jul 13 17:30:55 2005
@@ -41,7 +41,7 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMOutput;
+import org.apache.axis2.om.impl.OMOutputImpl;
import org.apache.axis2.soap.SOAPEnvelope;
import org.apache.axis2.transport.mail.MailTransportSender;
import org.apache.axis2.transport.mail.SimpleMailListener;
@@ -148,10 +148,8 @@
Callback callback = new Callback() {
public void onComplete(AsyncResult result) {
try {
- result.getResponseEnvelope().serialize(
- new OMOutput(
- XMLOutputFactory.newInstance()
- .createXMLStreamWriter(System.out)));
+ result.getResponseEnvelope().serialize(XMLOutputFactory.newInstance()
+ .createXMLStreamWriter(System.out));
} catch (XMLStreamException e) {
reportError(e);
} finally {
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailetRequestResponceRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailetRequestResponceRawXMLTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailetRequestResponceRawXMLTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailetRequestResponceRawXMLTest.java Wed Jul 13 17:30:55 2005
@@ -39,7 +39,6 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMOutput;
import org.apache.axis2.soap.SOAPEnvelope;
import org.apache.axis2.transport.mail.MailTransportSender;
import org.apache.axis2.transport.mail.SimpleMailListener;
@@ -146,9 +145,8 @@
public void onComplete(AsyncResult result) {
try {
result.getResponseEnvelope().serialize(
- new OMOutput(
XMLOutputFactory.newInstance()
- .createXMLStreamWriter(System.out)));
+ .createXMLStreamWriter(System.out));
} catch (XMLStreamException e) {
reportError(e);
} finally {
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java Wed Jul 13 17:30:55 2005
@@ -35,7 +35,6 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMOutput;
import org.apache.axis2.om.impl.llom.OMTextImpl;
import org.apache.axis2.soap.SOAPFactory;
import org.apache.axis2.util.Utils;
@@ -127,10 +126,8 @@
OMElement result =
(OMElement) call.invokeBlocking(
operationName.getLocalPart(), payload);
- result.serializeWithCache(
- new OMOutput(
- XMLOutputFactory.newInstance()
- .createXMLStreamWriter(System.out)));
+ result.serializeWithCache(XMLOutputFactory.newInstance()
+ .createXMLStreamWriter(System.out));
call.close();
System.out.println(i);
}
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/rest/RESTBasedEchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/rest/RESTBasedEchoRawXMLTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/rest/RESTBasedEchoRawXMLTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/rest/RESTBasedEchoRawXMLTest.java Wed Jul 13 17:30:55 2005
@@ -35,7 +35,6 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMOutput;
import org.apache.axis2.soap.SOAPFactory;
import org.apache.axis2.util.Utils;
import org.apache.commons.logging.Log;
@@ -171,10 +170,8 @@
OMElement result =
(OMElement) call.invokeBlocking(operationName.getLocalPart(),
payload);
- result.serializeWithCache(
- new OMOutput(
- XMLOutputFactory.newInstance().createXMLStreamWriter(
- System.out)));
+ result.serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(
+ System.out));
System.out.println(messageInfo.requestMessage);
call.close();
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java Wed Jul 13 17:30:55 2005
@@ -34,7 +34,7 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMOutput;
+import org.apache.axis2.om.impl.OMOutputImpl;
import org.apache.axis2.soap.SOAPFactory;
import org.apache.axis2.transport.http.SimpleHTTPServer;
import org.apache.axis2.util.Utils;
@@ -118,10 +118,8 @@
Callback callback = new Callback() {
public void onComplete(AsyncResult result) {
try {
- result.getResponseEnvelope().serializeWithCache(
- new OMOutput(
- XMLOutputFactory.newInstance()
- .createXMLStreamWriter(System.out)));
+ result.getResponseEnvelope().serializeWithCache(XMLOutputFactory.newInstance()
+ .createXMLStreamWriter(System.out));
} catch (XMLStreamException e) {
reportError(e);
} finally {
@@ -167,10 +165,8 @@
OMElement result =
(OMElement) call.invokeBlocking(operationName.getLocalPart(),
payload);
- result.serializeWithCache(
- new OMOutput(
- XMLOutputFactory.newInstance().createXMLStreamWriter(
- System.out)));
+ result.serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(
+ System.out));
call.close();
}
@@ -198,10 +194,8 @@
OMElement result = (OMElement) call.invokeBlocking(
operationName.getLocalPart(), method);
- result.serializeWithCache(
- new OMOutput(
- XMLOutputFactory.newInstance().createXMLStreamWriter(
- System.out)));
+ result.serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(
+ System.out));
call.close();
}
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/tcp/TCPTwoChannelEchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/tcp/TCPTwoChannelEchoRawXMLTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/tcp/TCPTwoChannelEchoRawXMLTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/tcp/TCPTwoChannelEchoRawXMLTest.java Wed Jul 13 17:30:55 2005
@@ -34,7 +34,6 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMOutput;
import org.apache.axis2.transport.http.SimpleHTTPServer;
import org.apache.axis2.util.Utils;
@@ -129,10 +128,8 @@
Callback callback = new Callback() {
public void onComplete(AsyncResult result) {
try {
- result.getResponseEnvelope().serialize(
- new OMOutput(
- XMLOutputFactory.newInstance()
- .createXMLStreamWriter(System.out)));
+ result.getResponseEnvelope().serialize(XMLOutputFactory.newInstance()
+ .createXMLStreamWriter(System.out));
} catch (XMLStreamException e) {
reportError(e);
} finally {
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java Wed Jul 13 17:30:55 2005
@@ -1,189 +1,210 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package org.apache.axis2.om;
-
-import javax.xml.stream.XMLStreamException;
-
-
-/**
- * Interface OMNode
- */
-public interface OMNode {
- /**
- * The node is an <code>Element</code>.
- */
- public static final short ELEMENT_NODE = 1;
-
- /**
- * The node is a <code>Text</code> node.
- */
- public static final short TEXT_NODE = 3;
-
- /**
- * The node is a <code>CDATASection</code>.
- */
- public static final short CDATA_SECTION_NODE = 4;
-
- /**
- * The node is a <code>Comment</code>.
- */
- public static final short COMMENT_NODE = 8;
-
- /**
- * This node is a <code>DTD</code>.
- */
- public static final short DTD_NODE = 9;
-
- /**
- * This node is a <code>ProcessingInstruction</code>.
- */
- public static final short PI_NODE = 10;
-
- /**
- * This method should return the immediate parent of the node.
- * Parent is always an Element
- *
- * @return
- * @throws OMException
- */
- public OMContainer getParent() throws OMException;
-
- /**
- * Method setParent
- *
- * @param element
- */
- public void setParent(OMContainer element);
-
- /**
- * This will give the next sibling. This can be an OMAttribute for OMAttribute or OMText or OMELement for others.
- *
- * @return
- * @throws OMException
- */
- public OMNode getNextSibling() throws OMException;
-
- /**
- * Method setNextSibling
- *
- * @param node
- */
- public void setNextSibling(OMNode node);
-
- /**
- * this will indicate whether parser has parsed this information item completely or not.
- * If somethings info are not available in the item, one has to check this attribute to make sure that, this
- * item has been parsed completely or not.
- *
- * @return boolean
- */
- public boolean isComplete();
-
- /**
- * Method setComplete
- *
- * @param state
- */
- public void setComplete(boolean state);
-
- /**
- * This will remove this information item and its children, from the model completely.
- * Important to note that this method will detach the OMNode once it is fully built.
- * Half built nodes are not to be detached!
- *
- * @throws OMException
- */
- public OMNode detach() throws OMException;
-
- /**
- * Discards a Node. Discrad goes to the parser level and if the element is not
- * completely built, then it will be completely skipped at the parser level
- *
- * @throws OMException
- */
- public void discard() throws OMException;
-
- /**
- * This will insert a sibling just after the current information item.
- *
- * @param sibling
- * @throws OMException
- */
- public void insertSiblingAfter(OMNode sibling) throws OMException;
-
- /**
- * This will insert a sibling just before the current information item
- *
- * @param sibling
- * @throws OMException
- */
- public void insertSiblingBefore(OMNode sibling) throws OMException;
-
- /**
- * This is to get the type of node, as this is the super class of all the nodes
- *
- * @return
- * @throws OMException
- */
- public int getType() throws OMException;
-
- /**
- * Method setType
- *
- * @param nodeType
- * @throws OMException
- */
- public void setType(int nodeType) throws OMException;
-
- /**
- * get the previous sibling
- *
- * @return node
- */
- public OMNode getPreviousSibling();
-
- /**
- * Set the previous sibling
- *
- * @param previousSibling
- */
- public void setPreviousSibling(OMNode previousSibling);
-
- /**
- * Serialize the node with caching
- *
- * @param omOutput
- * @throws XMLStreamException
- * @see #serializeWithCache(OMOutput)
- */
- public void serializeWithCache(OMOutput omOutput)
- throws XMLStreamException;
-
- /**
- * Serialize the node without caching
- *
- * @param omOutput
- * @throws XMLStreamException
- * @see #serialize(OMOutput)
- */
- public void serialize(OMOutput omOutput) throws XMLStreamException;
-
- /**
- * Builds itself
- */
- public void build();
-
-}
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.axis2.om;
+
+import org.apache.axis2.om.impl.OMOutputImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * Interface OMNode
+ */
+public interface OMNode {
+ /**
+ * The node is an <code>Element</code>.
+ */
+ public static final short ELEMENT_NODE = 1;
+
+ /**
+ * The node is a <code>Text</code> node.
+ */
+ public static final short TEXT_NODE = 3;
+
+ /**
+ * The node is a <code>CDATASection</code>.
+ */
+ public static final short CDATA_SECTION_NODE = 4;
+
+ /**
+ * The node is a <code>Comment</code>.
+ */
+ public static final short COMMENT_NODE = 8;
+
+ /**
+ * This node is a <code>DTD</code>.
+ */
+ public static final short DTD_NODE = 9;
+
+ /**
+ * This node is a <code>ProcessingInstruction</code>.
+ */
+ public static final short PI_NODE = 10;
+
+ /**
+ * This method should return the immediate parent of the node.
+ * Parent is always an Element
+ *
+ * @return
+ * @throws OMException
+ */
+ public OMContainer getParent() throws OMException;
+
+ /**
+ * Method setParent
+ *
+ * @param element
+ */
+ public void setParent(OMContainer element);
+
+ /**
+ * This will give the next sibling. This can be an OMAttribute for OMAttribute or OMText or OMELement for others.
+ *
+ * @return
+ * @throws OMException
+ */
+ public OMNode getNextSibling() throws OMException;
+
+ /**
+ * Method setNextSibling
+ *
+ * @param node
+ */
+ public void setNextSibling(OMNode node);
+
+ /**
+ * this will indicate whether parser has parsed this information item completely or not.
+ * If somethings info are not available in the item, one has to check this attribute to make sure that, this
+ * item has been parsed completely or not.
+ *
+ * @return boolean
+ */
+ public boolean isComplete();
+
+ /**
+ * Method setComplete
+ *
+ * @param state
+ */
+ public void setComplete(boolean state);
+
+ /**
+ * This will remove this information item and its children, from the model completely.
+ * Important to note that this method will detach the OMNode once it is fully built.
+ * Half built nodes are not to be detached!
+ *
+ * @throws OMException
+ */
+ public OMNode detach() throws OMException;
+
+ /**
+ * Discards a Node. Discrad goes to the parser level and if the element is not
+ * completely built, then it will be completely skipped at the parser level
+ *
+ * @throws OMException
+ */
+ public void discard() throws OMException;
+
+ /**
+ * This will insert a sibling just after the current information item.
+ *
+ * @param sibling
+ * @throws OMException
+ */
+ public void insertSiblingAfter(OMNode sibling) throws OMException;
+
+ /**
+ * This will insert a sibling just before the current information item
+ *
+ * @param sibling
+ * @throws OMException
+ */
+ public void insertSiblingBefore(OMNode sibling) throws OMException;
+
+ /**
+ * This is to get the type of node, as this is the super class of all the nodes
+ *
+ * @return
+ * @throws OMException
+ */
+ public int getType() throws OMException;
+
+ /**
+ * Method setType
+ *
+ * @param nodeType
+ * @throws OMException
+ */
+ public void setType(int nodeType) throws OMException;
+
+ /**
+ * get the previous sibling
+ *
+ * @return node
+ */
+ public OMNode getPreviousSibling();
+
+ /**
+ * Set the previous sibling
+ *
+ * @param previousSibling
+ */
+ public void setPreviousSibling(OMNode previousSibling);
+
+ /**
+ * Serialize the node with caching
+ *
+ * @param xmlWriter
+ * @throws XMLStreamException
+ * @see #serializeWithCache(org.apache.axis2.om.impl.OMOutputImpl)
+ */
+ public void serializeWithCache(XMLStreamWriter xmlWriter)
+ throws XMLStreamException;
+
+ /**
+ * Serialize the node with caching
+ *
+ * @param omOutput
+ * @throws XMLStreamException
+ * @see #serializeWithCache(org.apache.axis2.om.impl.OMOutputImpl)
+ */
+ public void serializeWithCache(org.apache.axis2.om.impl.OMOutputImpl omOutput)
+ throws XMLStreamException;
+
+ /**
+ * Serialize the node without caching
+ *
+ * @param xmlWriter
+ * @throws XMLStreamException
+ * @see #serialize(org.apache.axis2.om.impl.OMOutputImpl)
+ */
+ public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException;
+
+ /**
+ * Serialize the node without caching
+ *
+ * @param omOutput
+ * @throws XMLStreamException
+ * @see #serialize(org.apache.axis2.om.impl.OMOutputImpl)
+ */
+ public void serialize(OMOutputImpl omOutput) throws XMLStreamException;
+
+ /**
+ * Builds itself
+ */
+ public void build();
+
+}
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMSerializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMSerializer.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMSerializer.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMSerializer.java Wed Jul 13 17:30:55 2005
@@ -1,34 +1,35 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.om;
-
-import javax.xml.stream.XMLStreamException;
-
-
-/**
- * Interface OMSerializer
- */
-public interface OMSerializer {
- /**
- * Method serializeWithCache
- *
- * @param obj
- * @param writer
- * @throws XMLStreamException
- */
- void serialize(Object obj, OMOutput omOutput)
- throws XMLStreamException;
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.om;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * Interface OMSerializer
+ */
+public interface OMSerializer {
+ /**
+ * Method serializeWithCache
+ *
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ void serialize(XMLStreamReader reader, XMLStreamWriter writer)
+ throws XMLStreamException;
+}
Copied: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MIMEOutputUtils.java (from r216276, webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/MIMEOutputUtils.java)
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MIMEOutputUtils.java?p2=webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MIMEOutputUtils.java&p1=webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/MIMEOutputUtils.java&r1=216276&r2=216290&rev=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/MIMEOutputUtils.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MIMEOutputUtils.java Wed Jul 13 17:30:55 2005
@@ -13,13 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.axis2.om;
+package org.apache.axis2.om.impl;
+
+import org.apache.axis2.om.OMText;
+import org.apache.axis2.om.OMException;
import javax.activation.DataHandler;
import javax.mail.MessagingException;
import javax.mail.internet.ContentType;
import javax.mail.internet.MimeBodyPart;
-import javax.xml.stream.XMLStreamException;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Iterator;
@@ -33,7 +35,7 @@
public static void complete(OutputStream outStream,
OutputStream bufferedSoapOutStream, LinkedList binaryNodeList,
- String boundary) throws XMLStreamException {
+ String boundary) {
try {
startWritingMime(outStream, boundary);
@@ -66,7 +68,7 @@
}
}
- protected static MimeBodyPart createMimeBodyPart(OMText node)
+ public static MimeBodyPart createMimeBodyPart(OMText node)
throws MessagingException {
MimeBodyPart mimeBodyPart = new MimeBodyPart();
mimeBodyPart.setDataHandler(node.getDataHandler());
@@ -79,7 +81,7 @@
/**
* @throws IOException This will write the boundary to output Stream
*/
- protected static void writeMimeBoundary(OutputStream outStream,
+ public static void writeMimeBoundary(OutputStream outStream,
String boundary) throws IOException {
outStream.write(new byte[]{45, 45});
outStream.write(boundary.getBytes());
@@ -88,7 +90,7 @@
/**
* @throws IOException This will write the boundary with CRLF
*/
- protected static void startWritingMime(OutputStream outStream,
+ public static void startWritingMime(OutputStream outStream,
String boundary)
throws IOException {
writeMimeBoundary(outStream, boundary);
@@ -103,7 +105,7 @@
* @throws IOException
* @throws MessagingException
*/
- protected static void writeBodyPart(OutputStream outStream,
+ public static void writeBodyPart(OutputStream outStream,
MimeBodyPart part, String boundary) throws IOException,
MessagingException {
outStream.write(CRLF);
@@ -115,7 +117,7 @@
/**
* @throws IOException This will write "--" to the end of last boundary
*/
- protected static void finishWritingMime(OutputStream outStream)
+ public static void finishWritingMime(OutputStream outStream)
throws IOException {
outStream.write(new byte[]{45, 45});
}
Copied: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java (from r216276, webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMOutput.java)
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java?p2=webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java&p1=webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMOutput.java&r1=216276&r2=216290&rev=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMOutput.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java Wed Jul 13 17:30:55 2005
@@ -13,7 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.axis2.om;
+package org.apache.axis2.om.impl;
+
+import org.apache.axis2.om.impl.MIMEOutputUtils;
+import org.apache.axis2.om.OMText;
import javax.xml.stream.FactoryConfigurationError;
import javax.xml.stream.XMLOutputFactory;
@@ -24,32 +27,22 @@
import java.util.LinkedList;
/**
- * For the moment this assumes that transport takes the decision of whether
- * to optimise or not by looking at whether the MTOM optimise is enabled &
- * also looking at the OM tree whether it has any optimisable content
+ * For the moment this assumes that transport takes the decision of whether
+ * to optimise or not by looking at whether the MTOM optimise is enabled &
+ * also looking at the OM tree whether it has any optimisable content
*/
-
-public class OMOutput {
+public class OMOutputImpl {
private XMLStreamWriter xmlWriter;
-
- private boolean doOptimise;
-
+ private boolean doOptimize;
private OutputStream outStream;
-
- private XMLStreamWriter writer;
-
private LinkedList binaryNodeList;
-
private ByteArrayOutputStream bufferedSoapOutStream;
-
private static String mimeBoundary = "----=_AxIs2_Def_boundary_=42214532";
- //private String contentType = null;
-
/**
* @param xmlWriter if it is guaranteed for not using attachments one can use this
*/
- public OMOutput(XMLStreamWriter xmlWriter) {
+ public OMOutputImpl(XMLStreamWriter xmlWriter) {
this.xmlWriter = xmlWriter;
}
@@ -57,9 +50,9 @@
* @throws FactoryConfigurationError
* @throws XMLStreamException
*/
- public OMOutput(OutputStream outStream, boolean doOptimise)
+ public OMOutputImpl(OutputStream outStream, boolean doOptimise)
throws XMLStreamException, FactoryConfigurationError {
- this.doOptimise = doOptimise;
+ this.doOptimize = doOptimise;
this.outStream = outStream;
if (doOptimise) {
bufferedSoapOutStream = new ByteArrayOutputStream();
@@ -71,9 +64,7 @@
xmlWriter =
XMLOutputFactory.newInstance().createXMLStreamWriter(
outStream);
-
}
-
}
public XMLStreamWriter getXmlStreamWriter() {
@@ -81,53 +72,29 @@
}
public void flush() throws XMLStreamException {
- // if (doOptimise) {
- // try {
- // this.complete();
- // } catch (IOException e) {
- // //TODO this is just a hack to avoid passing IOException. Must find a
- // better way to handle this
- // throw new XMLStreamException("Error creating mime parts. Problem with
- // Streams");
- // } catch (MessagingException e) {
- // throw new XMLStreamException("Error creating mime Body parts");
- // }
- // } else {
xmlWriter.flush();
- // }
-
+ if (doOptimize) {
+ MIMEOutputUtils.complete(outStream, bufferedSoapOutStream,
+ binaryNodeList, mimeBoundary);
+ }
}
public boolean doOptimise() {
- return doOptimise;
+ return doOptimize;
}
public static String getContentType(boolean doOptimize) {
if (doOptimize) {
- return MIMEOutputUtils.getContentTypeForMime(mimeBoundary);
+ return org.apache.axis2.om.impl.MIMEOutputUtils.getContentTypeForMime(mimeBoundary);
}
//TODO have to check whether SOAP1.1 & SOAP 1.2
return null;
}
- public void writeOptimised(OMText node) {
+ public void writeOptimized(OMText node) {
binaryNodeList.add(node);
}
public void complete() throws XMLStreamException {
- if (doOptimise) {
- xmlWriter.flush();
- MIMEOutputUtils.complete(outStream, bufferedSoapOutStream,
- binaryNodeList, mimeBoundary);
- }
}
-
- /*private String getMimeBoundary() {
- //TODO have to dynamically generate.
- if (mimeBoundary == null) {
- mimeBoundary = "----=_AxIs2_Def_boundary_=42214532";
- }
- return mimeBoundary;
- }*/
-
}
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMCommentImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMCommentImpl.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMCommentImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMCommentImpl.java Wed Jul 13 17:30:55 2005
@@ -20,7 +20,7 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMException;
import org.apache.axis2.om.OMNode;
-import org.apache.axis2.om.OMOutput;
+import org.apache.axis2.om.impl.OMOutputImpl;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
@@ -54,9 +54,9 @@
*
* @param omOutput
* @throws XMLStreamException
- * @see #serializeWithCache(OMOutput)
+ * @see #serializeWithCache(org.apache.axis2.om.impl.OMOutputImpl)
*/
- public void serializeWithCache(OMOutput omOutput) throws XMLStreamException {
+ public void serializeWithCache(OMOutputImpl omOutput) throws XMLStreamException {
XMLStreamWriter writer = omOutput.getXmlStreamWriter();
writer.writeCharacters("<!--");
writer.writeCharacters(this.value);
@@ -72,9 +72,9 @@
*
* @param omOutput
* @throws XMLStreamException
- * @see #serialize(OMOutput)
+ * @see #serialize(org.apache.axis2.om.impl.OMOutputImpl)
*/
- public void serialize(OMOutput omOutput) throws XMLStreamException {
+ public void serialize(OMOutputImpl omOutput) throws XMLStreamException {
serializeWithCache(omOutput);
}
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocTypeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocTypeImpl.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocTypeImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocTypeImpl.java Wed Jul 13 17:30:55 2005
@@ -20,7 +20,7 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMException;
import org.apache.axis2.om.OMNode;
-import org.apache.axis2.om.OMOutput;
+import org.apache.axis2.om.impl.OMOutputImpl;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
@@ -54,9 +54,9 @@
*
* @param omOutput
* @throws XMLStreamException
- * @see #serializeWithCache(OMOutput)
+ * @see #serializeWithCache(org.apache.axis2.om.impl.OMOutputImpl)
*/
- public void serializeWithCache(OMOutput omOutput) throws XMLStreamException {
+ public void serializeWithCache(OMOutputImpl omOutput) throws XMLStreamException {
XMLStreamWriter writer = omOutput.getXmlStreamWriter();
writer.writeCharacters(this.value);
OMNode nextSibling = this.getNextSibling();
@@ -70,9 +70,9 @@
*
* @param omOutput
* @throws XMLStreamException
- * @see #serialize(OMOutput)
+ * @see #serialize(org.apache.axis2.om.impl.OMOutputImpl)
*/
- public void serialize(OMOutput omOutput) throws XMLStreamException {
+ public void serialize(org.apache.axis2.om.impl.OMOutputImpl omOutput) throws XMLStreamException {
serializeWithCache(omOutput);
}