Author: objectiser
Date: 2010-01-13 09:19:25 -0500 (Wed, 13 Jan 2010)
New Revision: 458
Added:
trunk/integration-tests/src/test/java/org/jboss/soa/bpel/tests/testcases/RiftSaw154TestCase.java
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/.project
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/bpel/
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/bpel/HelloWorld.bpel
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/bpel/HelloWorld.wsdl
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/bpel/bpel-deploy.xml
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/build.xml
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/messages/
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/messages/hello_request1.xml
Modified:
trunk/integration-tests/build.xml
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSDLParser.java
Log:
Fix for RIFTSAW-154 - was throwing exception on one-way requests.
Modified: trunk/integration-tests/build.xml
===================================================================
--- trunk/integration-tests/build.xml 2010-01-13 08:20:46 UTC (rev 457)
+++ trunk/integration-tests/build.xml 2010-01-13 14:19:25 UTC (rev 458)
@@ -139,6 +139,7 @@
<ant antfile="src/test/resources/testcases/RiftSaw_118/build.xml" />
<ant antfile="src/test/resources/testcases/RiftSaw_144/build.xml" />
+ <ant antfile="src/test/resources/testcases/RiftSaw_154/build.xml" />
</target>
</project>
Added:
trunk/integration-tests/src/test/java/org/jboss/soa/bpel/tests/testcases/RiftSaw154TestCase.java
===================================================================
---
trunk/integration-tests/src/test/java/org/jboss/soa/bpel/tests/testcases/RiftSaw154TestCase.java
(rev 0)
+++
trunk/integration-tests/src/test/java/org/jboss/soa/bpel/tests/testcases/RiftSaw154TestCase.java 2010-01-13
14:19:25 UTC (rev 458)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.soa.bpel.tests.testcases;
+
+import org.jboss.soa.bpel.tests.RiftSawTest;
+import org.jboss.soa.bpel.tests.RiftSawTestSetup;
+
+import junit.framework.Test;
+
+/**
+ * Test case for running the RiftSaw_154 testcase.
+ */
+public class RiftSaw154TestCase extends RiftSawTest {
+
+ private static final String TEST_NAME = "RiftSaw_154";
+
+ public RiftSaw154TestCase() {
+ super(TEST_NAME);
+ }
+
+ public static Test suite() {
+ return(new RiftSawTestSetup(RiftSaw154TestCase.class,
+ TEST_NAME, "RiftSaw_154-1.jar"));
+ }
+
+ public void testSendHello() throws Exception {
+ // Just check whether sending SOAP request results in
+ // an exception
+ String result=sendSOAPMessage("hello_request1.xml",
+ "http://localhost:8080/RiftSaw_154WS");
+
+ if (result != null && result.indexOf("Fault") != -1) {
+ fail("Fault returned from oneway test");
+ }
+ }
+}
Added: trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/.project
===================================================================
--- trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/.project
(rev 0)
+++ trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/.project 2010-01-13
14:19:25 UTC (rev 458)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Quickstart_bpel_hello_world</name>
+ <comment></comment>
+ <projects>
+ <project>Quickstart_bpel_hello_world</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.bpel.validator.builder</name>
+ <arguments>
+ <dictionary>
+ <key>debug</key>
+ <value>false</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/bpel/HelloWorld.bpel
===================================================================
--- trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/bpel/HelloWorld.bpel
(rev 0)
+++
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/bpel/HelloWorld.bpel 2010-01-13
14:19:25 UTC (rev 458)
@@ -0,0 +1,51 @@
+<!--
+ ~ 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="HelloWorldOneWay"
+
targetNamespace="http://www.jboss.org/bpel/examples"
+
xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+
xmlns:tns="http://www.jboss.org/bpel/examples"
+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+
xmlns:intf="http://www.jboss.org/bpel/examples/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="HelloWorld.wsdl"
+
namespace="http://www.jboss.org/bpel/examples/wsdl"
+
importType="http://schemas.xmlsoap.org/wsdl/" />
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink"
+ partnerLinkType="intf:HelloPartnerLinkType"
+ myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="intf:HelloMessage"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="intf:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+ </sequence>
+</process>
Added:
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/bpel/HelloWorld.wsdl
===================================================================
--- trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/bpel/HelloWorld.wsdl
(rev 0)
+++
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/bpel/HelloWorld.wsdl 2010-01-13
14:19:25 UTC (rev 458)
@@ -0,0 +1,61 @@
+<?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://www.jboss.org/bpel/examples/wsdl"
+
xmlns="http://schemas.xmlsoap.org/wsdl/"
+
xmlns:tns="http://www.jboss.org/bpel/examples/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: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://www.jboss.org/bpel/examples/wsdl"
+ use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloOneWayService">
+ <wsdl:port name="HelloOneWayPort"
binding="tns:HelloSoapBinding">
+ <soap:address
location="http://localhost:8080/RiftSaw_154WS"/>
+ </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:
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/bpel/bpel-deploy.xml
===================================================================
--- trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/bpel/bpel-deploy.xml
(rev 0)
+++
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/bpel/bpel-deploy.xml 2010-01-13
14:19:25 UTC (rev 458)
@@ -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:bpl="http://www.jboss.org/bpel/examples"
+
xmlns:intf="http://www.jboss.org/bpel/examples/wsdl">
+
+
+ <process name="bpl:HelloWorldOneWay">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="intf:HelloOneWayService"
port="HelloOneWayPort"/>
+ </provide>
+ </process>
+</deploy>
Added: trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/build.xml
===================================================================
--- trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/build.xml
(rev 0)
+++ trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/build.xml 2010-01-13
14:19:25 UTC (rev 458)
@@ -0,0 +1,30 @@
+<project name="RiftSaw_154" default="deploy"
basedir=".">
+
+ <description>
+ ${ant.project.name}
+ ${line.separator}
+ </description>
+
+ <property name="version" value="1" />
+
+ <property name="deploy.dir" value="${basedir}/target/tests"/>
+ <property name="test.dir"
value="${basedir}/src/test/resources/testcases/${ant.project.name}" />
+
+ <property name="jar.name"
value="${ant.project.name}-${version}.jar" />
+
+ <target name="deploy">
+ <echo>Deploy ${ant.project.name}</echo>
+ <mkdir dir="${deploy.dir}/${ant.project.name}" />
+ <jar basedir="${test.dir}/bpel"
destfile="${deploy.dir}/${ant.project.name}/${jar.name}" />
+
+ <copy todir="${deploy.dir}/${ant.project.name}">
+ <fileset dir="${test.dir}/messages"/>
+ </copy>
+ </target>
+
+ <target name="undeploy">
+ <echo>Undeploy ${ant.project.name}</echo>
+ <delete file="${deploy.dir}/${jar.name}" />
+ </target>
+
+</project>
Added:
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/messages/hello_request1.xml
===================================================================
---
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/messages/hello_request1.xml
(rev 0)
+++
trunk/integration-tests/src/test/resources/testcases/RiftSaw_154/messages/hello_request1.xml 2010-01-13
14:19:25 UTC (rev 458)
@@ -0,0 +1,8 @@
+<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsdl="http://www.jboss.org/bpel/examples/wsdl">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <wsdl:hello>
+ <TestPart>Hello</TestPart>
+ </wsdl:hello>
+ </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2010-01-13
08:20:46 UTC (rev 457)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2010-01-13
14:19:25 UTC (rev 458)
@@ -105,12 +105,18 @@
getEngine().invoke(invocationContext);
// Handle response
- SOAPMessage responseMessage = invocationContext.getInvocationResult();
+ SOAPMessage responseMessage = null;
+
+ if (isResponseExpected(messageElement)) {
+ responseMessage = invocationContext.getInvocationResult();
- if(log.isDebugEnabled())
- log.debug( "ODE outbound message: \n" +
- DOMWriter.printNode(responseMessage.getSOAPPart().getEnvelope(), true)
- );
+ if(log.isDebugEnabled())
+ log.debug( "ODE outbound message: \n" +
+ DOMWriter.printNode(responseMessage.getSOAPPart().getEnvelope(), true)
+ );
+ } else if (log.isDebugEnabled()) {
+ log.debug( "ODE no outbound message");
+ }
return responseMessage;
}
@@ -137,6 +143,32 @@
}
}
+ public boolean isResponseExpected(Element payload)
+ {
+ Operation op=null;
+
+ if(soapAdapter.isRPC())
+ {
+ QName elementName = new QName(payload.getNamespaceURI(),
payload.getLocalName());
+ op = new WSDLParser(wsdlDefinition).getRPCOperation(
+ this.serviceQName, getPortName(), elementName
+ );
+ }
+ else
+ {
+ QName elementName = new QName(payload.getNamespaceURI(), payload.getLocalName());
+ op = new WSDLParser(wsdlDefinition).getDocLitOperation(
+ this.serviceQName, getPortName(), elementName
+ );
+ }
+
+ if (op == null) {
+ throw new RuntimeException("Failed to locate operation definition for:
"+payload);
+ }
+
+ return op.getOutput() != null;
+ }
+
public static Element getMessagePayload(SOAPEnvelope soapEnvelope)
throws SOAPException
{
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSDLParser.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSDLParser.java 2010-01-13
08:20:46 UTC (rev 457)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSDLParser.java 2010-01-13
14:19:25 UTC (rev 458)
@@ -48,6 +48,54 @@
dfsDepth = 0;
}
+ public Operation getRPCOperation(QName service, String port, QName payloadName)
+ {
+ reset();
+ Operation result = _getRPCOperation(this.wsdlDefinition, service, port,
payloadName);
+ if (result == null)
+ throw new IllegalArgumentException("Unable to find operation for element
"+payloadName);
+ return result;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Operation _getRPCOperation(Definition wsdl, QName serviceName, String portName,
QName payloadName)
+ {
+ if(++dfsDepth>50) // easier then retaining references
+ throw new IllegalStateException("Recursive loop detected. DFS depth reached
limit");
+
+ // namespace / java.util.List of imports
+ Collection<List<Import>> imports = wsdl.getImports().values();
+ for(List<Import> importNS : imports)
+ {
+ for(Import wsdlImport : importNS)
+ {
+ Operation result = _getRPCOperation(wsdlImport.getDefinition(), serviceName,
portName, payloadName);
+ if(result!=null)
+ return result;
+ }
+ }
+
+ // resolve the port & operation
+ Service service = wsdl.getService(serviceName);
+ if (service == null)
+ return null; // service might be defined elsewhere
+
+ Port port = service.getPort(portName);
+ if (port == null)
+ throw new IllegalArgumentException("service "+serviceName+" contains
no such port "+portName);
+
+ Binding binding = port.getBinding();
+ PortType portType = binding.getPortType();
+ List<Operation> operations = portType.getOperations();
+ for(Operation op : operations)
+ {
+ if(op.getName().equals(payloadName.getLocalPart()))
+ return op;
+ }
+
+ return null;
+ }
+
public Operation getDocLitOperation(QName service, String port, QName payloadName)
{
reset();