diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-ws/src')
2 files changed, 9 insertions, 8 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java b/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java index 9051dc0af7..2041a0ff91 100644 --- a/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java +++ b/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java @@ -24,13 +24,12 @@ import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; -import javax.xml.transform.dom.DOMSource; +import org.apache.tuscany.sca.common.xml.stax.StAXHelper; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -63,10 +62,10 @@ public class EndPointReferenceHelper { /** * Write a wsa:endpointReference from a DOM Element */ - public static void writeEndPointReference(Element element, XMLStreamWriter writer) { + public static void writeEndPointReference(Element element, XMLStreamWriter writer, StAXHelper staxHelper) { try { - saveElement(element, writer); + saveElement(element, writer, staxHelper); } catch (XMLStreamException e) { throw new RuntimeException(e); @@ -174,10 +173,9 @@ public class EndPointReferenceHelper { } } - private static void saveElement(Element element, XMLStreamWriter writer) throws XMLStreamException{ + private static void saveElement(Element element, XMLStreamWriter writer, StAXHelper staxHelper) throws XMLStreamException{ - XMLStreamReader reader = - XMLInputFactory.newInstance().createXMLStreamReader(new DOMSource(element)); + XMLStreamReader reader = staxHelper.createXMLStreamReader(element); while (reader.hasNext()) { switch (reader.next()) { diff --git a/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java b/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java index d528516160..f5384caf16 100644 --- a/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java +++ b/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java @@ -45,6 +45,7 @@ import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.xml.PolicySubjectProcessor; import org.apache.tuscany.sca.binding.ws.WebServiceBinding; import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory; +import org.apache.tuscany.sca.common.xml.stax.StAXHelper; import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.ContributionReadException; import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; @@ -78,6 +79,7 @@ public class WebServiceBindingProcessor extends BaseStAXArtifactProcessor implem private PolicyFactory policyFactory; private PolicySubjectProcessor policyProcessor; //private PolicyFactory intentAttachPointTypeFactory; + private StAXHelper staxHelper; public WebServiceBindingProcessor(ExtensionPointRegistry extensionPoints) { @@ -87,6 +89,7 @@ public class WebServiceBindingProcessor extends BaseStAXArtifactProcessor implem this.wsFactory = modelFactories.getFactory(WebServiceBindingFactory.class); this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class); this.policyProcessor = new PolicySubjectProcessor(policyFactory); + staxHelper = StAXHelper.getInstance(extensionPoints); } /** @@ -358,7 +361,7 @@ public class WebServiceBindingProcessor extends BaseStAXArtifactProcessor implem } if (wsBinding.getEndPointReference() != null) { - EndPointReferenceHelper.writeEndPointReference(wsBinding.getEndPointReference(), writer); + EndPointReferenceHelper.writeEndPointReference(wsBinding.getEndPointReference(), writer, staxHelper); } writer.writeEndElement(); |