axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Renat Yanbekov" <ryanbe...@storeperform.com>
Subject Axis nil param issue and fix ideas description...
Date Sun, 29 May 2005 03:36:28 GMT
Hello All,

We've use Axis 1.1 for a long time and have just switched it to
streaming.... 

And encountered a problem:
	1. We have wsdl that describes a service with 4 params. And one
of them can be nil ("<part name="start" type="xs:dateTime"
xs:nillable="true">").

      2. Don't forget that we also have "streaming=on"...

      3. According to the Axis sources
code(org/apache/axis/deployment/wsdd/WSDDService.java):
........................................................................
.................
        468:   service.setHighFidelityRecording(!streaming);
........................................................................
.................

      4. Again according to the source code in all constructors of
DeserializationContextImpl (the only implementation of
org/apache/axis/encoding/DeserializationContextImpl.java):
........................................................................
.................
         160, 184, 222:    if (ctx == null || ctx.isHighFidelity())
         161, 185, 223:         recorder = new SAX2EventRecorder(); 
........................................................................
.................
       So, it looks like if when you use "streaming" you don't have get
a default "recorder". (it's used also in
org/apache/axis/message/MessageElement.class).

      5. According to the code of
org/apache/axis/message/RPCHandler.java: 
........................................................................
.................
         265:   // If the nil attribute is set, just
         266:   // return the base DeserializerImpl.
         267:   // Register the value target to set the value
         268:   // on the RPCParam.  This is necessary for cases like
         269:   //  <method>
         270:   //    <foo>123</foo>
         271:   //    <foo>456</foo>
         272:   //    <foo xsi:nil="true" />
         273:   //  </method>
         274:   // so that a list of 3 items is created.
         275:   // Failure to register the target would result in the
last
         276:   // item not being added to the list
         277:   if (context.isNil(attributes)) {
         278:     Deserializer nilDSer =  new DeserializerImpl();
         279:     nilDSer.registerValueTarget(
         280:       new MethodTarget(currentParam,
         281:                        RPCParam.getValueSetMethod()));
         282:     return (SOAPHandler) nilDSer;
         283:   }
........................................................................
.................
       So, if client of our service passing "nil" param an instance of
org.apache.axis.encoding.DeserializerImpl (default implementation) will
be created.

      6. Also org/apache/axis/encoding/DeserializerImpl.java has the
following
........................................................................
.................
        562:  public void onEndElement(String namespace, String
localName,
        563:                         DeserializationContext context)
        564:      throws SAXException
        565:  {
        566:      // If we only have SAX events, but someone really
wanted a
        567:      // value, try sending them the contents of this
element
        568:      // as a String...
        569:      // ??? Is this the right thing to do here?
        570:  
        571:      if (this.getClass().equals(DeserializerImpl.class) &&
        572:         targets != null &&
        573:         !targets.isEmpty()) {
        574-582:     etc.
        583:         context.getCurElement().publishContents(so);
        584-586:         etc.
        587:      }
        568:  }
........................................................................
.................
        "getCurElement()" method returns instance of
org.apache.axis.message.MessageElement instance witch has the following
code
org/apache/axis/message/MessageElement.java:
........................................................................
.................
         725:  public void publishContents(ContentHandler handler)
throws SAXException
    	   726:  {
         727:	if (recorder == null)
         728:       throw new
SAXException(Messages.getMessage("noRecorder00"));
         729:
         730:	recorder.replay(startContentsIndex, endEventIndex-1,
handler);
    	   731:  }
........................................................................
.................

      7. According to all previous (and this is actually happening in
our case):
          - "streaming=on"
          - "context.isNil(attributes)" is true
          - "recorder" is null
          - "throw new
SAXException(Messages.getMessage("noRecorder00"))" executed (why???).

I have two ideas about how this issue could be fixed:
  1. Remove (5) (lines 265 to 283 in file
org/apache/axis/message/RPCHandler.java) code 
		But, this will introduce (if it wasn't before)
additional responsibility to handler this "nil" case on particular
Deserializer
		implementation (like: all its current children in
"org.apache.axis.encoding.ser" package)... 
	
     Can we do this (looks like all child implementations support this
behavior now)?

  2. Add "isNil" case into "if" statement in
org/apache/axis/encoding/DeserializerImpl.java (see 6 for difference):
................................................................
             571:      if
(this.getClass().equals(DeserializerImpl.class) &&
             572:         targets != null &&
             573:         !targets.isEmpty()
  (new line) 574:         && !isNil) {          // nothing to output if
"nil"
             575-582:     etc.
................................................................
     Is it correct "default" behavior of this class?

Thank you,
Renat Yanbekov
Software Engineer
The StorePerform Technologies Inc. 

Mime
View raw message