[jbossws-commits] JBossWS SVN: r4742 - in stack/native/trunk/src: test/java/org/jboss/test/ws/jaxws/jbws1815 and 1 other directory.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Thu Oct 11 12:56:35 EDT 2007
Author: alessio.soldano at jboss.com
Date: 2007-10-11 12:56:35 -0400 (Thu, 11 Oct 2007)
New Revision: 4742
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1815/JBWS1815TestCase.java
Log:
[JBWS-1815] Solving issue
Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2007-10-11 16:18:51 UTC (rev 4741)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2007-10-11 16:56:35 UTC (rev 4742)
@@ -68,7 +68,7 @@
{
if (soapFault == null)
throw new IllegalArgumentException("SOAPFault cannot be null");
-
+
SOAPFaultException faultEx = new SOAPFaultException(soapFault);
Detail detail = soapFault.getDetail();
@@ -151,10 +151,20 @@
try
{
SOAPMessageImpl faultMessage;
+ Throwable cause = reqEx.getCause();
if (reqEx instanceof SOAPFaultException)
{
faultMessage = toSOAPMessage((SOAPFaultException)reqEx);
}
+ /* JAX-WS 6.4.1: When an implementation catches an exception thrown by a
+ * service endpoint implementation and the cause of that exception is an
+ * instance of the appropriate ProtocolException subclass for the protocol
+ * in use, an implementation MUST reflect the information contained in the
+ * ProtocolException subclass within the generated protocol level fault. */
+ else if (cause != null && cause instanceof SOAPFaultException)
+ {
+ faultMessage = toSOAPMessage((SOAPFaultException)cause);
+ }
else if (reqEx instanceof CommonSOAPFaultException)
{
faultMessage = SOAPFaultHelperJAXRPC.exceptionToFaultMessage(reqEx);
@@ -235,23 +245,8 @@
SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage();
SOAPBody soapBody = soapMessage.getSOAPBody();
- SOAPFault soapFault;
- /* JAX-WS 6.4.1: When an implementation catches an exception thrown by a
- * service endpoint implementation and the cause of that exception is an
- * instance of the appropriate ProtocolException subclass for the protocol
- * in use, an implementation MUST reflect the information contained in the
- * ProtocolException subclass within the generated protocol level fault. */
- Throwable cause = ex.getCause();
- if (cause instanceof SOAPFaultException)
- {
- populateSOAPFault(soapBody, (SOAPFaultException)cause);
- soapFault = soapBody.getFault();
- }
- else
- {
- soapFault = soapBody.addFault(getFallbackFaultCode(), getFallbackFaultString(ex));
- }
+ SOAPFault soapFault = soapBody.addFault(getFallbackFaultCode(), getFallbackFaultString(ex));
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
SerializationContext serContext = msgContext.getSerializationContext();
Modified: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1815/JBWS1815TestCase.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1815/JBWS1815TestCase.java 2007-10-11 16:18:51 UTC (rev 4741)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1815/JBWS1815TestCase.java 2007-10-11 16:56:35 UTC (rev 4742)
@@ -51,8 +51,8 @@
public class JBWS1815TestCase extends JBossWSTest
{
public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-jbws1815/ProviderImpl";
-
- private String msgString =
+
+ private String msgString =
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:my=\"http://www.my-company.it/ws/my-test\">" +
" <soapenv:Header/>" +
" <soapenv:Body>" +
@@ -61,7 +61,7 @@
" </my:performTest>" +
" </soapenv:Body>" +
"</soapenv:Envelope>";
-
+
public static Test suite()
{
return new JBossWSTestSetup(JBWS1815TestCase.class, "jaxws-jbws1815.ejb3");
@@ -73,29 +73,23 @@
Element wsdl = DOMUtils.parse(wsdlURL.openStream());
assertNotNull(wsdl);
}
-
public void testProviderMessage() throws Exception
{
- try {
- SOAPMessage reqMsg = getRequestMessage();
- URL epURL = new URL(TARGET_ENDPOINT_ADDRESS);
- SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
- SOAPMessage resMsg = con.call(reqMsg, epURL);
- SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
- System.out.println("response: " + DOMWriter.printNode(resEnv, false));
- Detail detail = resEnv.getBody().getFault().getDetail();
-// assertNotNull(detail);
- SOAPElement exception = (SOAPElement)detail.getDetailEntries().next();
-// assertNotNull(exception);
-// assertEquals(exception.getNodeName(),"MyWSException");
- SOAPElement message = (SOAPElement)exception.getChildElements().next();
-// assertNotNull(message);
-// assertEquals(message.getNodeName(),"message");
-// assertEquals(message.getValue(),"This is a faked error");
- } catch (Exception e) {
- System.out.println("[FIXME] JBWS-1815: Cannot add fault detail");
- }
+ SOAPMessage reqMsg = getRequestMessage();
+ URL epURL = new URL(TARGET_ENDPOINT_ADDRESS);
+ SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
+ SOAPMessage resMsg = con.call(reqMsg, epURL);
+ SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
+ Detail detail = resEnv.getBody().getFault().getDetail();
+ assertNotNull(detail);
+ SOAPElement exception = (SOAPElement)detail.getDetailEntries().next();
+ assertNotNull(exception);
+ assertEquals(exception.getNodeName(), "MyWSException");
+ SOAPElement message = (SOAPElement)exception.getChildElements().next();
+ assertNotNull(message);
+ assertEquals(message.getNodeName(), "message");
+ assertEquals(message.getValue(), "This is a faked error");
}
private SOAPMessage getRequestMessage() throws SOAPException, IOException
More information about the jbossws-commits
mailing list