Author: mriou
Date: Wed May 28 16:34:16 2008
New Revision: 661148
URL: http://svn.apache.org/viewvc?rev=661148&view=rev
Log:
Sanitizing Axiom namespace prefixes creation.
Added:
ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/
ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/HelloWorld2.bpel
ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/HelloWorld2.wsdl
ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/deploy.xml
ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/testRequest.soap
Modified:
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/TestSimpleScenario.java
ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapMessageConverter.java
ode/trunk/distro/helloworld.sh (contents, props changed)
ode/trunk/il-common/src/main/java/org/apache/ode/il/OMUtils.java
Modified:
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/TestSimpleScenario.java
URL:
http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/TestSimpleScenario.java?rev=661148&r1=661147&r2=661148&view=diff
==============================================================================
---
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/TestSimpleScenario.java
(original)
+++
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/TestSimpleScenario.java
Wed May 28 16:34:16 2008
@@ -2,6 +2,20 @@
public class TestSimpleScenario extends Axis2TestBase {
+ public void testHelloWorld2() throws Exception {
+ String bundleName = "TestHelloWorld2";
+ if(!server._ode.getProcessStore().getPackages().contains(bundleName))
server.deployProcess(bundleName);
+ try {
+ String response =
server.sendRequestFile("http://localhost:8080/ode/processes/helloWorld",
+ bundleName, "testRequest.soap");
+
+ assertTrue(response.indexOf("Hello World") > 0);
+ } finally {
+ server.undeployProcess(bundleName);
+ }
+
+ }
+
public void testDynPartner() throws Exception {
String bundleName = "TestDynPartner";
if(!server._ode.getProcessStore().getPackages().contains(bundleName))
server.deployProcess(bundleName);
@@ -10,6 +24,7 @@
bundleName, "testRequest.soap");
assertTrue(response.indexOf("OK") > 0);
+ System.out.println("=> " + response);
} finally {
server.undeployProcess(bundleName);
}
Added: ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/HelloWorld2.bpel
URL:
http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/HelloWorld2.bpel?rev=661148&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/HelloWorld2.bpel
(added)
+++ ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/HelloWorld2.bpel Wed
May 28 16:34:16 2008
@@ -0,0 +1,68 @@
+<!--
+ ~ 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.
+ -->
+<process name="HelloWorld2"
+ targetNamespace="http://ode/bpel/unit-test"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:tns="http://ode/bpel/unit-test"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://ode/bpel/unit-test.wsdl"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="HelloWorld2.wsdl"
+ namespace="http://ode/bpel/unit-test.wsdl"
+ importType="http://schemas.xmlsoap.org/wsdl/" />
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink"
+ partnerLinkType="test:HelloPartnerLinkType"
+ myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="tmpVar" type="xsd:string"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from variable="myVar" part="TestPart"/>
+ <to variable="tmpVar"/>
+ </copy>
+ <copy>
+ <from>concat($tmpVar,' World')</from>
+ <to variable="myVar" part="TestPart"/>
+ </copy>
+ </assign>
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"/>
+ </sequence>
+</process>
Added: ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/HelloWorld2.wsdl
URL:
http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/HelloWorld2.wsdl?rev=661148&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/HelloWorld2.wsdl
(added)
+++ ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/HelloWorld2.wsdl Wed
May 28 16:34:16 2008
@@ -0,0 +1,68 @@
+<?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">
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part name="TestPart" type="xsd:string"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="" style="rpc"/>
+ <wsdl:input>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ 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/helloWorld"/>
+ </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/trunk/axis2-war/src/test/resources/TestHelloWorld2/deploy.xml
URL:
http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/deploy.xml?rev=661148&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/deploy.xml (added)
+++ ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/deploy.xml Wed May
28 16:34:16 2008
@@ -0,0 +1,30 @@
+<!--
+ ~ 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">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
Added: ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/testRequest.soap
URL:
http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/testRequest.soap?rev=661148&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/testRequest.soap
(added)
+++ ode/trunk/axis2-war/src/test/resources/TestHelloWorld2/testRequest.soap Wed
May 28 16:34:16 2008
@@ -0,0 +1,28 @@
+<?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.
+ -->
+
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <!-- test soap message -->
+ <SOAP-ENV:Body>
+ <ns1:hello xmlns:ns1="http://ode/bpel/unit-test.wsdl">
+ <TestPart xmlns="">Hello</TestPart>
+ </ns1:hello>
+ </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
Modified:
ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapMessageConverter.java
URL:
http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapMessageConverter.java?rev=661148&r1=661147&r2=661148&view=diff
==============================================================================
---
ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapMessageConverter.java
(original)
+++
ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapMessageConverter.java
Wed May 28 16:34:16 2008
@@ -326,7 +326,8 @@
public void createSoapBody(org.apache.axiom.soap.SOAPBody sb, SOAPBody
soapBody, Message msgDef,
Element message, String rpcWrapper) throws
AxisFault {
- OMElement partHolder = _isRPC ? _soapFactory.createOMElement(new
QName(soapBody.getNamespaceURI(),rpcWrapper), sb) : sb;
+ OMElement partHolder = _isRPC ? _soapFactory
+ .createOMElement(new QName(soapBody.getNamespaceURI(),
rpcWrapper, "odens"), sb) : sb;
List<Part> parts = msgDef.getOrderedParts(soapBody.getParts());
for (Part part : parts) {
Modified: ode/trunk/distro/helloworld.sh
URL:
http://svn.apache.org/viewvc/ode/trunk/distro/helloworld.sh?rev=661148&r1=661147&r2=661148&view=diff
==============================================================================
--- ode/trunk/distro/helloworld.sh (original)
+++ ode/trunk/distro/helloworld.sh Wed May 28 16:34:16 2008
@@ -1 +1 @@
-sh target/*/bin/sendsoap.sh http://localhost:8080/ode/processes/helloWorld
target/*/examples/HelloWorld2/testRequest.soap
+sh target/*/bin/sendsoap http://localhost:8080/ode/processes/helloWorld
target/*/examples/HelloWorld2/testRequest.soap
Propchange: ode/trunk/distro/helloworld.sh
------------------------------------------------------------------------------
svn:executable = *
Modified: ode/trunk/il-common/src/main/java/org/apache/ode/il/OMUtils.java
URL:
http://svn.apache.org/viewvc/ode/trunk/il-common/src/main/java/org/apache/ode/il/OMUtils.java?rev=661148&r1=661147&r2=661148&view=diff
==============================================================================
--- ode/trunk/il-common/src/main/java/org/apache/ode/il/OMUtils.java (original)
+++ ode/trunk/il-common/src/main/java/org/apache/ode/il/OMUtils.java Wed May 28
16:34:16 2008
@@ -134,12 +134,13 @@
}
public static OMElement toOM(Element src, OMFactory omf, OMContainer
parent) {
- OMNamespace elns = null;
+ OMElement omElement = parent == null ?
omf.createOMElement(src.getLocalName(), null) :
+ omf.createOMElement(src.getLocalName(), null, parent);
if (src.getNamespaceURI() != null) {
- elns = omf.createOMNamespace(src.getNamespaceURI(),
src.getPrefix());
+ if (src.getPrefix() != null)
+
omElement.setNamespace(omf.createOMNamespace(src.getNamespaceURI(),
src.getPrefix()));
+ else omElement.declareDefaultNamespace(src.getNamespaceURI());
}
- OMElement omElement = parent == null ?
omf.createOMElement(src.getLocalName(),elns) :
- omf.createOMElement(src.getLocalName(),elns,parent);
if (parent == null) {
NSContext nscontext = DOMUtils.getMyNSContext(src);
@@ -226,4 +227,12 @@
return toOM(doc.getDocumentElement(),
OMAbstractFactory.getOMFactory());
}
+ public static void main(String[] args) {
+ OMFactory fact = OMAbstractFactory.getOMFactory();
+ OMNamespace ns = fact.createOMNamespace("ns:foo:bar", null);
+ OMElement elmt = fact.createOMElement("baz", null);
+ elmt.declareDefaultNamespace("ns:foo:bar");
+ System.out.println(elmt);
+
+ }
}