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 R J Scheuerle Jr <sc...@us.ibm.com> on 2002/09/20 20:01:02 UTC

Re: Bugs #12753 and #12636 - proposed solution

The code is necessary to support overloaded methods.  Are you sure your
wsdd.service is correct ? Are you sure your implementation methods is
correct.  I would be concerned about why you have a
com.touchcorp.soap.ihire.THireInfo and class java.lang.String collision.


Rich Scheuerle
IBM WebSphere & Axis Web Services Development
512-838-5115  (IBM TL 678-5115)


                                                                                                                                 
                      nbrennan@touchcor                                                                                          
                      p.com                    To:       axis-dev@xml.apache.org                                                 
                                               cc:       dhakme@touchcorp.com                                                    
                      09/19/2002 11:16         Subject:  Bugs #12753 and #12636 - proposed solution                              
                      PM                                                                                                         
                      Please respond to                                                                                          
                      axis-dev                                                                                                   
                                                                                                                                 
                                                                                                                                 



Hi Developer-guys,

I have had the exact same problem as both of these bugs, but with
complex types.

My error trace looks like this:

org.xml.sax.SAXException: Bad types (class
com.touchcorp.soap.ihire.THireInfo -> class java.lang.String)
        at
org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:273)
        at
org.apache.axis.encoding.DeserializationContextImpl.startElement(Deseria
lizationContextImpl.java:883)
        at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:
158)
        at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.j
ava:681)
        at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:244)
        at
org.apache.axis.message.RPCElement.getParams(RPCElement.java:268)
        at org.apache.axis.client.Call.invoke(Call.java:1862)
        at org.apache.axis.client.Call.invoke(Call.java:1768)
        at org.apache.axis.client.Call.invoke(Call.java:1306)
        at
com.touchcorp.soap.ihire.IHirebindingStub.getHireFromCustomerLicence(IHi
rebindingStub.java:257)
        at
com.touchcorp.remote.party.MystHireService.getHireFromCustomerLicence(My
stHireService.java:141)
        at
com.touchcorp.remote.party.MystHireService.main(MystHireService.java:188
)
[ERROR] Call - -Exception: <org.xml.sax.SAXException: Bad types (class
com.touchcorp.soap.ihire.THireInfo -> class java.lang.String)>
Exception in thread "main" AxisFault
 faultCode: {http://xml.apache.org/axis/}Server.userException
 faultString: org.xml.sax.SAXException: Bad types (class
com.touchcorp.soap.ihire.THireInfo -> class java.lang.String)
 faultActor: null
 faultDetail:
        stackTrace: org.xml.sax.SAXException: Bad types (class
com.touchcorp.soap.ihire.THireInfo -&gt; class java.lang.String)
...
(goes FOREVER)

Looking at the code in
org.apache.axis.message.RPCHandler.onStartChild(), it looks to me like
(just maybe) it's trying a bit too hard.

The section that's failing appears to be trying to head off a possible
deserialization problem by checking that source and destination types
are actually convertible.   While this appears to be an appropriate
action, you have to ask, "Why?  What would happen if we didn't do this
check?"  If the deserialization actually is impossible, we'll throw an
exception then.  This piece of code seems (to me, again, with respect)
to be totally superfluous PLUS it means that you have to maintain
JavaUtils.isConvertable() as well.

So I removed lines 267 to 277:
              if (paramDesc != null && paramDesc.getJavaType() != null)
{
                  // If we have an xsi:type, make sure it makes sense
                  // with the current paramDesc type
                  Class xsiClass =

context.getTypeMapping().getClassForQName(type);
                  if (!JavaUtils.isConvertable(xsiClass, destClass)) {
                  System.out.println("dser = " +
dser.getClass().getName());
                      throw new SAXException("Bad types (" +
                                             xsiClass + " -> " +
destClass + ")"); // FIXME!
                  }
              }

And now it works for me.

My complex object "com.touchcorp.soap.ihire.THireInfo" is handled by the
BeanSerializer and my client now works totally happily.

Hope this is useful to you.

Regards,

Neil Brennan

P.S. Even if you decide to keep the code - a *SAX* exception?  What?
How do you arrive at that?  It really has nothing to do with the XML at
this stage, does it?