axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/message SOAPFaultReasonBuilder.java SOAPFaultBuilder.java SOAPFault.java
Date Sat, 01 Feb 2003 19:16:52 GMT
gdaniels    2003/02/01 11:16:51

  Modified:    java/test/soap12 TestFault.java
               java/src/org/apache/axis/message SOAPFaultReasonBuilder.java
                        SOAPFaultBuilder.java SOAPFault.java
  Log:
  Write out <Reason><Text></Text></Reason> correctly, and make sure
  to propagate the value of the first text element into the faultString field
  of the AxisFault when deserializing.  Needs a little more cleanup (incl.
  xml:lang) but works now.
  
  Clean up TestFault a bit.
  
  Revision  Changes    Path
  1.2       +11 -9     xml-axis/java/test/soap12/TestFault.java
  
  Index: TestFault.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/soap12/TestFault.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestFault.java	20 Dec 2002 17:28:21 -0000	1.1
  +++ TestFault.java	1 Feb 2003 19:16:51 -0000	1.2
  @@ -48,11 +48,14 @@
           msgContext.setSOAPConstants(SOAPConstants.SOAP12_CONSTANTS);
           SOAPEnvelope msg = new SOAPEnvelope(SOAPConstants.SOAP12_CONSTANTS);
   
  -        SOAPFault fault = new SOAPFault(new AxisFault(FAULTCODE, FAULTSUBCODE ,FAULTREASON,
FAULTROLE, FAULTNODE, null));
  +        SOAPFault fault = new SOAPFault(new AxisFault(FAULTCODE, FAULTSUBCODE,
  +                                                      FAULTREASON, FAULTROLE,
  +                                                      FAULTNODE, null));
   
           msg.addBodyElement(fault);
           Writer stringWriter = new StringWriter();
  -        SerializationContext context = new SerializationContextImpl(stringWriter, msgContext);
  +        SerializationContext context = 
  +                new SerializationContextImpl(stringWriter, msgContext);
           context.setDoMultiRefs(false);
           msg.output(context);
           String msgString = stringWriter.toString();
  @@ -62,7 +65,7 @@
           Message message = new Message(msgString);
           message.setMessageContext(new MessageContext(server));
   
  -        SOAPEnvelope envelope = (SOAPEnvelope) message.getSOAPEnvelope();
  +        SOAPEnvelope envelope = message.getSOAPEnvelope();
           assertNotNull("envelope should not be null", envelope);
   
           SOAPBodyElement respBody = envelope.getFirstBody();
  @@ -72,14 +75,13 @@
   
           assertNotNull("Fault should not be null", aFault);
   
  -        assertTrue(aFault.getFaultCode().equals(FAULTCODE));
  -        assertTrue(aFault.getFaultReason().equals(FAULTREASON));
  -        assertTrue(aFault.getFaultRole().equals(FAULTROLE));
  -        assertTrue(aFault.getFaultNode().equals(FAULTNODE));
  +        assertEquals(FAULTCODE, aFault.getFaultCode());
  +        assertEquals(FAULTREASON, aFault.getFaultReason());
  +        assertEquals(FAULTROLE, aFault.getFaultRole());
  +        assertEquals(FAULTNODE, aFault.getFaultNode());
           QName q[] = aFault.getFaultSubCodes();
           for (int i = 0; i < q.length; i++)
  -            assertTrue(q[i].equals(FAULTSUBCODE[i]));
  -
  +            assertEquals(FAULTSUBCODE[i], q[i]);
       }
   
   }
  
  
  
  1.2       +5 -2      xml-axis/java/src/org/apache/axis/message/SOAPFaultReasonBuilder.java
  
  Index: SOAPFaultReasonBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPFaultReasonBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SOAPFaultReasonBuilder.java	31 Jan 2003 23:04:13 -0000	1.1
  +++ SOAPFaultReasonBuilder.java	1 Feb 2003 19:16:51 -0000	1.2
  @@ -74,8 +74,10 @@
   {
       /** Storage for the actual text */
       private ArrayList text = new ArrayList();
  +    private SOAPFaultBuilder faultBuilder;
       
  -    public SOAPFaultReasonBuilder() {
  +    public SOAPFaultReasonBuilder(SOAPFaultBuilder faultBuilder) {
  +        this.faultBuilder = faultBuilder;
       }
   
       public SOAPHandler onStartChild(String namespace,
  @@ -90,7 +92,8 @@
               Deserializer currentDeser = null;
               currentDeser = context.getDeserializerForType(Constants.XSD_STRING);
               if (currentDeser != null) {
  -                currentDeser.registerValueTarget(new CallbackTarget(this, null));
  +                currentDeser.registerValueTarget(
  +                        new CallbackTarget(faultBuilder, thisQName));
               }
               return (SOAPHandler)currentDeser;
           } else {
  
  
  
  1.29      +4 -2      xml-axis/java/src/org/apache/axis/message/SOAPFaultBuilder.java
  
  Index: SOAPFaultBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPFaultBuilder.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- SOAPFaultBuilder.java	1 Feb 2003 17:05:40 -0000	1.28
  +++ SOAPFaultBuilder.java	1 Feb 2003 19:16:51 -0000	1.29
  @@ -110,7 +110,7 @@
       }
   
       static {
  -        fields_soap12.put(Constants.ELEM_FAULT_REASON_SOAP12, Constants.XSD_STRING);
  +        fields_soap12.put(Constants.ELEM_FAULT_REASON_SOAP12, null);
           fields_soap12.put(Constants.ELEM_FAULT_ROLE_SOAP12, Constants.XSD_STRING);
           fields_soap12.put(Constants.ELEM_FAULT_NODE_SOAP12, Constants.XSD_STRING);
           fields_soap12.put(Constants.ELEM_FAULT_DETAIL_SOAP12, null);
  @@ -278,6 +278,8 @@
                   QName thisQName = new QName(namespace, name);
                   if (thisQName.equals(Constants.QNAME_FAULTCODE_SOAP12))
                       return (code = new SOAPFaultCodeBuilder());
  +                else if (thisQName.equals(Constants.QNAME_FAULTREASON_SOAP12))
  +                    return new SOAPFaultReasonBuilder(this);
                   else if (thisQName.equals(Constants.QNAME_FAULTDETAIL_SOAP12))
                       return new SOAPFaultDetailsBuilder(this);
   
  @@ -333,7 +335,7 @@
           if (((QName)hint).getNamespaceURI().equals(Constants.URI_SOAP12_ENV)) {
               if (local.equals(Constants.ELEM_FAULT_ROLE_SOAP12)) {
                   faultActor = (String) value;
  -            } else if (local.equals(Constants.ELEM_FAULT_REASON_SOAP12)) {
  +            } else if (local.equals(Constants.ELEM_TEXT_SOAP12)) {
                   faultString = (String) value;
               } else if (local.equals(Constants.ELEM_FAULT_NODE_SOAP12)) {
                   faultNode = (String) value;
  
  
  
  1.13      +7 -2      xml-axis/java/src/org/apache/axis/message/SOAPFault.java
  
  Index: SOAPFault.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPFault.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SOAPFault.java	17 Dec 2002 20:10:54 -0000	1.12
  +++ SOAPFault.java	1 Feb 2003 19:16:51 -0000	1.13
  @@ -144,12 +144,17 @@
               }
               
               if (axisFault.getFaultString() != null) {
  -                if (soapConstants == SOAPConstants.SOAP12_CONSTANTS)
  +                if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) {
                       context.startElement(Constants.QNAME_FAULTREASON_SOAP12, null);
  -                else
  +                    // TODO: put an xml:lang attribute on the <Text> element?
  +                    context.startElement(Constants.QNAME_TEXT_SOAP12, null);
  +                } else
                       context.startElement(Constants.QNAME_FAULTSTRING, null);
                   context.writeSafeString(axisFault.getFaultString());
                   context.endElement();
  +                if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) {
  +                    context.endElement();
  +                }
               }
               
               if (axisFault.getFaultActor() != null) {
  
  
  

Mime
View raw message