diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-14 10:32:00 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-14 10:32:00 +0000 |
commit | 1a8bc2ae6fec146e8d1bc28935725b9caef465f5 (patch) | |
tree | ffaa1b369e0ee05153e8ca2510bb0df7197b18aa /sca-java-2.x/trunk/modules/binding-ws/src | |
parent | 4fa7ded481367fe182f199e5c8bfbe7bbd0fb4ee (diff) |
Fix ws binding endpoint ref writing so that it works with java stax parser
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1049025 13f79535-47bb-0310-9956-ffa450edef68
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(); |