[jbossws-commits] JBossWS SVN: r11906 - in stack/native/branches/jbossws-native-3.1.2/modules: core/src/main/java/org/jboss/ws/core/server and 1 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Mar 31 02:45:06 EDT 2010


Author: jim.ma
Date: 2010-03-31 02:45:05 -0400 (Wed, 31 Mar 2010)
New Revision: 11906

Modified:
   stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java
   stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/EndpointInvocation.java
   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/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws871/JBWS871TestCase.java
Log:
[JBPAPP-3984]:Check if the RPC/Lit parameter is null

Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java	2010-03-30 16:25:37 UTC (rev 11905)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java	2010-03-31 06:45:05 UTC (rev 11906)
@@ -38,6 +38,7 @@
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.SOAPException;
 import javax.xml.ws.ProtocolException;
+import javax.xml.ws.WebServiceException;
 import javax.xml.ws.addressing.AddressingProperties;
 import javax.xml.ws.addressing.JAXWSAConstants;
 import javax.xml.ws.handler.MessageContext;
@@ -255,10 +256,8 @@
    {
       if (opName.equals(operationName) == false)
          setOperationName(opName);
-
       OperationMetaData opMetaData = getOperationMetaData();
       boolean oneway = forceOneway || opMetaData.isOneWay();
-
       // Associate a message context with the current thread
       CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
       msgContext.setOperationMetaData(opMetaData);
@@ -284,6 +283,19 @@
          epInv = new EndpointInvocation(opMetaData);
          epInv.initInputParams(inputParams);
 
+         if (opMetaData.getEndpointMetaData().getType() != Type.JAXRPC && opMetaData.isRPCLiteral()
+               && epInv.getRequestParamNames() != null)
+         {
+            for (QName qname : epInv.getRequestParamNames())
+            {
+               Object obj = epInv.getRequestParamValue(qname);
+               if (obj == null)
+               {
+                  throw new WebServiceException("The RPC/Literal Operation [" + opName + "] Parameter can not be null");
+               }
+            }
+         }
+         
          // Set the required outbound properties
          setOutboundContextProperties();
 
@@ -388,6 +400,22 @@
                binding.unbindResponseMessage(opMetaData, resMessage, epInv, unboundHeaders);
             }
 
+            //JBWS-2969: check if the rpc/lit input paramter is null
+            if (opMetaData.getEndpointMetaData().getType() != Type.JAXRPC && opMetaData.isRPCLiteral())
+            {
+               if (epInv.getResponseParamNames() != null)
+               {
+                  for (QName qname : epInv.getResponseParamNames())
+                  {
+                     Object obj = epInv.getResponsePayLoadParamValue(qname);
+                     if (obj == null)
+                     {
+                        throw new WebServiceException("The RPC/Literal Operation [" + opName
+                              + "] response parameters can not be null");
+                     }
+                  }
+               }
+            } 
             retObj = syncOutputParams(inputParams, epInv);
          }
 

Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/EndpointInvocation.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/EndpointInvocation.java	2010-03-30 16:25:37 UTC (rev 11905)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/EndpointInvocation.java	2010-03-31 06:45:05 UTC (rev 11906)
@@ -172,6 +172,16 @@
       }
       return paramValue;
    }
+   
+   public Object getResponsePayLoadParamValue(QName xmlName) throws SOAPException
+   {
+      if (log.isDebugEnabled())
+         log.debug("getResponseParamValue: " + xmlName);
+      Object paramValue = resPayload.get(xmlName);
+      ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName);
+      paramValue = transformPayloadValue(paramMetaData, paramValue);
+      return paramValue;
+   }
 
    public void setReturnValue(Object value)
    {

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-30 16:25:37 UTC (rev 11905)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java	2010-03-31 06:45:05 UTC (rev 11906)
@@ -35,6 +35,7 @@
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPHeader;
 import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.MessageContext;
 import javax.xml.ws.http.HTTPBinding;
 
@@ -75,6 +76,7 @@
 import org.jboss.wsf.spi.invocation.InvocationType;
 import org.jboss.wsf.spi.invocation.WebServiceContextFactory;
 import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
+import org.jboss.wsf.spi.serviceref.ServiceRefHandler.Type;
 
 /** An implementation handles invocations on the endpoint
  *
@@ -211,7 +213,21 @@
                   reqMessage = msgContext.getMessageAbstraction();
                   sepInv = binding.unbindRequestMessage(opMetaData, reqMessage);
                }
-
+               //JBWS-2969:check if the rpc/lit input paramter is null
+               if (opMetaData.getEndpointMetaData().getType() != EndpointMetaData.Type.JAXRPC
+                     && opMetaData.isRPCLiteral() && sepInv.getRequestParamNames() != null)
+               {
+                  for (QName qname : sepInv.getRequestParamNames())
+                  {
+                     Object obj = sepInv.getRequestParamValue(qname);
+                     if (obj == null)
+                     {
+                        throw new WebServiceException("The RPC/Literal Operation [" + opMetaData.getQName()
+                              + "] parameters can not be null");
+                     }
+                  }
+               }
+               
                // Invoke an instance of the SEI implementation bean 
                Invocation inv = setupInvocation(endpoint, sepInv, invContext);
                InvocationHandler invHandler = endpoint.getInvocationHandler();
@@ -219,6 +235,7 @@
                try
                {
                   invHandler.invoke(endpoint, inv);
+                  
                }
                catch (InvocationTargetException th)
                {

Modified: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws871/JBWS871TestCase.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws871/JBWS871TestCase.java	2010-03-30 16:25:37 UTC (rev 11905)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws871/JBWS871TestCase.java	2010-03-31 06:45:05 UTC (rev 11906)
@@ -151,11 +151,12 @@
       assertEquals(intArr, jbel.getValue());
    }
 
-   public void testEchoNullArray() throws Exception
+   //Comment out this test , it is BP-2211 violation, see JBWS-2969
+   /*public void testEchoNullArray() throws Exception
    {
       Integer[] outArr = endpoint.intArr("null", null);
       assertNull(outArr);
-   }
+   }*/
 
    public void testEchoEmptyArray() throws Exception
    {



More information about the jbossws-commits mailing list