[jboss-svn-commits] JBossWS SVN: r1171 - in branches/tdiesler/jbossws-1.0/src/test: ant java/org/jboss/test/ws/jaxrpc/jbws1186 resources/jaxrpc/jbws1186/WEB-INF

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Oct 9 06:56:36 EDT 2006


Author: thomas.diesler at jboss.com
Date: 2006-10-09 06:56:27 -0400 (Mon, 09 Oct 2006)
New Revision: 1171

Added:
   branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/ServerHandler.java
Modified:
   branches/tdiesler/jbossws-1.0/src/test/ant/build-jars-jaxrpc.xml
   branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/JBWS1186TestCase.java
   branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/TestEndpointImpl.java
   branches/tdiesler/jbossws-1.0/src/test/resources/jaxrpc/jbws1186/WEB-INF/web.xml
   branches/tdiesler/jbossws-1.0/src/test/resources/jaxrpc/jbws1186/WEB-INF/webservices.xml
Log:
[JBWS-1186] The prefix "xsi" for attribute "xsi:nil" is not bound.
Expand test case to test response message

Modified: branches/tdiesler/jbossws-1.0/src/test/ant/build-jars-jaxrpc.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/ant/build-jars-jaxrpc.xml	2006-10-09 01:18:22 UTC (rev 1170)
+++ branches/tdiesler/jbossws-1.0/src/test/ant/build-jars-jaxrpc.xml	2006-10-09 10:56:27 UTC (rev 1171)
@@ -721,6 +721,7 @@
       <classes dir="${build.test.dir}/classes">
         <include name="org/jboss/test/ws/jaxrpc/jbws1186/TestEndpointImpl.class"/>
         <include name="org/jboss/test/ws/jaxrpc/jbws1186/TestEndpoint.class"/>
+        <include name="org/jboss/test/ws/jaxrpc/jbws1186/ServerHandler.class"/>
         <include name="org/jboss/test/ws/jaxrpc/jbws1186/UserType.class"/>
       </classes>
       <webinf dir="${build.test.dir}/resources/jaxrpc/jbws1186/WEB-INF">

Modified: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/JBWS1186TestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/JBWS1186TestCase.java	2006-10-09 01:18:22 UTC (rev 1170)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/JBWS1186TestCase.java	2006-10-09 10:56:27 UTC (rev 1171)
@@ -96,10 +96,10 @@
    {
       UserType userType = new UserType();
       UserType retObj = port.echo(null, userType);
-      assertEquals("null null", retObj.getName());
+      assertNull("null expected", retObj);
    }
 
-   public void testAccessMessage() throws Exception
+   public void testMessageAccess() throws Exception
    {
       MessageFactory factory = MessageFactory.newInstance();
       
@@ -121,7 +121,6 @@
       SOAPMessage resMessage = con.call(reqMessage, "http://" + getServerHost() + ":8080/jaxrpc-jbws1186");
       SOAPElement soapElement = (SOAPElement)resMessage.getSOAPBody().getChildElements().next();
       soapElement = (SOAPElement)soapElement.getChildElements().next();
-      soapElement = (SOAPElement)soapElement.getChildElements().next();
-      assertEquals("null null", soapElement.getValue());
+      assertEquals("1", soapElement.getAttribute("xsi:nil"));
    }
 }

Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/ServerHandler.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/ServerHandler.java	2006-10-09 01:18:22 UTC (rev 1170)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/ServerHandler.java	2006-10-09 10:56:27 UTC (rev 1171)
@@ -0,0 +1,95 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.jaxrpc.jbws1186;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.GenericHandler;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.soap.SOAPContentElement;
+
+public class ServerHandler extends GenericHandler
+{
+   private Logger log = Logger.getLogger(ServerHandler.class);
+   
+   public QName[] getHeaders()
+   {
+      return new QName[]{};
+   }
+
+   public boolean handleRequest(MessageContext msgContext)
+   {
+      try
+      {
+         SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+         SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
+         String nsURI = soapEnvelope.getAttribute("xmlns:xsi");
+         log.info("xmlns:xsi: " + nsURI);
+      }
+      catch (SOAPException ex)
+      {
+         throw new RuntimeException(ex);
+      }      
+      return true;
+   }
+
+   public boolean handleResponse(MessageContext msgContext)
+   {
+      try
+      {
+         SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+         SOAPElement soapElement = (SOAPElement)soapMessage.getSOAPBody().getChildElements().next();
+         
+         // Use propriatary API to test the response value
+         SOAPContentElement resElement = (SOAPContentElement)soapElement.getChildElements().next();
+         if (resElement.getObjectValue() == null)
+         {
+            MessageFactory msgFactory = MessageFactory.newInstance();
+            SOAPFactory soapFactory = SOAPFactory.newInstance();
+            
+            soapMessage = msgFactory.createMessage();
+            SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
+            soapEnvelope.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
+            Name resName = soapFactory.createName("echoResponse", "ns1", "http://org.jboss.test.ws/jbws1186");
+            SOAPBodyElement bodyElement = soapMessage.getSOAPBody().addBodyElement(resName);
+            bodyElement.addChildElement("result").setAttribute("xsi:nil", "1");
+            ((SOAPMessageContext)msgContext).setMessage(soapMessage);
+         }
+      }
+      catch (Exception ex)
+      {
+         throw new RuntimeException(ex);
+      }      
+      return true;
+   }
+}


Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/ServerHandler.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/TestEndpointImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/TestEndpointImpl.java	2006-10-09 01:18:22 UTC (rev 1170)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/TestEndpointImpl.java	2006-10-09 10:56:27 UTC (rev 1171)
@@ -32,7 +32,12 @@
    public UserType echo(String message, UserType ut) throws RemoteException
    {
       log.info("echo: " + message);
-      ut.setName(message + " " + ut.getName());
+      
+      if (message != null || ut.getName() != null)
+         ut.setName(message + " " + ut.getName());
+      else
+         ut = null;
+      
       return ut;
    }
 

Modified: branches/tdiesler/jbossws-1.0/src/test/resources/jaxrpc/jbws1186/WEB-INF/web.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/resources/jaxrpc/jbws1186/WEB-INF/web.xml	2006-10-09 01:18:22 UTC (rev 1170)
+++ branches/tdiesler/jbossws-1.0/src/test/resources/jaxrpc/jbws1186/WEB-INF/web.xml	2006-10-09 10:56:27 UTC (rev 1171)
@@ -4,11 +4,12 @@
   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"
   version="2.4">
-
+  
   <servlet>
     <servlet-name>TestEndpoint</servlet-name>
     <servlet-class>org.jboss.test.ws.jaxrpc.jbws1186.TestEndpointImpl</servlet-class>
   </servlet>
+  
   <servlet-mapping>
     <servlet-name>TestEndpoint</servlet-name>
     <url-pattern>/*</url-pattern>

Modified: branches/tdiesler/jbossws-1.0/src/test/resources/jaxrpc/jbws1186/WEB-INF/webservices.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/resources/jaxrpc/jbws1186/WEB-INF/webservices.xml	2006-10-09 01:18:22 UTC (rev 1170)
+++ branches/tdiesler/jbossws-1.0/src/test/resources/jaxrpc/jbws1186/WEB-INF/webservices.xml	2006-10-09 10:56:27 UTC (rev 1171)
@@ -10,6 +10,10 @@
    <service-impl-bean>
     <servlet-link>TestEndpoint</servlet-link>
    </service-impl-bean>
+    <handler>
+      <handler-name>ServerHandler</handler-name>
+      <handler-class>org.jboss.test.ws.jaxrpc.jbws1186.ServerHandler</handler-class>
+    </handler>
   </port-component>
  </webservice-description>
 </webservices>
\ No newline at end of file




More information about the jboss-svn-commits mailing list