axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James M Snell <jasn...@us.ibm.com>
Subject RE: Bean Mapping Issues
Date Fri, 10 Jan 2003 00:18:21 GMT
Ok, there definitely *appears* to be a problem.

I'm initializing the client using the following code (the WSDL file is 
attached)

    private static final QName NQqName = 
      new QName("urn:NasdaqQuotes-types", "NasdaqQuote");

    QName serviceQN = new QName("http://" + NQ, NQ + "Service" );
    QName portQN    = new QName("http://" + NQ, "quote");
    Service service = new Service(new URL(wsdlURL), serviceQN );
    Call call       = (Call)service.createCall(portQN, "getPrice");
    call.registerTypeMapping(
      NasdaqQuote.class,
      NQqName,
      BeanSerializerFactory.class,
      BeanDeserializerFactory.class);
    call.setReturnType(NQqName); 
    return (NasdaqQuote)call.invoke( new Object[] { symbol } );

When running this, I'm getting the following error while parsing the 
response.

           org.xml.sax.SAXException: Bad types (class NasdaqQuote -> class 
java.lang.String)
                at 
org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:309)

Digging in, I added a couple of lines of code to RPCHandler to see what 
was going on and came up with this:

Starting at line 215, there is code to retrieve the ParameterDesc for the 
current element.  This lookup is done using the QName of the current 
element:

            if (isResponse) {
                paramDesc = operation.getOutputParamByQName(qname);
            } else {
                paramDesc = operation.getInputParamByQName(qname);
            }

Anyway, the code properly serializes the request, sends it to the server, 
the server processes it right, sends a proper response, then boom, it 
blows up.  The problem appears to be that the paramDesc returned by the 
above operation is wrong given the qname.

isResponse == true
qname == getPriceReturn
paramDesc == 
    name:       symbol
    typeEntry:  null
    mode:       IN
    isReturn:   false
    typeQName:  {http://schemas.xmlsoap.org/soap/encoding/}string
    javaType:   class java.lang.String
    inHeader:   false
    outHeader:  false

In other words, even though a) we're in the response and b) qname == 
getPriceReturn, the method operation.getOutputParamByQName is returning an 
IN only parameter from the request message, not the response.

This is making the RPCHandler think it needs to deserialize the data as a 
string rather than a NasdaqQuote object.  This makes it mad and it spits 
at me.  That's not nice and I want it to stop.  I've told it to stop 
spitting at me and it's not listening.  That's not nice either. 

There's either a) something wrong with my WSDL (possible, but unlikely 
since the code works perfectly with Axis 1.0) or b) something wrong with 
the code that initializes the call/parameters/etc from the WSDL document. 
In either case, it's pissing me off. :-)  I'm going to grab a snack and 
keep digging.



- James Snell
     IBM Emerging Technologies
     jasnell@us.ibm.com
     (559) 587-1233 (office)
     (700) 544-9035 (t/l)
     Programming Web Services With SOAP
         O'Reilly & Associates, ISBN 0596000952

     Have I not commanded you? Be strong and courageous. 
     Do not be terrified, do not be discouraged, for the Lord your 
     God will be with you whereever you go.    - Joshua 1:9



Glen Daniels <gdaniels@macromedia.com>
01/09/2003 02:20 PM
Please respond to axis-dev


To
"'axis-dev@xml.apache.org'" <axis-dev@xml.apache.org>
cc

bcc

Subject
RE: Bean Mapping Issues




Hm.  Well, to potentially belabor the obvious... why don't you send us the 
WSDL? :)

--Glen

> -----Original Message-----
> From: James M Snell [mailto:jasnell@us.ibm.com]
> Sent: Thursday, January 09, 2003 5:09 PM
> To: axis-dev@xml.apache.org
> Subject: RE: Bean Mapping Issues
>
>
> Starting with a WSDL.  This is definitely being caused by a post 1.0
> change in the axis code.  I just tested again with Axis 1.0
> and it works
> perfectly.
>
> - James Snell
>      IBM Emerging Technologies
>      jasnell@us.ibm.com
>      (559) 587-1233 (office)
>      (700) 544-9035 (t/l)
>      Programming Web Services With SOAP
>          O'Reilly & Associates, ISBN 0596000952
>
>      Have I not commanded you? Be strong and courageous.
>      Do not be terrified, do not be discouraged, for the Lord your
>      God will be with you whereever you go.    - Joshua 1:9
>
>
>
> Glen Daniels <gdaniels@macromedia.com>
> 01/09/2003 01:48 PM
> Please respond to axis-dev
>
>
> To
> "'axis-dev@xml.apache.org'" <axis-dev@xml.apache.org>
> cc
>
> bcc
>
> Subject
> RE: Bean Mapping Issues
>
>
>
>
> The type mapping defines "NasdaqQuote" as the local part of
> the *type*
> QName.
>
> The "getPriceReturn" element name has nothing to do with the
> type mapping,
> that's the default (operationName + "Return") for operations with no
> "returnQName" specified in the WSDD.  You can change it by
> adding to the
> WSDD:
>
> <operation name="getPrice" returnQName="ns:NasdaqQuote"
> xmlns:ns="whatever"/>
>
> This hasn't changed since 1.0.  Are you starting from a WSDL here, or
> coding manually?  If the former, something may have changed wrt the
> WSDL2Java handling....?
>
> --Glen
>
> > -----Original Message-----
> > From: James M Snell [mailto:jasnell@us.ibm.com]
> > Sent: Thursday, January 09, 2003 3:27 PM
> > To: axis-dev@xml.apache.org
> > Subject: Bean Mapping Issues
> >
> >
> > Hmm.. I'm trying to chase down a problem I'm having with a
> > bean mapping
> > declaration and want to see if anyone else can spot the
> problem right
> > away.
> >
> > The service worked perfectly with Axis 1.0 and doesn't work now.
> >
> > Here's the deploy.wsdd
> >
> >     <deployment name="test" xmlns="http://xml.apache.org/axis/wsdd/"
> >         xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
> >       <service name="quote" provider="java:RPC">
> >         <parameter value="NasdaqQuotes" name="className"/>
> >         <parameter value="getPrice" name="allowedMethods"/>
> >       </service>
> >       <beanMapping
> >         xmlns:nq="urn:NasdaqQuotes-types"
> >         languageSpecificType="java:NasdaqQuote"
> >         qname="nq:NasdaqQuote"/>
> >     </deployment>
> >
> > The "quote" service's "getPrice" method returns a NasdaqQuote
> > object that
> > has been mapped to the "urn:NasdaqQuotes-types" namespace
> > using the qname
> > "NasdaqQuote".... however, below is the SOAP message that I'm
> > getting in
> > response:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <soapenv:Envelope
> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> >  <soapenv:Body>
> >   <ns1:getPriceResponse
> > soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> > xmlns:ns1="http://NasdaqQuotes-Interface">
> >    <getPriceReturn xsi:type="ns2:NasdaqQuote"
> > xmlns:ns2="urn:NasdaqQuotes-types">
> >     <todaysHigh xsi:type="xsd:double">55.25</todaysHigh>
> >     <fiftyTwoWeekHigh xsi:type="xsd:double">55.25</fiftyTwoWeekHigh>
> >     <tradingStatus xsi:type="xsd:string">ACTIVE</tradingStatus>
> >     <symbol xsi:type="xsd:string">XXX</symbol>
> >     <totalShares xsi:type="xsd:long">100</totalShares>
> >     <market xsi:type="xsd:string">NYSE</market>
> >     <todaysLow xsi:type="xsd:double">55.25</todaysLow>
> >     <issuerWebSite xsi:type="xsd:string">none</issuerWebSite>
> >     <errorText xsi:type="xsd:string"></errorText>
> >     <fiftyTwoWeekLow xsi:type="xsd:double">55.25</fiftyTwoWeekLow>
> >     <lastSalePrice xsi:type="xsd:double">55.25</lastSalePrice>
> >     <netPercentChange xsi:type="xsd:string">0</netPercentChange>
> >     <shareVolume xsi:type="xsd:long">10</shareVolume>
> >     <netPriceChange xsi:type="xsd:double">0.0</netPriceChange>
> >     <previousClosePrice
> > xsi:type="xsd:double">55.25</previousClosePrice>
> >    </getPriceReturn>
> >   </ns1:getPriceResponse>
> >  </soapenv:Body>
> > </soapenv:Envelope>
> >
> > The problem should be obvious.  Instead of the expected qname
> > "NasdaqQuote", the return value is called "getPriceReturn".
> > The type is
> > right, but the qname is wrong.  Under Axis 1.0, the qname was
> > NasdaqQuote.
> >  What changed?
> >
> > The reason I started having to look into this is that I'm
> getting the
> > following error when serializing the response:
> >
> >   faultCode:
> > {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> >   faultSubcode:
> >   faultString: org.xml.sax.SAXException: Bad types (class
> > NasdaqQuote ->
> > class java.lang.String)
> >   faultActor: null
> >   faultNode: null
> >
> > Thoughts?
> >
> > - James Snell
> >      IBM Emerging Technologies
> >      jasnell@us.ibm.com
> >      (559) 587-1233 (office)
> >      (700) 544-9035 (t/l)
> >      Programming Web Services With SOAP
> >          O'Reilly & Associates, ISBN 0596000952
> >
> >      Have I not commanded you? Be strong and courageous.
> >      Do not be terrified, do not be discouraged, for the Lord your
> >      God will be with you whereever you go.    - Joshua 1:9
> >
> 

Mime
View raw message