From 4140d84ab1259cc7500e36fb761f21c5ee01fba9 Mon Sep 17 00:00:00 2001 From: rfeng Date: Fri, 19 Sep 2008 06:38:53 +0000 Subject: Upgrade to Axis2 1.4.1 and its transitive dependencies such as XmlSchema and Axiom based on the patches from Ram for TUSCANY-2606 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@696937 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/corba/impl/CorbaSCAInvocationProxy.java | 3 +-- .../sca/binding/sca/corba/impl/CorbaSCAInvoker.java | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'java/sca/modules/binding-sca-corba') diff --git a/java/sca/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvocationProxy.java b/java/sca/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvocationProxy.java index 40f55ddb71..a9cc890616 100644 --- a/java/sca/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvocationProxy.java +++ b/java/sca/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvocationProxy.java @@ -28,7 +28,6 @@ import java.util.logging.Logger; import javax.xml.stream.XMLStreamException; import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.impl.llom.util.AXIOMUtil; import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException; import org.apache.tuscany.sca.binding.corba.impl.service.InvocationException; import org.apache.tuscany.sca.binding.corba.impl.service.InvocationProxy; @@ -69,7 +68,7 @@ public class CorbaSCAInvocationProxy implements InvocationProxy { public Object invoke(String operationName, List arguments) throws InvocationException { try { - OMElement omContent = AXIOMUtil.stringToOM((String)arguments.get(0)); + OMElement omContent = CorbaSCAInvoker.stringToOM((String)arguments.get(0)); String componentOperationName = omContent.getQName().getLocalPart(); Operation componentOperation = null; for (Operation operation : componentInterface.getOperations()) { diff --git a/java/sca/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvoker.java b/java/sca/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvoker.java index 60c93d5548..32d5650f37 100644 --- a/java/sca/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvoker.java +++ b/java/sca/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvoker.java @@ -19,13 +19,14 @@ package org.apache.tuscany.sca.binding.sca.corba.impl; +import java.io.ByteArrayInputStream; import java.lang.reflect.Method; import java.util.Map; import javax.xml.stream.XMLStreamException; import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.impl.llom.util.AXIOMUtil; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException; import org.apache.tuscany.sca.binding.corba.impl.reference.DynaCorbaRequest; import org.apache.tuscany.sca.binding.corba.impl.reference.DynaCorbaResponse; @@ -62,11 +63,11 @@ public class CorbaSCAInvoker implements Invoker { String arg = omElement.toStringWithConsume(); request.addArgument(arg); DynaCorbaResponse response = request.invoke(); - OMElement responseOM = AXIOMUtil.stringToOM((String)response.getContent()); + OMElement responseOM = stringToOM((String)response.getContent()); msg.setBody(responseOM); } catch (WrappedSCAException e) { try { - OMElement exceptionOM = AXIOMUtil.stringToOM(e.getFault()); + OMElement exceptionOM = stringToOM(e.getFault()); // AxisFault axisFault = new AxisFault(""); // axisFault.setDetail(exceptionOM); FaultException f = new FaultException(e.getMessage(), exceptionOM, e); @@ -81,4 +82,18 @@ public class CorbaSCAInvoker implements Invoker { } return msg; } + + /** + * This will help you to create an OMElement from an xml fragment which you have as a string. + * + * @param xmlFragment - the well-formed xml fragment + * @return The OMElement created out of the string xml fragment. + * @throws XMLStreamException + */ + static OMElement stringToOM(String xmlFragment) throws XMLStreamException { + if (xmlFragment != null) { + return new StAXOMBuilder(new ByteArrayInputStream(xmlFragment.getBytes())).getDocumentElement(); + } + return null; + } } -- cgit v1.2.3