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/04/22 19:57:20 UTC

svn commit: r650597 - in /ode/branches/APACHE_ODE_1.1: ./ axis2-war/src/test/java/org/apache/ode/axis2/ axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/ axis2-war/src/test/resources/TestHttpBinding/ axis2/src/main/java/org/apache/ode/axis2/ ax...

Author: mriou
Date: Tue Apr 22 10:57:17 2008
New Revision: 650597

URL: http://svn.apache.org/viewvc?rev=650597&view=rev
Log:
ODE-250 Biggy unit test for http binding. Contributed by Alexis Midon again.

Added:
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/ArithmeticsJettyWrapper.java
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/Arithmetics.wsdl
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/deploy.xml
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/http-binding-test.bpel
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/http-binding-test.wsdl
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/testRequest.soap
Modified:
    ode/branches/APACHE_ODE_1.1/Rakefile
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java
    ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
    ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
    ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilder.java
    ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/util/URLEncodedTransformer.java
    ode/branches/APACHE_ODE_1.1/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilderTest.java

Modified: ode/branches/APACHE_ODE_1.1/Rakefile
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/Rakefile?rev=650597&r1=650596&r2=650597&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/Rakefile (original)
+++ ode/branches/APACHE_ODE_1.1/Rakefile Tue Apr 22 10:57:17 2008
@@ -177,7 +177,7 @@
       end
     end
     
-    test.with projects("tools"), libs, AXIS2_TEST, AXIOM, JAVAX.servlet
+    test.with projects("tools"), libs, AXIS2_TEST, AXIOM, JAVAX.servlet, Buildr::Jetty::REQUIRES
     test.setup task(:prepare_webapp) do |task|
       cp_r _("src/main/webapp"), _("target/test-classes")
       cp Dir[_("src/main/webapp/WEB-INF/classes/*")], _("target/test-classes")

Modified: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java?rev=650597&r1=650596&r2=650597&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java (original)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java Tue Apr 22 10:57:17 2008
@@ -77,13 +77,13 @@
             super.stop();
         }
 
-        protected void deployProcess(String bundleName) {
+        public void deployProcess(String bundleName) {
             _ode.getProcessStore().deploy(new File(getBundleDir(bundleName)));
         }
-        protected void undeployProcess(String bundleName) {
+        public void undeployProcess(String bundleName) {
             _ode.getProcessStore().undeploy(new File(getBundleDir(bundleName)));
         }
-        protected boolean isDeployed(String bundleName) {
+        public boolean isDeployed(String bundleName) {
             return _ode.getProcessStore().getPackages().contains(bundleName);
         }
 
@@ -118,7 +118,7 @@
             getConfigurationContext().getAxisConfiguration().addService(axisService);            
         }
 
-        protected String sendRequestFile(String endpoint, String bundleName, String filename) {
+        public String sendRequestFile(String endpoint, String bundleName, String filename) {
             try {
                 return HttpSoapSender.doSend(new URL(endpoint),
                         new FileInputStream(getBundleDir(bundleName)+"/" + filename), null, 0, null, null, null);

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/ArithmeticsJettyWrapper.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/ArithmeticsJettyWrapper.java?rev=650597&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/ArithmeticsJettyWrapper.java (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/ArithmeticsJettyWrapper.java Tue Apr 22 10:57:17 2008
@@ -0,0 +1,245 @@
+/*
+ * 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.
+ */
+
+package org.apache.ode.axis2.httpbinding;
+
+import org.mortbay.jetty.handler.AbstractHandler;
+import org.mortbay.jetty.handler.ContextHandler;
+import org.mortbay.jetty.handler.ContextHandlerCollection;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.Request;
+import org.apache.ode.utils.DOMUtils;
+import org.apache.ode.utils.StreamUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:midon@intalio.com">Alexis Midon</a>
+ */
+public class ArithmeticsJettyWrapper {
+
+    protected Server server;
+    private ContextHandlerCollection handlerColl;
+
+    public ArithmeticsJettyWrapper() throws Exception {
+        this(7070);
+    }
+
+    public ArithmeticsJettyWrapper(int port) throws Exception {
+        server = new Server(port);
+        // Adding the buildr handler to control our server lifecycle
+        ContextHandler context = new ContextHandler();
+        context.setContextPath("/HttpBindingTestService");
+        Handler handler = new ArithmeticsServiceHandler();
+        context.setHandler(handler);
+
+        handlerColl = new ContextHandlerCollection();
+        handlerColl.setHandlers(new Handler[]{context});
+
+        server.addHandler(handlerColl);
+    }
+
+    private class ArithmeticsServiceHandler extends AbstractHandler {
+        /*
+        6 urls to handle:
+        (GET)   http://localhost:8080/HttpBindingTestService/OlaElMundo-GET/plus/(left):(right)
+        (GET)   http://         ........                    /OlaElMundo-GET/minus?left=&right=
+        (POST)  http://         ........                    /OlaElMundo-POST/plus
+        (POST)  http://         ........                    /OlaElMundo-POST/minus
+        (POST)  http://         ........                    /SalutLaTerre/addition
+        (POST)  http://         ........                    /SalutLaTerre/sumOfIntegers
+        */
+        public void handle(String s, HttpServletRequest request, HttpServletResponse response, int i) throws IOException, ServletException {
+
+            try {
+                String method = request.getMethod();
+                String uri = request.getRequestURI();
+                if ("/HttpBindingTestService/".equals(uri)) {
+                    response.getWriter().println("HttpBindingTestService ready!");
+                } else if (uri.contains("OlaElMundo-GET")) {
+                    if (!"GET".equalsIgnoreCase(method)) {
+                        response.sendError(405, "Expecting method is GET");
+                    } else {
+                        if (!uri.contains("plus") && !uri.contains("minus")) {
+                            response.sendError(404);
+                        } else {
+                            boolean ok = true;
+                            int left = 0, right = 0;
+                            try {
+                                if (uri.contains("plus")) {
+                                    int index = uri.lastIndexOf("/");
+                                    String[] op = uri.substring(index + 1).split(":");
+                                    left = Integer.parseInt(op[0]);
+                                    right = Integer.parseInt(op[1]);
+                                } else if (uri.contains("minus")) {
+                                    left = Integer.parseInt(request.getParameter("left"));
+                                    right = -1 * Integer.parseInt(request.getParameter("right"));
+                                } else {
+                                    ok = false;
+                                }
+                            } catch (NumberFormatException e) {
+                                ok = false;
+                            }
+
+                            if (!ok) {
+                                response.sendError(400);
+                            } else {
+                                Document doc = DOMUtils.newDocument();
+                                Element resElt = doc.createElement("theresult");
+                                resElt.setTextContent(String.valueOf(left + right));
+                                response.getOutputStream().print(DOMUtils.domToString(resElt));
+                                response.getOutputStream().close();
+                                response.setStatus(200);
+                            }
+                        }
+                    }
+                } else if (uri.contains("OlaElMundo-POST")) {
+                    if (!"POST".equalsIgnoreCase(method)) {
+                        response.sendError(405, "Expecting method is POST");
+                        return;
+                    } else {
+                        String operation;
+                        if (!uri.contains("plus") && !uri.contains("minus")) {
+                            response.sendError(404);
+                        } else {
+                            // parse body, form-urlencoded
+                            int res = Integer.MIN_VALUE;
+                            boolean ok = true;
+                            StringBuffer sb = null;
+                            String body = new String(StreamUtils.read(request.getInputStream()));
+                            if (!body.matches("[^=]*=[+-]?\\d*&[^=]*=[+-]?\\d*")) {
+                                ok = false;
+                            } else {
+                                String[] sp = body.split("&");
+                                String[] op0 = sp[0].split("=");
+                                String[] op1 = sp[1].split("=");
+                                try {
+                                    int left, right;
+                                    if (op0[0].equals("left")) {
+                                        left = Integer.valueOf(op0[1]);
+                                        right = Integer.valueOf(op1[1]);
+                                    } else {
+                                        left = Integer.valueOf(op1[1]);
+                                        right = Integer.valueOf(op0[1]);
+                                    }
+                                    if (uri.contains("minus")) {
+                                        right = -1 * right;
+                                    }
+                                    res = left + right;
+                                } catch (NumberFormatException e) {
+                                    ok = false;
+                                }
+                            }
+                            if (!ok) {
+                                response.sendError(400);
+                            } else {
+                                Element resElt = DOMUtils.newDocument().createElement("theresult");
+                                resElt.setTextContent(String.valueOf(res));
+                                response.getOutputStream().print(DOMUtils.domToString(resElt));
+                                response.setStatus(200);
+                            }
+                        }
+                    }
+                } else if (uri.contains("SalutLaTerre")) {
+                    if (!"POST".equalsIgnoreCase(method)) {
+                        response.sendError(405, "Expecting method is POST");
+                        return;
+                    } else {
+                        if (uri.contains("addition")) {
+                            Document bodyDoc = parseBody(request.getInputStream(), response);
+                            if (bodyDoc != null) {
+                                // we expect the element operandList
+                                if (!"operandList".equals(bodyDoc.getDocumentElement().getNodeName())) {
+                                    response.sendError(400, "The first element should be named operandList");
+                                } else {
+                                    Element firstOperand = DOMUtils.getFirstChildElement(bodyDoc.getDocumentElement());
+                                    Element secondElement = DOMUtils.getNextSiblingElement(firstOperand);
+                                    String left = DOMUtils.getTextContent(firstOperand);
+                                    String right = DOMUtils.getTextContent(secondElement);
+                                    Element res = bodyDoc.createElementNS("http://ode/bpel/arithmetics", "theresult");
+                                    res.setTextContent(String.valueOf(Integer.valueOf(left) + Integer.valueOf(right)));
+                                    response.getOutputStream().print(DOMUtils.domToString(res));
+                                    response.setStatus(200);
+                                }
+                            }
+
+                        } else if (uri.contains("sumOfIntegers")) {
+                            Document bodyDoc = parseBody(request.getInputStream(), response);
+                            if (bodyDoc != null) {
+                                Element firstOperand = DOMUtils.getFirstChildElement(bodyDoc.getDocumentElement());
+                                Element secondElement = DOMUtils.getNextSiblingElement(firstOperand);
+                                int left = Integer.valueOf(DOMUtils.getTextContent(firstOperand));
+                                int right = Integer.valueOf(DOMUtils.getTextContent(secondElement));
+
+                                int min = Math.min(left,right);
+                                int max = Math.max(left,right);
+//                                Element arrayElt = bodyDoc.createElement("sumOfInteger");
+                                Element anElt = bodyDoc.createElementNS("http://ode/bpel/arithmetics", "sumOfInteger");
+                                Element msg = bodyDoc.createElement("msg");
+                                Element resultIs = bodyDoc.createElement("resultIs");
+                                msg.setTextContent("A dummy message we don't care about. Only purpose is to have a complex type");
+                                resultIs.setTextContent(String.valueOf((max*(max+1)-min*(min+1))/2));
+
+                                anElt.appendChild(msg);
+                                anElt.appendChild(resultIs);
+                                response.getOutputStream().print(DOMUtils.domToString(anElt));
+                                response.setStatus(200);
+                            }
+                        } else {
+                            response.sendError(404);
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                response.sendError(500, e.getMessage());
+            } finally {
+                ((Request) request).setHandled(true);
+            }
+        }
+
+        private Document parseBody(ServletInputStream bodyStream, HttpServletResponse response) throws IOException {
+            if (bodyStream == null) {
+                response.sendError(400, "Missing body!");
+            } else {
+                try {
+                    return DOMUtils.parse(bodyStream);
+                } catch (SAXException e) {
+                    response.sendError(400, "Failed to parse body! " + e.getMessage());
+                }
+            }
+            return null;
+        }
+    }
+
+    public static void main(String[] args) {
+        try {
+            new ArithmeticsJettyWrapper();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java?rev=650597&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java Tue Apr 22 10:57:17 2008
@@ -0,0 +1,62 @@
+package org.apache.ode.axis2.httpbinding;
+
+import org.apache.ode.axis2.Axis2TestBase;
+
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * <p/>
+ * This unit test passes an integer to a BPEL. Then the BPEL invokes the 6 operations of Arithmetics.wsdl.
+ * These operations are set up to use the various Http binding configurations.  
+ * <p/>
+ * From a "business" standpoint:<br/>
+ * Let N be the input number, stored in the testRequest.soap file<br/>
+ * This test will compute the Sum of the first (N + 300) positive integers.
+ * <p/>
+ * If N=10, the expected result is 310*(310+1)/2 = 48205
+ *
+ * @author <a href="mailto:midon@intalio.com">Alexis Midon</a>
+ */
+public class HttpBindingTest extends Axis2TestBase {
+    protected ArithmeticsJettyWrapper jettyWrapper;
+
+    CountDownLatch latch;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        latch = new CountDownLatch(1);
+        jettyWrapper = new ArithmeticsJettyWrapper(7070);
+        new Thread("HttpBindingJetty") {
+            public void run() {
+                try {
+                    jettyWrapper.server.start();
+                    latch.countDown();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        }.start();
+    }
+
+    protected void tearDown() throws Exception {
+        jettyWrapper.server.stop();
+        super.tearDown();
+    }
+
+    public void testHttpBinding() throws Exception {
+        // wait for jetty to be ready
+        latch.await();
+        String bundleName = "TestHttpBinding";
+        // deploy the required service
+        if (!server.isDeployed(bundleName)) server.deployProcess(bundleName);
+        try {
+            String response = server.sendRequestFile("http://localhost:8080/processes/helloWorld",
+                    bundleName, "testRequest.soap");
+            int valueInSoapRequest = 10;
+            int n = 300 + valueInSoapRequest;
+            assertTrue(response.indexOf(String.valueOf(n * (n + 1) / 2)) >= 0);
+        } finally {
+            server.undeployProcess(bundleName);
+        }
+    }
+}
\ No newline at end of file

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/Arithmetics.wsdl
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/Arithmetics.wsdl?rev=650597&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/Arithmetics.wsdl (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/Arithmetics.wsdl Tue Apr 22 10:57:17 2008
@@ -0,0 +1,189 @@
+<?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
+        xmlns="http://schemas.xmlsoap.org/wsdl/"
+        xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+        xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+        xmlns:tns="http://ode/bpel/arithmetics"
+        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+        targetNamespace="http://ode/bpel/arithmetics">
+
+
+    <wsdl:types>
+        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://ode/bpel/arithmetics">
+            <xsd:complexType name="operandListType">
+                <xsd:sequence>
+                    <xsd:element name="operand" type="xsd:string" maxOccurs="unbounded" minOccurs="2"/>
+                </xsd:sequence>
+            </xsd:complexType>
+
+            <xsd:element name="operandList" type="tns:operandListType"/>
+
+            <xsd:complexType name="resultType">
+                <xsd:sequence>
+                    <xsd:element name="msg" type="xsd:string"/>
+                    <xsd:element name="resultIs" type="xsd:int"/>
+                </xsd:sequence>
+            </xsd:complexType>
+
+            <xsd:element name="theresult" type="xsd:int"/>
+        </xsd:schema>
+    </wsdl:types>
+
+
+    <wsdl:message name="twoOperandRequest">
+        <wsdl:part name="left" type="xsd:integer"/>
+        <wsdl:part name="right" type="xsd:integer"/>
+    </wsdl:message>
+    <wsdl:message name="resultResponse">
+        <wsdl:part name="result" type="xsd:integer"/>
+    </wsdl:message>
+    <wsdl:message name="additionRequest">
+        <wsdl:part name="operands" element="tns:operandList"/>
+    </wsdl:message>
+    <wsdl:message name="additionResponse">
+        <wsdl:part name="result" element="tns:theresult"/>
+    </wsdl:message>
+    <wsdl:message name="sumOfIntegersRequest">
+        <wsdl:part name="range" type="tns:operandListType"/>
+    </wsdl:message>
+    <wsdl:message name="sumOfIntegersResponse">
+        <wsdl:part name="result" type="tns:resultType"/>
+    </wsdl:message>
+
+
+    <wsdl:portType name="OlaElMundoPortType">
+        <!-- will use with GET + urlReplacement + simple types (input/output)-->
+        <wsdl:operation name="plus">
+            <wsdl:input message="tns:twoOperandRequest"/>
+            <wsdl:output message="tns:resultResponse"/>
+        </wsdl:operation>
+        <!-- will use with GET + urlEncoded + simple types (input/output) -->
+        <wsdl:operation name="minus">
+            <wsdl:input message="tns:twoOperandRequest"/>
+            <wsdl:output message="tns:resultResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+    <wsdl:portType name="SalutLaTerrePortType">
+        <!-- will use with POST + text/xml + elements (input/output) -->
+        <wsdl:operation name="addition">
+            <wsdl:input message="tns:additionRequest"/>
+            <wsdl:output message="tns:additionResponse"/>
+        </wsdl:operation>
+        <!-- will use with POST + text/xml + complex type (input/output) -->
+        <wsdl:operation name="sumOfIntegers">
+            <wsdl:input message="tns:sumOfIntegersRequest"/>
+            <wsdl:output message="tns:sumOfIntegersResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+
+    <wsdl:binding name="OlaElMundoHttpBinding-GET" type="tns:OlaElMundoPortType">
+        <http:binding verb="GET"/>
+        <wsdl:operation name="plus">
+            <http:operation location="plus/(left):(right)"/>
+            <wsdl:input>
+                <http:urlReplacement/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="result"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="minus">
+            <http:operation location="minus"/>
+            <wsdl:input>
+                <http:urlEncoded/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="result"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+    <wsdl:binding name="OlaElMundoHttpBinding-POST" type="tns:OlaElMundoPortType">
+        <http:binding verb="POST"/>
+        <wsdl:operation name="plus">
+            <http:operation location="plus"/>
+            <wsdl:input>
+                <mime:content type="application/x-www-form-urlencoded"/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="result"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="minus">
+            <http:operation location="minus"/>
+            <wsdl:input>
+                <http:urlEncoded/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="result"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+
+    <wsdl:binding name="SalutLaTerreHttpBinding" type="tns:SalutLaTerrePortType">
+        <http:binding verb="POST"/>
+        <wsdl:operation name="addition">
+            <http:operation location="addition"/>
+            <wsdl:input>
+                <mime:content type="text/xml" part="operands"/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="result"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="sumOfIntegers">
+            <http:operation location="sumOfIntegers"/>
+            <wsdl:input>
+                <mime:content type="text/xml" part="range"/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="result"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+
+    <!--
+        6 urls to handle:
+        (GET)   http://localhost:8080/HttpBindingTestService/OlaElMundo-GET/plus/(left):(right)
+        (GET)   http://         ........                    /OlaElMundo-GET/minus?left=&right=
+        (POST)  http://         ........                    /OlaElMundo-POST/plus
+        (POST)  http://         ........                    /OlaElMundo-POST/minus
+        (POST)  http://         ........                    /SalutLaTerre/addition
+        (POST)  http://         ........                    /SalutLaTerre/sumOfIntegers
+    -->
+    <wsdl:service name="HttpBindingTestService">
+        <wsdl:port name="OlaElMundo-GET_httpport" binding="tns:OlaElMundoHttpBinding-GET">
+            <http:address location="http://localhost:7070/HttpBindingTestService/OlaElMundo-GET"/>
+        </wsdl:port>
+        <wsdl:port name="OlaElMundo-POST_httpport" binding="tns:OlaElMundoHttpBinding-POST">
+            <http:address location="http://localhost:7070/HttpBindingTestService/OlaElMundo-POST"/>
+        </wsdl:port>
+        <wsdl:port name="SalutLaTerre_httpport" binding="tns:SalutLaTerreHttpBinding">
+            <http:address location="http://localhost:7070/HttpBindingTestService/SalutLaTerre"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
+

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/deploy.xml
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/deploy.xml?rev=650597&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/deploy.xml (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/deploy.xml Tue Apr 22 10:57:17 2008
@@ -0,0 +1,40 @@
+<!--
+  ~ 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"
+    xmlns:dns="http://ode/bpel/arithmetics">
+
+
+	<process name="pns:HttpBindingTest">
+		<active>true</active>
+		<provide partnerLink="helloPartnerLink">
+			<service name="wns:HelloService" port="HelloPort"/>
+		</provide>
+        <invoke partnerLink="salutPartnerLink">
+            <service name="dns:HttpBindingTestService" port="SalutLaTerre_httpport"/>
+        </invoke>
+        <invoke partnerLink="olaGetPartnerLink">
+            <service name="dns:HttpBindingTestService" port="OlaElMundo-GET_httpport"/>
+        </invoke>
+        <invoke partnerLink="olaPostPartnerLink">
+            <service name="dns:HttpBindingTestService" port="OlaElMundo-POST_httpport"/>
+        </invoke>
+    </process>
+</deploy>

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/http-binding-test.bpel
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/http-binding-test.bpel?rev=650597&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/http-binding-test.bpel (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/http-binding-test.bpel Tue Apr 22 10:57:17 2008
@@ -0,0 +1,181 @@
+<!--
+  ~ 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="HttpBindingTest"
+         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"
+         xmlns:dummy="http://ode/bpel/arithmetics"
+         queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+         expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+    <import location="http-binding-test.wsdl"
+            namespace="http://ode/bpel/unit-test.wsdl"
+            importType="http://schemas.xmlsoap.org/wsdl/"/>
+
+    <partnerLinks>
+        <partnerLink name="helloPartnerLink"
+                     partnerLinkType="test:HelloPartnerLinkType" myRole="me"/>
+        <partnerLink name="salutPartnerLink"
+                     partnerLinkType="test:SalutLinkType" partnerRole="salut"/>
+        <partnerLink name="olaGetPartnerLink"
+                     partnerLinkType="test:OlaLinkType" partnerRole="ola"/>
+        <partnerLink name="olaPostPartnerLink"
+                     partnerLinkType="test:OlaLinkType" partnerRole="ola"/>
+    </partnerLinks>
+
+    <variables>
+        <variable name="inputVar" messageType="test:HelloMessage"/>
+        <variable name="outputVar" messageType="test:HelloMessage"/>
+        <variable name="operands" messageType="dummy:twoOperandRequest"/>
+        <variable name="result" messageType="dummy:resultResponse"/>
+        <variable name="additionInput" messageType="dummy:additionRequest"/>
+        <variable name="additionOutput" messageType="dummy:additionResponse"/>
+        <variable name="sumOfIntegersInput" messageType="dummy:sumOfIntegersRequest"/>
+        <variable name="sumOfIntegersOutput" messageType="dummy:sumOfIntegersResponse"/>
+    </variables>
+
+    <!-- ###################################################### -->
+    <!-- ###################################################### -->
+    <!-- let N be the input number -->
+    <!-- This sequence will compute the Sum of the first (N + 300) positive integers -->
+    <!-- ###################################################### -->
+    <!-- ###################################################### -->
+    <sequence>
+        <receive name="start" partnerLink="helloPartnerLink" portType="test:HelloPortType"
+                 operation="hello" variable="inputVar" createInstance="yes"/>
+
+        <!-- Compute r = x + 100 -->
+        <assign>
+            <copy>
+                <from>$inputVar.TestPart</from>
+                <to>$operands.left</to>
+            </copy>
+            <copy>
+                <from>100</from>
+                <to>$operands.right</to>
+            </copy>
+        </assign>
+
+        <invoke partnerLink="olaGetPartnerLink" portType="dummy:OlaElMundoPortType"
+                operation="plus" inputVariable="operands" outputVariable="result"/>
+
+        <!-- Compute r = r - 200  (= x - 100)    -->
+        <assign>
+            <copy>
+                <from>$result.result</from>
+                <to>$operands.left</to>
+            </copy>
+            <copy>
+                <from>200</from>
+                <to>$operands.right</to>
+            </copy>
+        </assign>
+        <invoke partnerLink="olaGetPartnerLink" portType="dummy:OlaElMundoPortType"
+                operation="minus" inputVariable="operands" outputVariable="result"/>
+
+        <!-- Compute r = r + 300 (= x + 200) -->
+        <assign>
+            <copy>
+                <from>$result.result</from>
+                <to>$operands.left</to>
+            </copy>
+            <copy>
+                <from>300</from>
+                <to>$operands.right</to>
+            </copy>
+        </assign>
+        <invoke partnerLink="olaPostPartnerLink" portType="dummy:OlaElMundoPortType"
+                operation="plus" inputVariable="operands" outputVariable="result"/>
+
+        <!-- Compute r = r - 400 (= x - 200) -->
+        <assign>
+            <copy>
+                <from>$result.result</from>
+                <to>$operands.left</to>
+            </copy>
+            <copy>
+                <from>400</from>
+                <to>$operands.right</to>
+            </copy>
+        </assign>
+        <invoke partnerLink="olaPostPartnerLink" portType="dummy:OlaElMundoPortType"
+                operation="minus" inputVariable="operands" outputVariable="result"/>
+
+        <!-- Compute r = r + 500 (= x + 300) -->
+        <assign>
+            <!-- First, build the proper element -->
+            <copy>
+                <from>
+                    <literal>
+                        <dummy:operandList>
+                            <dummy:operand></dummy:operand>
+                            <dummy:operand>500</dummy:operand>
+                        </dummy:operandList>
+                    </literal>
+                </from>
+                <to>$additionInput.operands</to>
+            </copy>
+            <!-- then assign the value from the previous result -->
+            <copy>
+                <from>$result.result</from>
+                <to>$additionInput.operands/dummy:operand[1]</to>
+                <!--<to>$additionInput.operands//dummy:operandList/dummy:operand[1]</to>-->
+            </copy>
+        </assign>
+        <invoke partnerLink="salutPartnerLink" portType="dummy:SalutLaTerrePortType"
+                operation="addition" inputVariable="additionInput" outputVariable="additionOutput"/>
+
+
+        <assign>
+            <!-- First, build the proper element -->
+            <copy>
+                <from>
+                    <literal>
+                        <dummy:myList>
+                            <dummy:operand>0</dummy:operand>
+                            <dummy:operand></dummy:operand>
+                        </dummy:myList>
+                    </literal>
+                </from>
+                <to>$sumOfIntegersInput.range</to>
+            </copy>
+            <!-- then assign the value from the previous result -->
+            <copy>
+                <from>$additionOutput.result</from>
+                <to>$sumOfIntegersInput.range/dummy:operand[2]</to>
+                <!--<to>$additionInput.operands//dummy:operandList/dummy:operand[1]</to>-->
+            </copy>
+        </assign>
+        <invoke partnerLink="salutPartnerLink" portType="dummy:SalutLaTerrePortType"
+                operation="sumOfIntegers" inputVariable="sumOfIntegersInput" outputVariable="sumOfIntegersOutput"/>
+
+
+        <assign>
+            <copy>
+                <from>$sumOfIntegersOutput.result/dummy:resultIs</from>
+                <to>$outputVar.TestPart</to>
+            </copy>
+        </assign>
+        <reply name="end" partnerLink="helloPartnerLink" portType="test:HelloPortType"
+               operation="hello" variable="outputVar"/>
+    </sequence>
+
+</process>

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/http-binding-test.wsdl
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/http-binding-test.wsdl?rev=650597&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/http-binding-test.wsdl (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/http-binding-test.wsdl Tue Apr 22 10:57:17 2008
@@ -0,0 +1,77 @@
+<?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:dummy="http://ode/bpel/arithmetics"
+    xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+    <wsdl:import namespace="http://axis2.ode.apache.org"
+                 location="Arithmetics.wsdl"/>
+
+    <wsdl:message name="HelloMessage">
+        <wsdl:part name="TestPart" type="xsd:int"/>
+    </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:partnerLinkType>
+    <plnk:partnerLinkType name="SalutLinkType">
+        <plnk:role name="salut" portType="dummy:SalutLaTerrePortType"/>
+    </plnk:partnerLinkType>
+    <plnk:partnerLinkType name="OlaLinkType">
+        <plnk:role name="ola" portType="dummy:OlaElMundoPortType"/>
+    </plnk:partnerLinkType>
+</wsdl:definitions>
+

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/testRequest.soap
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/testRequest.soap?rev=650597&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/testRequest.soap (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBinding/testRequest.soap Tue Apr 22 10:57:17 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="">10</TestPart>
+    </ns1:hello>
+  </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>

Modified: ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java?rev=650597&r1=650596&r2=650597&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java (original)
+++ ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java Tue Apr 22 10:57:17 2008
@@ -330,7 +330,7 @@
             }
         } catch (Exception ex) {
             __log.error("Could not create external service.", ex);
-            throw new ContextException("Error creating external service.", ex);
+            throw new ContextException("Error creating external service! name:"+serviceName+", port:"+portName, ex);
         }
 
         // if not SOAP nor HTTP binding

Modified: ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java?rev=650597&r1=650596&r2=650597&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java (original)
+++ ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java Tue Apr 22 10:57:17 2008
@@ -22,6 +22,7 @@
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.commons.httpclient.URIException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.axis2.ExternalService;
@@ -124,6 +125,7 @@
     }
 
     public void invoke(PartnerRoleMessageExchange odeMex) {
+        if (log.isDebugEnabled()) log.debug("Preparing " + getClass().getSimpleName() + " invocation...");
         try {
             // build the http method
             final HttpMethod method = methodBuilder.buildHttpMethod(odeMex);
@@ -154,7 +156,7 @@
                 odeMex.replyOneWayOk();
             }
         } catch (UnsupportedEncodingException e) {
-            String errmsg = "Error sending message to Axis2 for ODE mex " + odeMex;
+            String errmsg = "Error sending message to " + getClass().getSimpleName() + " for ODE mex " + odeMex;
             log.error(errmsg, e);
             odeMex.replyWithFailure(MessageExchange.FailureType.FORMAT_ERROR, errmsg, null);
         }
@@ -180,6 +182,10 @@
                 if (log.isDebugEnabled())
                     log.debug("Executing http request : " + method.getName() + " " + method.getURI());
                 final int statusCode = client.executeMethod(method);
+                // invoke getResponseBody to force the loading of the body 
+                // Actually the processResponse may happen in a separate thread and
+                // as a result the connection might be closed before the body processing (see the finally clause below).
+                byte[] responseBody = method.getResponseBody();
                 // ... and process the response
                 processResponse(statusCode);
             } catch (final IOException e) {
@@ -206,6 +212,16 @@
 
         public void processResponse(int statusCode) {
             // a one-way message does not care about the response
+            try {
+                // log the URI since the engine may have moved on while this One Way request was executing
+                if (statusCode >= 400) {
+                    if (log.isWarnEnabled()) log.warn("OneWay http request ["+method.getURI()+"] failed with status: " + method.getStatusLine());
+                } else {
+                    if (log.isDebugEnabled()) log.debug("OneWay http request ["+method.getURI()+"] status: " + method.getStatusLine());
+                }
+            } catch (URIException e) {
+                if(log.isDebugEnabled()) log.debug(e);
+            }
         }
     }
 
@@ -287,12 +303,13 @@
             try {
                 final InputStream bodyAsStream = method.getResponseBodyAsStream();
                 if (bodyAsStream == null) {
-                    String errmsg = "Request body of a Two-way message may be empty! Msg Id=" + mexId;
+                    String errmsg = "Request body of a Two-way message may not be empty! Msg Id=" + mexId;
                     log.error(errmsg);
                     odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, null);
                     return;
                 } else {
 
+                    // only text/xml is supported in the response body
                     // parse the body
                     Element bodyElement;
                     try {
@@ -307,6 +324,7 @@
                         org.apache.ode.bpel.iapi.Message odeResponse = odeMex.createMessage(odeMex.getOperation().getOutput().getMessage().getQName());
 
                         // we expect a single part per output message
+                        // see org.apache.ode.axis2.httpbinding.HttpBindingValidator call in constructor
                         Part part = (Part) operation.getOutput().getMessage().getParts().values().iterator().next();
 
                         Element partElement = processBodyElement(part, bodyElement);
@@ -345,7 +363,7 @@
             Document doc = DOMUtils.newDocument();
             Element partElement = doc.createElementNS(null, part.getName());
             if (part.getElementName() != null) {
-                partElement.appendChild(bodyElement);
+                partElement.appendChild(doc.importNode(bodyElement, true));
             } else {
                 if (DOMUtils.isEmptyElement(bodyElement)) {
                     // Append an empty text node.
@@ -363,10 +381,6 @@
                             Node child = bodyElement.getChildNodes().item(m);
                             partElement.appendChild(doc.importNode(child, true));
                         }
-                        if (bodyElement.hasAttributes()) {
-                            if (log.isWarnEnabled())
-                                log.warn("Element received for output part " + part.getName() + " has attributes that won't be imported into ODE.");
-                        }
                     }
                 }
 
@@ -376,3 +390,4 @@
 
     }
 }
+

Modified: ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilder.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilder.java?rev=650597&r1=650596&r2=650597&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilder.java (original)
+++ ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilder.java Tue Apr 22 10:57:17 2008
@@ -51,6 +51,8 @@
 import java.util.HashMap;
 import java.util.Iterator;
 
+import com.ibm.wsdl.PartImpl;
+
 /**
  * @author <a href="mailto:midon@intalio.com">Alexis Midon</a>
  */
@@ -101,7 +103,7 @@
     }
 
     protected HttpMethod prepareHttpMethod(BindingOperation bindingOperation, Map<String, Element> partValues, String rootUri) throws UnsupportedEncodingException {
-        if(log.isDebugEnabled())log.debug("Preparing http request...");
+        if (log.isDebugEnabled()) log.debug("Preparing http request...");
         HttpMethod method;
         BindingInput bindingInput = bindingOperation.getBindingInput();
         HTTPOperation httpOperation = (HTTPOperation) WsdlUtils.getOperationExtension(bindingOperation);
@@ -120,7 +122,8 @@
                 URLEncodedTransformer transformer = new URLEncodedTransformer();
                 queryPath = transformer.transform(partValues);
             }
-            method = new GetMethod(rootUri + '/' + relativeUri);
+            String uri = rootUri + (relativeUri.startsWith("/") ? "" : "/") + relativeUri;
+            method = new GetMethod(uri);
             method.setQueryString(queryPath);
             // Let http-client manage the redirection for GET
             // see org.apache.commons.httpclient.params.HttpClientParams.MAX_REDIRECTS
@@ -135,14 +138,20 @@
             } else if (contentType.endsWith(CONTENT_TYPE_TEXT_XML)) {
                 // assumption is made that there is a single part
                 // validation steps in the constructor must warranty that
-                Node part = partValues.values().iterator().next();
-                String xmlString = DOMUtils.domToString(part);
+                Part part = (Part) bindingOperation.getOperation().getInput().getMessage().getParts().values().iterator().next();
+                Element partValue = partValues.get(part.getName());
+                // if the part has an element name, we must take the first element
+                if(part.getElementName()!=null){
+                    partValue = DOMUtils.getFirstChildElement(partValue);
+                }
+                String xmlString = DOMUtils.domToString(partValue);
                 requestEntity = new ByteArrayRequestEntity(xmlString.getBytes(), contentType);
             } else {
                 // should not happen because of HttpBindingValidator, but never say never
                 throw new IllegalArgumentException("Unsupported content-type!");
             }
-            PostMethod post = new PostMethod(rootUri + '/' + relativeUri);
+            String uri = rootUri + (relativeUri.startsWith("/") ? "" : "/") + relativeUri;
+            PostMethod post = new PostMethod(uri);
             post.setRequestEntity(requestEntity);
             method = post;
         } else {

Modified: ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/util/URLEncodedTransformer.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/util/URLEncodedTransformer.java?rev=650597&r1=650596&r2=650597&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/util/URLEncodedTransformer.java (original)
+++ ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/util/URLEncodedTransformer.java Tue Apr 22 10:57:17 2008
@@ -25,6 +25,7 @@
 import org.apache.ode.axis2.httpbinding.Messages;
 import org.w3c.dom.Element;
 
+import javax.wsdl.Part;
 import java.util.Iterator;
 import java.util.Map;
 

Modified: ode/branches/APACHE_ODE_1.1/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilderTest.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilderTest.java?rev=650597&r1=650596&r2=650597&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilderTest.java (original)
+++ ode/branches/APACHE_ODE_1.1/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilderTest.java Tue Apr 22 10:57:17 2008
@@ -132,14 +132,14 @@
     public void testHello() throws Exception {
         String uri = ((HTTPAddress) dummyPort.getExtensibilityElements().get(0)).getLocationURI();
         String expectedUri = uri + "/" + "DummyService/hello";
-        Element msgEl, partEl;
+        Element msgEl, helloEl;
         {
             Document odeMsg = DOMUtils.newDocument();
             msgEl = odeMsg.createElementNS(null, "message");
-            partEl = odeMsg.createElementNS(null, "parameters");
+            Element partEl = odeMsg.createElementNS(null, "parameters");
             odeMsg.appendChild(msgEl);
             msgEl.appendChild(partEl);
-            Element helloEl = odeMsg.createElementNS(null, "hello");
+            helloEl = odeMsg.createElementNS(null, "hello");
             helloEl.setTextContent("This is a test. How is it going so far?");
             partEl.appendChild(helloEl);
         }
@@ -154,7 +154,7 @@
 
         byte[] content = ((ByteArrayRequestEntity) ((PostMethod) httpMethod).getRequestEntity()).getContent();
         String b = new String(content);
-        assertEquals("Invalid body in generated http query", DOMUtils.domToString(partEl), b);
+        assertEquals("Invalid body in generated http query", DOMUtils.domToString(helloEl), b);
     }