You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2003/06/27 16:54:52 UTC

cvs commit: xml-axis/java/test/saaj TestPrefixes.java

dims        2003/06/27 07:54:52

  Modified:    java/src/org/apache/axis/message MessageElement.java
               java/test/saaj TestPrefixes.java
  Log:
  Fix for Bug 21012 - Improper Prefix Handling.(SAAJ )
  from john_smith_2002@msn.com (JohnSmith)
  
  Revision  Changes    Path
  1.155     +1 -1      xml-axis/java/src/org/apache/axis/message/MessageElement.java
  
  Index: MessageElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/MessageElement.java,v
  retrieving revision 1.154
  retrieving revision 1.155
  diff -u -r1.154 -r1.155
  --- MessageElement.java	18 Jun 2003 23:01:50 -0000	1.154
  +++ MessageElement.java	27 Jun 2003 14:54:51 -0000	1.155
  @@ -1020,7 +1020,7 @@
                   if (idx > 0) {
                       prefix = q.substring(0, idx);
                   } else {
  -                    prefix= q;
  +                    prefix= "";
                   }
               }
   
  
  
  
  1.2       +22 -0     xml-axis/java/test/saaj/TestPrefixes.java
  
  Index: TestPrefixes.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/saaj/TestPrefixes.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestPrefixes.java	24 Mar 2003 13:50:15 -0000	1.1
  +++ TestPrefixes.java	27 Jun 2003 14:54:52 -0000	1.2
  @@ -6,7 +6,11 @@
   import javax.xml.soap.SOAPEnvelope;
   import javax.xml.soap.SOAPMessage;
   import javax.xml.soap.SOAPPart;
  +import javax.xml.soap.MimeHeaders;
  +import javax.xml.soap.Name;
   import java.io.ByteArrayOutputStream;
  +import java.io.ByteArrayInputStream;
  +import java.util.Iterator;
   
   /**
    * Test case for Prefixes
  @@ -38,5 +42,23 @@
           assertTrue(xml.indexOf("prefix2") != -1);
           assertTrue(xml.indexOf("http://www.sun.com") != -1);
           assertTrue(xml.indexOf("http://www.apache.org") != -1);
  +    }
  +    
  +    public void testAttribute() throws Exception {
  +        String soappacket = "<SOAP-ENV:Envelope xmlns:SOAP-ENV =\"http://schemas.xmlsoap.org/soap/envelope/\"" + 
  +                            "       xmlns:xsi =\"http://www.w3.org/1999/XMLSchema-instance\"" +
  +                            "       xmlns:xsd =\"http://www.w3.org/1999/XMLSchema\">" + 
  +                            "   <SOAP-ENV:Body> " +
  +                            "       <helloworld name=\"tester\" />" + 
  +                            "   </SOAP-ENV:Body>" +
  +                            "</SOAP-ENV:Envelope>";
  +        SOAPMessage msg = MessageFactory.newInstance().createMessage(new MimeHeaders(), new ByteArrayInputStream(soappacket.getBytes()));
  +        SOAPBody body = msg.getSOAPPart().getEnvelope().getBody();
  +
  +        SOAPElement ele = (SOAPElement) body.getChildElements().next();
  +        Iterator attit = ele.getAllAttributes();
  +
  +        Name n = (Name) attit.next();
  +        assertEquals("Test fail prefix problem",n.getQualifiedName(),"name");
       }
   }