Author: jim.ma
Date: 2010-03-29 02:01:11 -0400 (Mon, 29 Mar 2010)
New Revision: 11880
Added:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbers.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersException.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersFault1.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersFault1Response.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersImpl.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/JBWS2977TestCase.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2977/
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2977/WEB-INF/
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2977/WEB-INF/jboss-web.xml
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2977/WEB-INF/web.xml
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/addressing/metadata/AddressingOpMetaExt.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
Log:
[JBPAPP-4026]:repsect the fault value in @Action
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2010-03-28
13:51:26 UTC (rev 11879)
+++
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2010-03-29
06:01:11 UTC (rev 11880)
@@ -280,6 +280,7 @@
CommonBinding binding = bindingProvider.getCommonBinding();
try
{
+ MessageContextAssociation.peekMessageContext().put("Exception",
ex);
binding.bindFaultMessage(ex);
// call the fault handler chain
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java 2010-03-28
13:51:26 UTC (rev 11879)
+++
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java 2010-03-29
06:01:11 UTC (rev 11880)
@@ -32,6 +32,7 @@
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.FaultAction;
import javax.xml.ws.addressing.AddressingBuilder;
import javax.xml.ws.addressing.JAXWSAConstants;
import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
@@ -171,7 +172,7 @@
AddressingOpMetaExt addrExt =
(AddressingOpMetaExt)opMetaData.getExtension(ADDR_CONSTANTS.getNamespaceURI());
if (addrExt != null)
{
- outProps.setAction(ADDR_BUILDER.newURI(addrExt.getOutboundAction()));
+ outProps.setAction(ADDR_BUILDER.newURI(addrExt.getOutboundAction()));
}
else
{
@@ -179,9 +180,25 @@
}
}
- else if (isFault)
+ else if (isFault)
{
- outProps.setAction(ADDR_BUILDER.newURI(ADDR_CONSTANTS.getDefaultFaultAction()));
+ AddressingOpMetaExt addrExt =
(AddressingOpMetaExt)opMetaData.getExtension(ADDR_CONSTANTS.getNamespaceURI());
+ if (addrExt != null && msgContext.get("Exception") !=
null
+ && addrExt.getFaultActions() != null &&
addrExt.getFaultActions().length > 0)
+ {
+ Exception ex = (Exception)msgContext.get("Exception");
+ for(FaultAction faultAction : addrExt.getFaultActions())
+ {
+ if
(faultAction.className().getName().equals(ex.getClass().getName()))
+ {
+ outProps.setAction(ADDR_BUILDER.newURI(faultAction.value()));
+ break;
+ }
+ }
+ }
+ if (outProps.getAction() == null) {
+
outProps.setAction(ADDR_BUILDER.newURI(ADDR_CONSTANTS.getDefaultFaultAction()));
+ }
}
}
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/addressing/metadata/AddressingOpMetaExt.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/addressing/metadata/AddressingOpMetaExt.java 2010-03-28
13:51:26 UTC (rev 11879)
+++
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/addressing/metadata/AddressingOpMetaExt.java 2010-03-29
06:01:11 UTC (rev 11880)
@@ -21,6 +21,8 @@
*/
package org.jboss.ws.extensions.addressing.metadata;
+import javax.xml.ws.FaultAction;
+
import org.jboss.ws.metadata.umdm.MetaDataExtension;
/**
@@ -35,6 +37,7 @@
{
private String inboundAction;
private String outboundAction;
+ private FaultAction[] faultActions;
public AddressingOpMetaExt(String extensionNameSpace)
{
@@ -60,5 +63,13 @@
{
this.outboundAction = outboundAction;
}
+
+ public void setFaultActions(FaultAction[] faultActions) {
+ this.faultActions = faultActions;
+ }
+
+ public FaultAction[] getFaultActions() {
+ return this.faultActions;
+ }
}
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2010-03-28
13:51:26 UTC (rev 11879)
+++
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2010-03-29
06:01:11 UTC (rev 11880)
@@ -545,6 +545,7 @@
{
addrExt.setInboundAction(anAction.input());
addrExt.setOutboundAction(anAction.output());
+ addrExt.setFaultActions(anAction.fault());
}
else
// default action values
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml 2010-03-28
13:51:26 UTC (rev 11879)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml 2010-03-29
06:01:11 UTC (rev 11880)
@@ -624,7 +624,19 @@
<webinf
dir="${tests.output.dir}/test-resources/jaxws/jbws2949/WEB-INF">
<include name="jboss-web.xml"/>
</webinf>
- </war>
+ </war>
+
+ <!-- jaxws-jbws2977 -->
+ <war warfile="${tests.output.dir}/test-libs/jaxws-jbws2977.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws2977/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/jbws2977/AddNumbersImpl.class"/>
+ <include
name="org/jboss/test/ws/jaxws/jbws2977/AddNumbersException.class"/>
+ </classes>
+ <webinf
dir="${tests.output.dir}/test-resources/jaxws/jbws2977/WEB-INF">
+ <include name="jboss-web.xml"/>
+ </webinf>
+ </war>
+
<!-- jaxws-webserviceref -->
<war warfile="${tests.output.dir}/test-libs/jaxws-webserviceref.war"
webxml="${tests.output.dir}/test-resources/jaxws/webserviceref/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
Added:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbers.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbers.java
(rev 0)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbers.java 2010-03-29
06:01:11 UTC (rev 11880)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.test.ws.jaxws.jbws2977;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.WebResult;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+@WebService(name = "AddNumbers", targetNamespace =
"http://ws.jboss.org")
+public interface AddNumbers {
+
+
+ /**
+ *
+ * @param arg1
+ * @param arg0
+ * @return
+ * returns int
+ * @throws AddNumbersException_Exception
+ */
+ @WebMethod
+ @WebResult(targetNamespace = "")
+ @RequestWrapper(localName = "addNumbersFault1", targetNamespace =
"http://ws.jboss.org", className =
"org.jboss.test.ws.jaxws.jbws2977.AddNumbersFault1")
+ @ResponseWrapper(localName = "addNumbersFault1Response", targetNamespace =
"http://ws.jboss.org", className =
"org.jboss.test.ws.jaxws.jbws2977.AddNumbersFault1Response")
+ public int addNumbersFault1(
+ @WebParam(name = "arg0", targetNamespace = "")
+ int arg0,
+ @WebParam(name = "arg1", targetNamespace = "")
+ int arg1)
+ throws AddNumbersException;
+}
Added:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersException.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersException.java
(rev 0)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersException.java 2010-03-29
06:01:11 UTC (rev 11880)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.test.ws.jaxws.jbws2977;
+
+/**
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class AddNumbersException extends Exception
+{
+ String detail;
+
+ public AddNumbersException(String message, String detail)
+ {
+ super(message);
+ this.detail = detail;
+ }
+
+ public String getDetail()
+ {
+ return detail;
+ }
+}
Property changes on:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersException.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersFault1.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersFault1.java
(rev 0)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersFault1.java 2010-03-29
06:01:11 UTC (rev 11880)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.test.ws.jaxws.jbws2977;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for addNumbersFault1 complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within
this class.
+ *
+ * <pre>
+ * <complexType name="addNumbersFault1">
+ * <complexContent>
+ * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="arg0"
type="{http://www.w3.org/2001/XMLSchema}int"/>
+ * <element name="arg1"
type="{http://www.w3.org/2001/XMLSchema}int"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "addNumbersFault1", propOrder = {
+ "arg0",
+ "arg1"
+})
+public class AddNumbersFault1 {
+
+ protected int arg0;
+ protected int arg1;
+
+ /**
+ * Gets the value of the arg0 property.
+ *
+ */
+ public int getArg0() {
+ return arg0;
+ }
+
+ /**
+ * Sets the value of the arg0 property.
+ *
+ */
+ public void setArg0(int value) {
+ this.arg0 = value;
+ }
+
+ /**
+ * Gets the value of the arg1 property.
+ *
+ */
+ public int getArg1() {
+ return arg1;
+ }
+
+ /**
+ * Sets the value of the arg1 property.
+ *
+ */
+ public void setArg1(int value) {
+ this.arg1 = value;
+ }
+
+}
Added:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersFault1Response.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersFault1Response.java
(rev 0)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersFault1Response.java 2010-03-29
06:01:11 UTC (rev 11880)
@@ -0,0 +1,75 @@
+
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.test.ws.jaxws.jbws2977;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for addNumbersFault1Response complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within
this class.
+ *
+ * <pre>
+ * <complexType name="addNumbersFault1Response">
+ * <complexContent>
+ * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="return"
type="{http://www.w3.org/2001/XMLSchema}int"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "addNumbersFault1Response", propOrder = {
+ "_return"
+})
+public class AddNumbersFault1Response {
+
+ @XmlElement(name = "return")
+ protected int _return;
+
+ /**
+ * Gets the value of the return property.
+ *
+ */
+ public int getReturn() {
+ return _return;
+ }
+
+ /**
+ * Sets the value of the return property.
+ *
+ */
+ public void setReturn(int value) {
+ this._return = value;
+ }
+
+}
Added:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersImpl.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersImpl.java
(rev 0)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/AddNumbersImpl.java 2010-03-29
06:01:11 UTC (rev 11880)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.test.ws.jaxws.jbws2977;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.Action;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.FaultAction;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.soap.Addressing;
+import javax.xml.ws.soap.SOAPBinding;
+
+/**
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+@WebService(name = "AddNumbers", portName = "AddNumbersPort",
targetNamespace = "http://ws.jboss.org", serviceName = "AddNumbers")
+@BindingType(value = SOAPBinding.SOAP11HTTP_BINDING)
+@Addressing(enabled = true, required = false)
+public class AddNumbersImpl
+{
+ @Resource
+ WebServiceContext wsc;
+
+ @Action(input = "inputAction", output = "outputAction", fault =
+ {@FaultAction(className = AddNumbersException.class, value =
"http://faultAction")})
+ public int addNumbersFault1(int number1, int number2) throws AddNumbersException
+ {
+ throw new AddNumbersException("AddNumbersTestException",
"testFault");
+ }
+}
Added:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/JBWS2977TestCase.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/JBWS2977TestCase.java
(rev 0)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2977/JBWS2977TestCase.java 2010-03-29
06:01:11 UTC (rev 11880)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.test.ws.jaxws.jbws2977;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import junit.framework.Test;
+
+import org.jboss.ws.WSException;
+import org.jboss.wsf.common.handler.GenericSOAPHandler;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * A JBWS2977TestCase.
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class JBWS2977TestCase extends JBossWSTest
+{
+
+ public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() +
":8080/jaxws-jbws2977";
+
+ public String actionURL = null;
+
+ private static AddNumbers port;
+
+ public static Test suite() throws Exception
+ {
+ return new JBossWSTestSetup(JBWS2977TestCase.class,
"jaxws-jbws2977.war");
+ }
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+ QName serviceName = new QName("http://ws.jboss.org",
"AddNumbers");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ port = service.getPort(AddNumbers.class);
+ }
+
+ public void testCall()
+ {
+ List<Handler> handlers = new ArrayList<Handler>();
+ handlers.add(new ClientSOAPHandler());
+ ((BindingProvider) port).getBinding().setHandlerChain(handlers);
+ try
+ {
+ port.addNumbersFault1(1, 0);
+ }
+ catch (AddNumbersException e)
+ {
+ // do nothing
+ }
+
+ assertEquals("http://faultAction", actionURL);
+ }
+
+ class ClientSOAPHandler extends GenericSOAPHandler<LogicalMessageContext>
+ {
+ @Override
+ public boolean handleFault(MessageContext msgContext)
+ {
+ try
+ {
+ SOAPMessageContext smc = (SOAPMessageContext) msgContext;
+ SOAPMessage message = smc.getMessage();
+ Iterator iterator = message.getSOAPHeader().getChildElements(
+ new
QName("http://www.w3.org/2005/08/addressing",
"Action"));
+ if (iterator.hasNext())
+ {
+ SOAPElement element = (SOAPElement) iterator.next();
+ actionURL = element.getValue();
+ }
+ }
+ catch (SOAPException e)
+ {
+ throw new WSException("Error in Handler", e);
+ }
+ return true;
+ }
+ }
+
+}
\ No newline at end of file
Added:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2977/WEB-INF/jboss-web.xml
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2977/WEB-INF/jboss-web.xml
(rev 0)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2977/WEB-INF/jboss-web.xml 2010-03-29
06:01:11 UTC (rev 11880)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">
+
+<jboss-web>
+ <context-root>/jaxws-jbws2977</context-root>
+</jboss-web>
\ No newline at end of file
Added:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2977/WEB-INF/web.xml
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2977/WEB-INF/web.xml
(rev 0)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2977/WEB-INF/web.xml 2010-03-29
06:01:11 UTC (rev 11880)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <servlet>
+ <servlet-name>Endpoint</servlet-name>
+
<servlet-class>org.jboss.test.ws.jaxws.jbws2977.AddNumbersImpl</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Endpoint</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
\ No newline at end of file