You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2008/07/24 20:38:38 UTC
svn commit: r679484 - in /ode/branches/APACHE_ODE_1.X:
axis2-war/src/test/java/org/apache/ode/axis2/
axis2-war/src/test/resources/TestAttributeNamespaces/
bpel-epr/src/main/java/org/apache/ode/il/
bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/
Author: mriou
Date: Thu Jul 24 11:38:37 2008
New Revision: 679484
URL: http://svn.apache.org/viewvc?rev=679484&view=rev
Log:
ODE-343 QName in xsi-type attribute value's prefix losing defining namespace declaration.
Added:
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/MessageStructureTest.java
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/HelloWorld2.bpel
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/HelloWorld2.wsdl
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/chooseLanguage.xsl
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/deploy.xml
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/language.xml
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/testRequest.soap
Modified:
ode/branches/APACHE_ODE_1.X/bpel-epr/src/main/java/org/apache/ode/il/OMUtils.java
ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java
Added: ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/MessageStructureTest.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/MessageStructureTest.java?rev=679484&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/MessageStructureTest.java (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/MessageStructureTest.java Thu Jul 24 11:38:37 2008
@@ -0,0 +1,26 @@
+package org.apache.ode.axis2;
+
+import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Element;
+
+public class MessageStructureTest extends Axis2TestBase {
+
+ public void testAttrWithNsValue() throws Exception {
+ String bundleName = "TestAttributeNamespaces";
+ // deploy the required service
+ server.deployService(DummyService.class.getCanonicalName());
+ if (server.isDeployed(bundleName)) server.undeployProcess(bundleName);
+ server.deployProcess(bundleName);
+ try {
+ String response = server.sendRequestFile("http://localhost:8080/processes/attrNSWorld",
+ bundleName, "testRequest.soap");
+ Element domResponse = DOMUtils.stringToDOM(response);
+ Element out = DOMUtils.getFirstChildElement(DOMUtils.getFirstChildElement(DOMUtils.getFirstChildElement(domResponse)));
+ String nsAttr = out.getAttribute("xmlns:myns");
+ System.out.println("=> " + response);
+ assertTrue(nsAttr != null);
+ } finally {
+ server.undeployProcess(bundleName);
+ }
+ }
+}
Added: ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/HelloWorld2.bpel
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/HelloWorld2.bpel?rev=679484&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/HelloWorld2.bpel (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/HelloWorld2.bpel Thu Jul 24 11:38:37 2008
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpws:process exitOnStandardFault="yes"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ name="HelloWorld2"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ targetNamespace="http://ode/bpel/unit-test"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:test="http://ode/bpel/unit-test.wsdl"
+ xmlns:tns="http://ode/bpel/unit-test" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:myns="myns">
+ <bpws:import importType="http://schemas.xmlsoap.org/wsdl/"
+ location="HelloWorld2.wsdl" namespace="http://ode/bpel/unit-test.wsdl"/>
+ <bpws:partnerLinks>
+ <bpws:partnerLink myRole="me" name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType"/>
+ </bpws:partnerLinks>
+ <bpws:variables>
+ <bpws:variable messageType="test:helloRequest" name="inVar"/>
+ <bpws:variable type="myns:MagicPixie" name="tmpVar" />
+ <bpws:variable messageType="test:helloResponse" name="outVar"/>
+ </bpws:variables>
+ <bpws:sequence>
+ <bpws:receive createInstance="yes" name="start"
+ operation="hello" partnerLink="helloPartnerLink"
+ portType="test:HelloPortType" variable="inVar"/>
+ <bpws:assign name="assign1" validate="yes">
+ <bpws:copy>
+ <bpws:from variable="inVar" part="parameters">
+ <bpws:query>myns:in</bpws:query>
+ </bpws:from>
+ <bpws:to variable="tmpVar"/>
+ </bpws:copy>
+ <bpws:copy>
+ <bpws:from>
+ <bpws:literal>
+ <myns:helloResponse>
+ <myns:out xmlns:foo="xsn:foo" myattr="foo:bar"/>
+ </myns:helloResponse>
+ </bpws:literal>
+ </bpws:from>
+ <bpws:to variable="outVar" part="parameters"/>
+ </bpws:copy>
+ <bpws:copy>
+ <bpws:from>$tmpVar</bpws:from>
+ <bpws:to variable="outVar" part="parameters">
+ <bpws:query>myns:out</bpws:query>
+ </bpws:to>
+ </bpws:copy>
+ </bpws:assign>
+ <bpws:reply name="end" operation="hello"
+ partnerLink="helloPartnerLink" portType="test:HelloPortType" variable="outVar"/>
+ </bpws:sequence>
+</bpws:process>
Added: ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/HelloWorld2.wsdl
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/HelloWorld2.wsdl?rev=679484&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/HelloWorld2.wsdl (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/HelloWorld2.wsdl Thu Jul 24 11:38:37 2008
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://ode/bpel/unit-test.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://ode/bpel/unit-test.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
+ xmlns:myns="myns"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <wsdl:types>
+ <xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="myns">
+
+ <xsd:complexType name="MagicPixie">
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="DustyMagicPixie">
+ <xsd:complexContent>
+ <xsd:extension base="myns:MagicPixie">
+ <xsd:sequence>
+ <xsd:element name="dust" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:element name="hello">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in" type="myns:MagicPixie" nillable="false" minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="helloResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="myns:MagicPixie" nillable="false" minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+
+ <wsdl:message name="helloRequest">
+ <wsdl:part name="parameters" element="myns:hello" />
+ </wsdl:message>
+ <wsdl:message name="helloResponse">
+ <wsdl:part name="parameters" element="myns:helloResponse" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:helloRequest" name="helloRequest" />
+ <wsdl:output message="tns:helloResponse" name="helloResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction=""/>
+ <wsdl:input name="helloRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="helloResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8080/ode/processes/attrNSWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
+
Added: ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/chooseLanguage.xsl
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/chooseLanguage.xsl?rev=679484&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/chooseLanguage.xsl (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/chooseLanguage.xsl Thu Jul 24 11:38:37 2008
@@ -0,0 +1,12 @@
+<xsl:stylesheet version="2.0"
+ xmlns:inspection="http://schemas.xmlsoap.org/ws/2001/10/inspection/"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsl:output omit-xml-declaration="yes"/>
+
+ <xsl:template match="/">
+ <xsl:value-of select="document('language.xml')//languages/language [@name='french']/text()"/>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
Added: ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/deploy.xml
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/deploy.xml?rev=679484&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/deploy.xml (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/deploy.xml Thu Jul 24 11:38:37 2008
@@ -0,0 +1,31 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:pns="http://ode/bpel/unit-test"
+ xmlns:wns="http://ode/bpel/unit-test.wsdl">
+
+
+ <process name="pns:HelloWorld2">
+ <!--in-memory>false</in-memory-->
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
Added: ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/language.xml
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/language.xml?rev=679484&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/language.xml (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/language.xml Thu Jul 24 11:38:37 2008
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<languages>
+ <language name="english">
+ Hello World
+ </language>
+ <language name="french">
+ Bonjour!!
+ </language>
+ <language name="spanish">
+ Hola!!
+ </language>
+ <language name="urban">
+ Yo!
+ </language>
+</languages>
Added: ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/testRequest.soap
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/testRequest.soap?rev=679484&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/testRequest.soap (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestAttributeNamespaces/testRequest.soap Thu Jul 24 11:38:37 2008
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+<!--soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:myns="myns">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <myns:hello>
+ <myns:in xsi:type="myns:DustyMagicPixie">
+ <myns:value>Test message</myns:value>
+ <myns:dust>fooo</myns:dust>
+ </myns:in>
+ </myns:hello>
+ </soapenv:Body>
+</soapenv:Envelope-->
+
+<?xml version='1.0' encoding='UTF-8'?>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+ <soapenv:Body>
+ <helloResponse xmlns="myns">
+ <out xmlns:foo="xsn:foo" xmlns:myns="myns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="myns:DustyMagicPixie">
+ <value>Test message</value>
+ <dust>fooo</dust>
+ </out>
+ </helloResponse>
+ </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file
Modified: ode/branches/APACHE_ODE_1.X/bpel-epr/src/main/java/org/apache/ode/il/OMUtils.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-epr/src/main/java/org/apache/ode/il/OMUtils.java?rev=679484&r1=679483&r2=679484&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-epr/src/main/java/org/apache/ode/il/OMUtils.java (original)
+++ ode/branches/APACHE_ODE_1.X/bpel-epr/src/main/java/org/apache/ode/il/OMUtils.java Thu Jul 24 11:38:37 2008
@@ -83,11 +83,19 @@
for (Iterator i = element.getAllAttributes(); i.hasNext();) {
final OMAttribute attr = (OMAttribute) i.next();
- if (attr.getNamespace() != null)
- domElement.setAttributeNS(attr.getNamespace().getNamespaceURI(), attr.getLocalName(), attr.getAttributeValue());
- else
- domElement.setAttributeNS(null,attr.getLocalName(), attr.getAttributeValue());
-
+ Attr newAttr;
+ if (attr.getNamespace() != null) newAttr = doc.createAttributeNS(attr.getNamespace().getNamespaceURI(), attr.getLocalName());
+ else newAttr = doc.createAttributeNS(null,attr.getLocalName());
+
+ newAttr.appendChild(doc.createTextNode(attr.getAttributeValue()));
+ domElement.setAttributeNode(newAttr);
+
+ // Case of qualified attribute values, we're forced to add corresponding namespace declaration manually...
+ int colonIdx = attr.getAttributeValue().indexOf(":");
+ if (colonIdx > 0) {
+ OMNamespace attrValNs = element.findNamespaceURI(attr.getAttributeValue().substring(0, colonIdx));
+ domElement.setAttributeNS(DOMUtils.NS_URI_XMLNS, "xmlns:"+ attrValNs.getPrefix(), attrValNs.getNamespaceURI());
+ }
}
for (Iterator<OMNode> i = element.getChildren(); i.hasNext();) {
Modified: ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java?rev=679484&r1=679483&r2=679484&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java (original)
+++ ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java Thu Jul 24 11:38:37 2008
@@ -454,9 +454,19 @@
for (int i = 0; i < nl.getLength(); ++i)
replacement.appendChild(doc.importNode(nl.item(i), true));
NamedNodeMap attrs = src.getAttributes();
- for (int i = 0; i < attrs.getLength(); ++i)
- if (!((Attr)attrs.item(i)).getName().startsWith("xmlns"))
+ for (int i = 0; i < attrs.getLength(); ++i) {
+ Attr attr = (Attr)attrs.item(i);
+ if (!attr.getName().startsWith("xmlns")) {
replacement.setAttributeNodeNS((Attr)doc.importNode(attrs.item(i), true));
+ // Case of qualified attribute values, we're forced to add corresponding namespace declaration manually
+ int colonIdx = attr.getValue().indexOf(":");
+ if (colonIdx > 0) {
+ String prefix = attr.getValue().substring(0, colonIdx);
+ String attrValNs = src.lookupPrefix(prefix);
+ replacement.setAttributeNS(DOMUtils.NS_URI_XMLNS, "xmlns:"+ prefix, attrValNs);
+ }
+ }
+ }
parent.replaceChild(replacement, ptr);
DOMUtils.copyNSContext(ptr, replacement);