You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Rhimbo <rh...@yahoo.com> on 2006/04/14 04:38:04 UTC

SAXException: could not find deserializer for type

Hi Alick,

Thanks for the reply.  Below is the code I'm running.  

I am returning an instance of a class called PlayerSession from my
web service.  How do I specify the return type?  Is this call 
correct? 
	call.setReturnType(new QName("PlayerSession"));

I'm getting the error when I run my DII client:

org.xml.sax.SAXException: Deserializing parameter 'getSessionReturn': 
could not find deserializer for type {disney.dis}PlayerSession
        at
org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277)
        at
org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)



Here is the "whole" code:

	ServiceFactory serviceFactory = ServiceFactory.newInstance();
	Service service = new org.apache.axis.client.Service();

	Call call = (Call) service.createCall();
 	call.setTargetEndpointAddress(new java.net.URL(sessionEndpoint));

	call.addParameter(new QName("uid"),
			  new QName("int"),
			  ParameterMode.IN);
	call.addParameter(new QName("productId"), 
			  new QName("string"),
			  ParameterMode.IN);
	call.addParameter(new QName("sessionId"), 
			  new QName("int"),
			  ParameterMode.IN);
	call.addParameter(new QName("context"), 
			  new QName("string"),
			  ParameterMode.IN);
	call.setReturnType(new QName("PlayerSession"));

	Integer userID = new Integer(100);
	String productID = new String("PP_TTO");
	Integer sessionID = new Integer(98765);
	String context = new String("Some string with text! ");
	Object [] args = 
	  new Object [] {userID, productID, sessionID, context};

	QName opName = new QName("getSession"); 
	call.invoke(opName, args);


Many thanks,

Vartan





--- Alick Buckley <Al...@lansa.com.au> wrote:

> 
> Hi Rhimbo,
> 
> I have been setting the return type on the OperationDesc using the
> following
> QNames.
> 
> In this example the "com.acme.service.soap.Employee" bean is being
> returned.
> 
> new javax.xml.namespace.QName ( "http://soap.service.acme.com",
> "Employee" )
> ) ;
> 
> For primitive types
> 
> new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> "int" )
> ) ;
> new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> "long" )
> ) ;
> new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> "float"
> ) ) ;
> new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> "double"
> ) ) ;
> new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> "boolean" ) ) ;
> 
> new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> "base64Binary" ) ) ;
> new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> "string"
> ) ) ;
> 
> 
> -----Original Message-----
> From: Rhimbo [mailto:rhimbo@yahoo.com]
> Sent: Friday, 14 April 2006 3:18 AM
> To: Axis users
> Subject: How to set return type with QName in DII client?
> 
> 
> Can anyone point me to a _good_ explanation of QName?  Specifically,
> I'm having trouble setting the return type for a call to a web
> service client that returns a Java Bean. 
> 
> A web service end point returns an instance of "Session", which is 
> an interface I defined.  Actually it returns an instance of 
> "PlayerSession", which is a Java Bean that implements the "Session" 
> interface.
> 
> I'm trying this: 
> 
>     String myEndpoint = "http://localhost:8080/axis/services/....."
> 
>     Service service = new Service();
>     Call call = (Call) service.createCall();
>     call.setTargetEndpointAddress(new java.net.URL(myEndpoint));
>     call.setOperationName("getSession");
> 
>     call.addParameter(new QName("uid"),
> 	              new QName("int"),
>                       ParameterMode.IN);
>     Integer i1 = new Integer(100);
>     call.setReturnType(new QName("Session"));         <--------
> 
>     call.invoke(new QName("getSession"), new Object [] {i1});
> 
> The line at "<---" is giving me trouble.  What do I enter here?
> 
> The org.apache.axis.client.Call Javadoc for 
>     setReturnType(QName type) 
> says 
>     type - QName of the return value type.
> 
> (not terribly useful).
> 
> The Javadoc for 
>     setReturnType(QName xmlType,
>                   java.lang.Class javaType)
> says
>     xmlType - - QName of the data type of the return value
>     javaType - - Java class of the return value
> 
> Hmm.  What is the QName?  What is the "local part" and what is
> the namespace URI?  
> 
> When I execute my client, I get the following exception:
> 
> ; nested exception is:
>         org.xml.sax.SAXParseException: Premature end of file.
> 
> 
> Can anyone point me to some good documentation, something other 
> than the W3C "Namespaces in XML" document? 
>    
> 
> Thanks,
> 
> V
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: [SPAM] Re: SAXException: could not find deserializer for type

Posted by Anne Thomas Manes <at...@gmail.com>.
Rhimbo,

A namespace must be a valid URI. "disney.dis.session" is not a valid URI.
You should change it to a valid URI. I notice in your code you use "
http://disney.dis.session", and this is a valid URI. Axis by default
converts your package name into a URI, but it isn't essential that your URI
maps to the package name. But in all cases your namespace URIs must be valid
URIs.

Anne

On 4/14/06, Rhimbo <rh...@yahoo.com> wrote:
>
> Hi all,
>
> Anne, no need to respond.  I got it to work.  Here is a summary
> of my experience with this problem.
>
> The problem was my "beanMapping" statement in my WSDD file.
>
>     <beanMapping qname="ns:Session" xmlns:ns="disney.dis.session"
>        languageSpecificType="java:disney.dis.session.Session"/>
>
>
> For some reason the deserializer didn't like the dots in the
> "disney.dis.session".  I changed it to "dis" and everything
> worked.
>
> Well, almost.  The "ns:Session" was a second problem.  I was
> getting the error:
>
> org.xml.sax.SAXException: Unable to create JavaBean of type
> disney.dis.session.Session.  Missing default constructor?  Error was:
> java.lang.InstantiationException: disney.dis.session.Session.
>
>
> "Session" is my interface.  I changed the WSDD to this:
>
>    <beanMapping qname="ns:PlayerSession" xmlns:ns="dis"
>        languageSpecificType="java:disney.dis.session.PlayerSession"/>
>
>
> and changed my code accordingly to return an instance of the
> "PlayerSession" class (that implements Session).  Then it worked
> fine.
>
> Am I correct in assuming that one can't specify a Java interface
> as the return type?
>
>
> Vartan
>
>
>
>
> --- Rhimbo <rh...@yahoo.com> wrote:
>
> > Anne,
> >
> > First, I appreciate the time you take to help.  Thank you.
> >
> > Can you indulge me a bit more.  I think I followed your instructions
> > accurately.  But I'm getting errors still.
> >
> > I am looking at my WSDL and not sure it's correct based on your
> > last email.
> >
> > My interface is "Session".  My implementing class is "PlayerSession".
> > In both files I define this method:
> >       public Session testSessionReturn()
> >
> >
> > Here is my WSDD file:
> >
> > <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> >   xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
> >   <service name="disSessionManagement" provider="java:RPC">
> >     <parameter name="className"
> >                value="disney.dis.session.SessionManager"/>
> >     <parameter name="allowedMethods" value="*"/>
> >     <parameter name="scope" value="application"/>
> >
> >     <beanMapping qname="ns:Session" xmlns:ns="disney.dis.session"
> >        languageSpecificType="java:disney.dis.session.Session"/>
> >   </service>
> > </deployment>
> >
> >
> > I added the "beanMapping" construct.  I deployed this via:
> >
> > $ java org.apache.axis.client.AdminClient disSessionDeploy.wsdd
> > Processing file disSessionDeploy.wsdd
> > <Admin>Done processing</Admin>
> > $
> >
> >
> > Here is the beginning of my wsdl when I go to
> >        http://localhost:8080/..../?wsdl
> >
> > <wsdl:types>
> >    <schema targetNamespace="disney.dis.session">
> >       <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
> >       <complexType abstract="true" name="Session">
> >       <sequence>
> >           <element name="context" nillable="true" type="xsd:string"/>
> >           <element name="creationTime" nillable="true"
> >                    type="xsd:dateTime"/>
> >           <element name="expirationTime" nillable="true"
> >                    type="xsd:dateTime"/>
> >           <element name="productId" nillable="true" type="xsd:string"/>
> >           <element name="sessionId" type="xsd:int"/>
> >           <element name="uid" type="xsd:int"/>
> >         </sequence>
> >       </complexType>
> >    </schema>
> > </wsdl:types>
> >
> >
> > The return message is:
> >
> > <wsdl:message name="testSessionReturnResponse">
> >    <wsdl:part name="testSessionReturnReturn" type="tns1:Session"/>
> > </wsdl:message>
> >
> >
> > Under <wsdl:portType name="SessionManager"> I have this:
> >
> > <wsdl:operation name="testSessionReturn">
> >    <wsdl:input message="impl:testSessionReturnRequest"
> >                name="testSessionReturnRequest"/>
> >    <wsdl:output message="impl:testSessionReturnResponse"
> >                 name="testSessionReturnResponse"/>
> > </wsdl:operation>
> >
> >
> >
> >
> > Is it correct that the targetNamespace is "disney.dis.session"?
> > Should it be reversed as you wrote in your email
> > (http://session.dis.disney)?   Or, do _I_ need to specify it in
> > reverse order in my WSDD file?
> >
> > Does it matter as long as it matches whatever is I specify as
> > the URI in my QName?
> >
> > Must the namespace name reflect any actual package name?
> >
> > Here is my client code:
> >
> >  void testSessionReturn()
> >   {
> >     try
> >       {
> >       String namespaceURI = "http://disney.dis.session";
> >       String localPart = "testSessionReturn";
> >
> >       ServiceFactory serviceFactory = ServiceFactory.newInstance();
> >
> >       QName serviceQName = new QName(namespaceURI, localPart);
> >       Service service = serviceFactory.createService(serviceQName);
> >
> >       QName portName = new QName(sessionEndpoint);
> >       Call call = (org.apache.axis.client.Call)
> >         service.createCall(portName, localPart);
> >
> >       URL endpointURL = new URL(sessionEndpoint);
> >
> >       call.setOperationName("testSessionReturn");
> >       call.setTargetEndpointAddress(endpointURL);
> >
> >       Class cl = Class.forName("disney.dis.session.Session");
> >       QName className = new QName("disney.dis.session.Session");
> >
> >       BeanSerializerFactory bsf =
> >         new BeanSerializerFactory(cl, className);
> >       BeanDeserializerFactory bdf =
> >         new BeanDeserializerFactory(cl, className);
> >       call.registerTypeMapping(cl, className, bsf, bdf);
> >
> >       System.out.println("testSessionReturn5");
> >
> >       call.invoke();
> >
> >       System.out.println("testSessionReturn6");
> >       }
> >     catch (Exception ex)
> >       {
> >       System.out.println(ex.getMessage());
> >       }
> >   }
> >
> >
> >
> > I get the following error:
> >
> > ; nested exception is:
> >         java.lang.NullPointerException
> > $
> >
> >
> >
> > I need to get log4j working on my client so I can see errors from
> > the AXIS libs.
> >
> > But I'm wondering what is basically wrong with the way I set up
> > my call, specify my QName's and so forth.
> >
> > Many thanks to anyone who has ideas.
> >
> > Vartan
> >
> >
> >
> >
> >
> >
> >
> > --- Anne Thomas Manes <at...@gmail.com> wrote:
> >
> > > Vartan,
> > >
> > > The QName is not the name of the class. As I replied to you
> > yesterday,
> > > a
> > > QName is a qualified name (in XML) that has two parts. The first part
> > > is a
> > > namespace (a URI), the second part is the local name ("Session"). In
> > > your
> > > particular case, the QName refers to the XML type of your return
> > value.
> > > The
> > > XML type information is specified in the WSDL (and the WSDD if the
> > > service
> > > is built with Axis). For example, (assuming that you are using
> > > RPC/encoded,
> > > which is the default in Axis) the WSDL would define your return
> > message
> > > as:
> > >
> > > <wsdl:message name="SessionResponse>
> > >     <wsdl:part name="session" type="impl:Session"/>
> > > </wsdl:message>
> > >
> > > In this case, the type QName is "impl"Session". (The structure of the
> > > "impl:Session" type should be defined in the <wsdl:types> section
> > using
> > > XML
> > > Schema.) The "impl" prefix refers to your WSDL targetNamespace. Given
> > > your
> > > package name, I would guess that the namespace URI is "
> > > http://session.dis.disney", but I suggest you verify that.
> > >
> > > If you are using RPC/encoded (the default) then the XML type
> > > information is
> > > also specified on the wire. For example, your return message will
> > > include
> > > something like this:
> > > <ns1:Return xmlns:ns1="http://session.dis.disney">
> >
> === message truncated ===
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

[SPAM] Re: SAXException: could not find deserializer for type

Posted by Rhimbo <rh...@yahoo.com>.
Hi all,

Anne, no need to respond.  I got it to work.  Here is a summary
of my experience with this problem.  

The problem was my "beanMapping" statement in my WSDD file.

    <beanMapping qname="ns:Session" xmlns:ns="disney.dis.session"
       languageSpecificType="java:disney.dis.session.Session"/>


For some reason the deserializer didn't like the dots in the
"disney.dis.session".  I changed it to "dis" and everything 
worked.  

Well, almost.  The "ns:Session" was a second problem.  I was
getting the error:

org.xml.sax.SAXException: Unable to create JavaBean of type
disney.dis.session.Session.  Missing default constructor?  Error was:
java.lang.InstantiationException: disney.dis.session.Session.


"Session" is my interface.  I changed the WSDD to this:

   <beanMapping qname="ns:PlayerSession" xmlns:ns="dis"
       languageSpecificType="java:disney.dis.session.PlayerSession"/>
 

and changed my code accordingly to return an instance of the
"PlayerSession" class (that implements Session).  Then it worked 
fine.  

Am I correct in assuming that one can't specify a Java interface
as the return type?  


Vartan




--- Rhimbo <rh...@yahoo.com> wrote:

> Anne,
> 
> First, I appreciate the time you take to help.  Thank you.
> 
> Can you indulge me a bit more.  I think I followed your instructions
> accurately.  But I'm getting errors still.
> 
> I am looking at my WSDL and not sure it's correct based on your 
> last email.
> 
> My interface is "Session".  My implementing class is "PlayerSession".
> In both files I define this method:
>       public Session testSessionReturn()
> 
> 
> Here is my WSDD file:
> 
> <deployment xmlns="http://xml.apache.org/axis/wsdd/"
>   xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
>   <service name="disSessionManagement" provider="java:RPC">
>     <parameter name="className" 
>                value="disney.dis.session.SessionManager"/>
>     <parameter name="allowedMethods" value="*"/>
>     <parameter name="scope" value="application"/>
> 
>     <beanMapping qname="ns:Session" xmlns:ns="disney.dis.session"
>        languageSpecificType="java:disney.dis.session.Session"/>
>   </service>
> </deployment>
> 
> 
> I added the "beanMapping" construct.  I deployed this via:
> 
> $ java org.apache.axis.client.AdminClient disSessionDeploy.wsdd
> Processing file disSessionDeploy.wsdd
> <Admin>Done processing</Admin>
> $
> 
> 
> Here is the beginning of my wsdl when I go to 
>        http://localhost:8080/..../?wsdl 
> 
> <wsdl:types>
>    <schema targetNamespace="disney.dis.session">
>       <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
>       <complexType abstract="true" name="Session">
> 	<sequence>
>           <element name="context" nillable="true" type="xsd:string"/>
>           <element name="creationTime" nillable="true" 
>                    type="xsd:dateTime"/>
>           <element name="expirationTime" nillable="true" 
>                    type="xsd:dateTime"/>
>           <element name="productId" nillable="true" type="xsd:string"/>
>           <element name="sessionId" type="xsd:int"/>
>           <element name="uid" type="xsd:int"/>
>         </sequence>
>       </complexType>
>    </schema>
> </wsdl:types>
> 
> 
> The return message is:
> 
> <wsdl:message name="testSessionReturnResponse">
>    <wsdl:part name="testSessionReturnReturn" type="tns1:Session"/>
> </wsdl:message>
> 
> 
> Under <wsdl:portType name="SessionManager"> I have this:
> 
> <wsdl:operation name="testSessionReturn">
>    <wsdl:input message="impl:testSessionReturnRequest"    
>                name="testSessionReturnRequest"/>
>    <wsdl:output message="impl:testSessionReturnResponse" 
>                 name="testSessionReturnResponse"/>
> </wsdl:operation>
> 
> 
> 
> 
> Is it correct that the targetNamespace is "disney.dis.session"?
> Should it be reversed as you wrote in your email 
> (http://session.dis.disney)?   Or, do _I_ need to specify it in
> reverse order in my WSDD file?  
> 
> Does it matter as long as it matches whatever is I specify as 
> the URI in my QName?  
> 
> Must the namespace name reflect any actual package name? 
> 
> Here is my client code:
> 
>  void testSessionReturn()
>   {
>     try
>       {
> 	String namespaceURI = "http://disney.dis.session";
> 	String localPart = "testSessionReturn";
> 
> 	ServiceFactory serviceFactory = ServiceFactory.newInstance();
> 
> 	QName serviceQName = new QName(namespaceURI, localPart);
> 	Service service = serviceFactory.createService(serviceQName);
> 
> 	QName portName = new QName(sessionEndpoint);
> 	Call call = (org.apache.axis.client.Call) 
> 	  service.createCall(portName, localPart);
> 
> 	URL endpointURL = new URL(sessionEndpoint);
> 
> 	call.setOperationName("testSessionReturn");
> 	call.setTargetEndpointAddress(endpointURL);
> 
> 	Class cl = Class.forName("disney.dis.session.Session");
> 	QName className = new QName("disney.dis.session.Session");
> 
> 	BeanSerializerFactory bsf = 
> 	  new BeanSerializerFactory(cl, className);
> 	BeanDeserializerFactory bdf = 
> 	  new BeanDeserializerFactory(cl, className);
> 	call.registerTypeMapping(cl, className, bsf, bdf);
> 
> 	System.out.println("testSessionReturn5");
> 
> 	call.invoke();
> 
> 	System.out.println("testSessionReturn6");
>       }
>     catch (Exception ex)
>       {
> 	System.out.println(ex.getMessage());
>       }
>   }
> 
> 
> 
> I get the following error:
> 
> ; nested exception is:
>         java.lang.NullPointerException
> $
> 
> 
> 
> I need to get log4j working on my client so I can see errors from 
> the AXIS libs.  
> 
> But I'm wondering what is basically wrong with the way I set up
> my call, specify my QName's and so forth.
> 
> Many thanks to anyone who has ideas.
> 
> Vartan
> 
> 
> 
> 
> 
> 
> 
> --- Anne Thomas Manes <at...@gmail.com> wrote:
> 
> > Vartan,
> > 
> > The QName is not the name of the class. As I replied to you
> yesterday,
> > a
> > QName is a qualified name (in XML) that has two parts. The first part
> > is a
> > namespace (a URI), the second part is the local name ("Session"). In
> > your
> > particular case, the QName refers to the XML type of your return
> value.
> > The
> > XML type information is specified in the WSDL (and the WSDD if the
> > service
> > is built with Axis). For example, (assuming that you are using
> > RPC/encoded,
> > which is the default in Axis) the WSDL would define your return
> message
> > as:
> > 
> > <wsdl:message name="SessionResponse>
> >     <wsdl:part name="session" type="impl:Session"/>
> > </wsdl:message>
> > 
> > In this case, the type QName is "impl"Session". (The structure of the
> > "impl:Session" type should be defined in the <wsdl:types> section
> using
> > XML
> > Schema.) The "impl" prefix refers to your WSDL targetNamespace. Given
> > your
> > package name, I would guess that the namespace URI is "
> > http://session.dis.disney", but I suggest you verify that.
> > 
> > If you are using RPC/encoded (the default) then the XML type
> > information is
> > also specified on the wire. For example, your return message will
> > include
> > something like this:
> > <ns1:Return xmlns:ns1="http://session.dis.disney">
> 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: SAXException: could not find deserializer for type

Posted by Rhimbo <rh...@yahoo.com>.
Anne,

First, I appreciate the time you take to help.  Thank you.

Can you indulge me a bit more.  I think I followed your instructions
accurately.  But I'm getting errors still.

I am looking at my WSDL and not sure it's correct based on your 
last email.

My interface is "Session".  My implementing class is "PlayerSession".
In both files I define this method:
      public Session testSessionReturn()


Here is my WSDD file:

<deployment xmlns="http://xml.apache.org/axis/wsdd/"
  xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
  <service name="disSessionManagement" provider="java:RPC">
    <parameter name="className" 
               value="disney.dis.session.SessionManager"/>
    <parameter name="allowedMethods" value="*"/>
    <parameter name="scope" value="application"/>

    <beanMapping qname="ns:Session" xmlns:ns="disney.dis.session"
       languageSpecificType="java:disney.dis.session.Session"/>
  </service>
</deployment>


I added the "beanMapping" construct.  I deployed this via:

$ java org.apache.axis.client.AdminClient disSessionDeploy.wsdd
Processing file disSessionDeploy.wsdd
<Admin>Done processing</Admin>
$


Here is the beginning of my wsdl when I go to 
       http://localhost:8080/..../?wsdl 

<wsdl:types>
   <schema targetNamespace="disney.dis.session">
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
      <complexType abstract="true" name="Session">
	<sequence>
          <element name="context" nillable="true" type="xsd:string"/>
          <element name="creationTime" nillable="true" 
                   type="xsd:dateTime"/>
          <element name="expirationTime" nillable="true" 
                   type="xsd:dateTime"/>
          <element name="productId" nillable="true" type="xsd:string"/>
          <element name="sessionId" type="xsd:int"/>
          <element name="uid" type="xsd:int"/>
        </sequence>
      </complexType>
   </schema>
</wsdl:types>


The return message is:

<wsdl:message name="testSessionReturnResponse">
   <wsdl:part name="testSessionReturnReturn" type="tns1:Session"/>
</wsdl:message>


Under <wsdl:portType name="SessionManager"> I have this:

<wsdl:operation name="testSessionReturn">
   <wsdl:input message="impl:testSessionReturnRequest"    
               name="testSessionReturnRequest"/>
   <wsdl:output message="impl:testSessionReturnResponse" 
                name="testSessionReturnResponse"/>
</wsdl:operation>




Is it correct that the targetNamespace is "disney.dis.session"?
Should it be reversed as you wrote in your email 
(http://session.dis.disney)?   Or, do _I_ need to specify it in
reverse order in my WSDD file?  

Does it matter as long as it matches whatever is I specify as 
the URI in my QName?  

Must the namespace name reflect any actual package name? 

Here is my client code:

 void testSessionReturn()
  {
    try
      {
	String namespaceURI = "http://disney.dis.session";
	String localPart = "testSessionReturn";

	ServiceFactory serviceFactory = ServiceFactory.newInstance();

	QName serviceQName = new QName(namespaceURI, localPart);
	Service service = serviceFactory.createService(serviceQName);

	QName portName = new QName(sessionEndpoint);
	Call call = (org.apache.axis.client.Call) 
	  service.createCall(portName, localPart);

	URL endpointURL = new URL(sessionEndpoint);

	call.setOperationName("testSessionReturn");
	call.setTargetEndpointAddress(endpointURL);

	Class cl = Class.forName("disney.dis.session.Session");
	QName className = new QName("disney.dis.session.Session");

	BeanSerializerFactory bsf = 
	  new BeanSerializerFactory(cl, className);
	BeanDeserializerFactory bdf = 
	  new BeanDeserializerFactory(cl, className);
	call.registerTypeMapping(cl, className, bsf, bdf);

	System.out.println("testSessionReturn5");

	call.invoke();

	System.out.println("testSessionReturn6");
      }
    catch (Exception ex)
      {
	System.out.println(ex.getMessage());
      }
  }



I get the following error:

; nested exception is:
        java.lang.NullPointerException
$



I need to get log4j working on my client so I can see errors from 
the AXIS libs.  

But I'm wondering what is basically wrong with the way I set up
my call, specify my QName's and so forth.

Many thanks to anyone who has ideas.

Vartan







--- Anne Thomas Manes <at...@gmail.com> wrote:

> Vartan,
> 
> The QName is not the name of the class. As I replied to you yesterday,
> a
> QName is a qualified name (in XML) that has two parts. The first part
> is a
> namespace (a URI), the second part is the local name ("Session"). In
> your
> particular case, the QName refers to the XML type of your return value.
> The
> XML type information is specified in the WSDL (and the WSDD if the
> service
> is built with Axis). For example, (assuming that you are using
> RPC/encoded,
> which is the default in Axis) the WSDL would define your return message
> as:
> 
> <wsdl:message name="SessionResponse>
>     <wsdl:part name="session" type="impl:Session"/>
> </wsdl:message>
> 
> In this case, the type QName is "impl"Session". (The structure of the
> "impl:Session" type should be defined in the <wsdl:types> section using
> XML
> Schema.) The "impl" prefix refers to your WSDL targetNamespace. Given
> your
> package name, I would guess that the namespace URI is "
> http://session.dis.disney", but I suggest you verify that.
> 
> If you are using RPC/encoded (the default) then the XML type
> information is
> also specified on the wire. For example, your return message will
> include
> something like this:
> <ns1:Return xmlns:ns1="http://session.dis.disney">
>     <session xsi:type="ns1:Session">[session-data]</Session>
> </ns1:Return>
> 
> In this example, the XML type is "http://session.dis.disney}Session"
> (you
> must map the "ns1" prefix to the actual namespace URI), and your Java
> QName
> would be defined like this:
> 
> new QName ("http://session.dis.disney", "Session")
> 
> See
>
http://java.sun.com/webservices/docs/1.6/api/javax/xml/namespace/QName.html)
> 
> for more information about the Java QName class.
> 
> Note -- you cannot use the JWS deployment method if you are returning a
> ValueType rather than a primitive type. You must use the WSDD method.
> 
> Anne
> 
> On 4/13/06, Rhimbo <rh...@yahoo.com> wrote:
> >
> > Could someone tell me what are the QName arguments to the
> > BeanSerializerFactory and BeanDeserializerFactory constructors?
> >
> > Do I instantiate QName with the name of my class:
> >     "disney.dis.session.PlayerSession"
> >
> >
> >
> > I tried doing this
> >
> >         QName qName = new QName("disney.dis.session.PlayerSession");
> >         BeanSerializerFactory bsf =
> >              new BeanSerializerFactory(cl, qName);
> >         BeanDeserializerFactory bdf =
> >              new BeanDeserializerFactory(cl, qName);
> >
> >         call.registerTypeMapping(cl, qName, bsf, bdf);
> >
> >
> > before my "invoke" call.  I'm getting the same error.
> >
> > - Exception:
> > org.xml.sax.SAXException: Deserializing parameter 'getSessionReturn':
> > could not find deserializer for type {disney.dis}PlayerSession
> >         at
> > org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277)
> >         at
> > org.apache.axis.encoding.DeserializationContext.startElement(
> > DeserializationContext.java:1035)
> >
> >
> >
> > I don't know if I'm on the right track or not.  Any ideas anyone?
> >
> > Many thanks.
> >
> > Vartan
> >
> >
> >
> >
> > --- Rhimbo <rh...@yahoo.com> wrote:
> >
> > > Hi Alick,
> > >
> > > Thanks for the reply.  Below is the code I'm running.
> > >
> > > I am returning an instance of a class called PlayerSession from my
> > > web service.  How do I specify the return type?  Is this call
> > > correct?
> > >       call.setReturnType(new QName("PlayerSession"));
> > >
> > > I'm getting the error when I run my DII client:
> > >
> > > org.xml.sax.SAXException: Deserializing parameter
> 'getSessionReturn':
> > > could not find deserializer for type {disney.dis}PlayerSession
> > >         at
> > >
> org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277)
> > >         at
> > >
> > org.apache.axis.encoding.DeserializationContext.startElement(
> > DeserializationContext.java:1035)
> > >
> > >
> > >
> > > Here is the "whole" code:
> > >
> > >       ServiceFactory serviceFactory = ServiceFactory.newInstance();
> > >       Service service = new org.apache.axis.client.Service();
> > >
> > >       Call call = (Call) service.createCall();
> > >       call.setTargetEndpointAddress(new
> java.net.URL(sessionEndpoint));
> > >
> > >       call.addParameter(new QName("uid"),
> > >                         new QName("int"),
> > >                         ParameterMode.IN);
> > >       call.addParameter(new QName("productId"),
> > >                         new QName("string"),
> > >                         ParameterMode.IN);
> > >       call.addParameter(new QName("sessionId"),
> > >                         new QName("int"),
> > >                         ParameterMode.IN);
> > >       call.addParameter(new QName("context"),
> > >                         new QName("string"),
> > >                         ParameterMode.IN);
> > >       call.setReturnType(new QName("PlayerSession"));
> > >
> > >       Integer userID = new Integer(100);
> > >       String productID = new String("PP_TTO");
> > >       Integer sessionID = new Integer(98765);
> > >       String context = new String("Some string with text! ");
> > >       Object [] args =
> > >         new Object [] {userID, productID, sessionID, context};
> > >
> > >       QName opName = new QName("getSession");
> > >       call.invoke(opName, args);
> > >
> > >
> > > Many thanks,
> > >
> > > Vartan
> > >
> > >
> > >
> > >
> > >
> > > --- Alick Buckley <Al...@lansa.com.au> wrote:
> > >
> > > >
> > > > Hi Rhimbo,
> > > >
> > > > I have been setting the return type on the OperationDesc using
> the
> > > > following
> > > > QNames.
> > > >
> > > > In this example the "com.acme.service.soap.Employee" bean is
> being
> > > > returned.
> > > >
> > > > new javax.xml.namespace.QName ( "http://soap.service.acme.com",
> > > > "Employee" )
> > > > ) ;
> > > >
> > > > For primitive types
> > > >
> > > > new javax.xml.namespace.QName (
> "http://www.w3.org/2001/XMLSchema",
> > > > "int" )
> > > > ) ;
> > > > new javax.xml.namespace.QName (
> "http://www.w3.org/2001/XMLSchema",
> > > > "long" )
> > > > ) ;
> > > > new javax.xml.namespace.QName (
> "http://www.w3.org/2001/XMLSchema",
> > > > "float"
> > > > ) ) ;
> > > > new javax.xml.namespace.QName (
> "http://www.w3.org/2001/XMLSchema",
> 
=== message truncated ===



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: SAXException: could not find deserializer for type

Posted by Anne Thomas Manes <at...@gmail.com>.
Vartan,

The QName is not the name of the class. As I replied to you yesterday, a
QName is a qualified name (in XML) that has two parts. The first part is a
namespace (a URI), the second part is the local name ("Session"). In your
particular case, the QName refers to the XML type of your return value. The
XML type information is specified in the WSDL (and the WSDD if the service
is built with Axis). For example, (assuming that you are using RPC/encoded,
which is the default in Axis) the WSDL would define your return message as:

<wsdl:message name="SessionResponse>
    <wsdl:part name="session" type="impl:Session"/>
</wsdl:message>

In this case, the type QName is "impl"Session". (The structure of the
"impl:Session" type should be defined in the <wsdl:types> section using XML
Schema.) The "impl" prefix refers to your WSDL targetNamespace. Given your
package name, I would guess that the namespace URI is "
http://session.dis.disney", but I suggest you verify that.

If you are using RPC/encoded (the default) then the XML type information is
also specified on the wire. For example, your return message will include
something like this:
<ns1:Return xmlns:ns1="http://session.dis.disney">
    <session xsi:type="ns1:Session">[session-data]</Session>
</ns1:Return>

In this example, the XML type is "http://session.dis.disney}Session" (you
must map the "ns1" prefix to the actual namespace URI), and your Java QName
would be defined like this:

new QName ("http://session.dis.disney", "Session")

See
http://java.sun.com/webservices/docs/1.6/api/javax/xml/namespace/QName.html)

for more information about the Java QName class.

Note -- you cannot use the JWS deployment method if you are returning a
ValueType rather than a primitive type. You must use the WSDD method.

Anne

On 4/13/06, Rhimbo <rh...@yahoo.com> wrote:
>
> Could someone tell me what are the QName arguments to the
> BeanSerializerFactory and BeanDeserializerFactory constructors?
>
> Do I instantiate QName with the name of my class:
>     "disney.dis.session.PlayerSession"
>
>
>
> I tried doing this
>
>         QName qName = new QName("disney.dis.session.PlayerSession");
>         BeanSerializerFactory bsf =
>              new BeanSerializerFactory(cl, qName);
>         BeanDeserializerFactory bdf =
>              new BeanDeserializerFactory(cl, qName);
>
>         call.registerTypeMapping(cl, qName, bsf, bdf);
>
>
> before my "invoke" call.  I'm getting the same error.
>
> - Exception:
> org.xml.sax.SAXException: Deserializing parameter 'getSessionReturn':
> could not find deserializer for type {disney.dis}PlayerSession
>         at
> org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277)
>         at
> org.apache.axis.encoding.DeserializationContext.startElement(
> DeserializationContext.java:1035)
>
>
>
> I don't know if I'm on the right track or not.  Any ideas anyone?
>
> Many thanks.
>
> Vartan
>
>
>
>
> --- Rhimbo <rh...@yahoo.com> wrote:
>
> > Hi Alick,
> >
> > Thanks for the reply.  Below is the code I'm running.
> >
> > I am returning an instance of a class called PlayerSession from my
> > web service.  How do I specify the return type?  Is this call
> > correct?
> >       call.setReturnType(new QName("PlayerSession"));
> >
> > I'm getting the error when I run my DII client:
> >
> > org.xml.sax.SAXException: Deserializing parameter 'getSessionReturn':
> > could not find deserializer for type {disney.dis}PlayerSession
> >         at
> > org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277)
> >         at
> >
> org.apache.axis.encoding.DeserializationContext.startElement(
> DeserializationContext.java:1035)
> >
> >
> >
> > Here is the "whole" code:
> >
> >       ServiceFactory serviceFactory = ServiceFactory.newInstance();
> >       Service service = new org.apache.axis.client.Service();
> >
> >       Call call = (Call) service.createCall();
> >       call.setTargetEndpointAddress(new java.net.URL(sessionEndpoint));
> >
> >       call.addParameter(new QName("uid"),
> >                         new QName("int"),
> >                         ParameterMode.IN);
> >       call.addParameter(new QName("productId"),
> >                         new QName("string"),
> >                         ParameterMode.IN);
> >       call.addParameter(new QName("sessionId"),
> >                         new QName("int"),
> >                         ParameterMode.IN);
> >       call.addParameter(new QName("context"),
> >                         new QName("string"),
> >                         ParameterMode.IN);
> >       call.setReturnType(new QName("PlayerSession"));
> >
> >       Integer userID = new Integer(100);
> >       String productID = new String("PP_TTO");
> >       Integer sessionID = new Integer(98765);
> >       String context = new String("Some string with text! ");
> >       Object [] args =
> >         new Object [] {userID, productID, sessionID, context};
> >
> >       QName opName = new QName("getSession");
> >       call.invoke(opName, args);
> >
> >
> > Many thanks,
> >
> > Vartan
> >
> >
> >
> >
> >
> > --- Alick Buckley <Al...@lansa.com.au> wrote:
> >
> > >
> > > Hi Rhimbo,
> > >
> > > I have been setting the return type on the OperationDesc using the
> > > following
> > > QNames.
> > >
> > > In this example the "com.acme.service.soap.Employee" bean is being
> > > returned.
> > >
> > > new javax.xml.namespace.QName ( "http://soap.service.acme.com",
> > > "Employee" )
> > > ) ;
> > >
> > > For primitive types
> > >
> > > new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> > > "int" )
> > > ) ;
> > > new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> > > "long" )
> > > ) ;
> > > new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> > > "float"
> > > ) ) ;
> > > new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> > > "double"
> > > ) ) ;
> > > new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> > > "boolean" ) ) ;
> > >
> > > new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> > > "base64Binary" ) ) ;
> > > new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> > > "string"
> > > ) ) ;
> > >
> > >
> > > -----Original Message-----
> > > From: Rhimbo [mailto:rhimbo@yahoo.com]
> > > Sent: Friday, 14 April 2006 3:18 AM
> > > To: Axis users
> > > Subject: How to set return type with QName in DII client?
> > >
> > >
> > > Can anyone point me to a _good_ explanation of QName?  Specifically,
> > > I'm having trouble setting the return type for a call to a web
> > > service client that returns a Java Bean.
> > >
> > > A web service end point returns an instance of "Session", which is
> > > an interface I defined.  Actually it returns an instance of
> > > "PlayerSession", which is a Java Bean that implements the "Session"
> > > interface.
> > >
> > > I'm trying this:
> > >
> > >     String myEndpoint = "http://localhost:8080/axis/services/....."
> > >
> > >     Service service = new Service();
> > >     Call call = (Call) service.createCall();
> > >     call.setTargetEndpointAddress(new java.net.URL(myEndpoint));
> > >     call.setOperationName("getSession");
> > >
> > >     call.addParameter(new QName("uid"),
> > >                   new QName("int"),
> > >                       ParameterMode.IN);
> > >     Integer i1 = new Integer(100);
> > >     call.setReturnType(new QName("Session"));         <--------
> > >
> > >     call.invoke(new QName("getSession"), new Object [] {i1});
> > >
> > > The line at "<---" is giving me trouble.  What do I enter here?
> > >
> > > The org.apache.axis.client.Call Javadoc for
> > >     setReturnType(QName type)
> > > says
> > >     type - QName of the return value type.
> > >
> > > (not terribly useful).
> > >
> > > The Javadoc for
> > >     setReturnType(QName xmlType,
> > >                   java.lang.Class javaType)
> > > says
> > >     xmlType - - QName of the data type of the return value
> > >     javaType - - Java class of the return value
> > >
> > > Hmm.  What is the QName?  What is the "local part" and what is
> > > the namespace URI?
> > >
> > > When I execute my client, I get the following exception:
> > >
> > > ; nested exception is:
> > >         org.xml.sax.SAXParseException: Premature end of file.
> > >
> > >
> > > Can anyone point me to some good documentation, something other
> > > than the W3C "Namespaces in XML" document?
> > >
> > >
> > > Thanks,
> > >
> > > V
> > >
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam protection around
> > > http://mail.yahoo.com
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

Re: SAXException: could not find deserializer for type

Posted by Rhimbo <rh...@yahoo.com>.
Could someone tell me what are the QName arguments to the 
BeanSerializerFactory and BeanDeserializerFactory constructors?

Do I instantiate QName with the name of my class:
    "disney.dis.session.PlayerSession"



I tried doing this

	QName qName = new QName("disney.dis.session.PlayerSession");
	BeanSerializerFactory bsf = 
             new BeanSerializerFactory(cl, qName);
	BeanDeserializerFactory bdf = 
             new BeanDeserializerFactory(cl, qName);

	call.registerTypeMapping(cl, qName, bsf, bdf);
				 

before my "invoke" call.  I'm getting the same error. 

- Exception:
org.xml.sax.SAXException: Deserializing parameter 'getSessionReturn': 
could not find deserializer for type {disney.dis}PlayerSession
        at
org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277)
        at
org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)



I don't know if I'm on the right track or not.  Any ideas anyone?

Many thanks. 

Vartan




--- Rhimbo <rh...@yahoo.com> wrote:

> Hi Alick,
> 
> Thanks for the reply.  Below is the code I'm running.  
> 
> I am returning an instance of a class called PlayerSession from my
> web service.  How do I specify the return type?  Is this call 
> correct? 
> 	call.setReturnType(new QName("PlayerSession"));
> 
> I'm getting the error when I run my DII client:
> 
> org.xml.sax.SAXException: Deserializing parameter 'getSessionReturn': 
> could not find deserializer for type {disney.dis}PlayerSession
>         at
> org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277)
>         at
>
org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
> 
> 
> 
> Here is the "whole" code:
> 
> 	ServiceFactory serviceFactory = ServiceFactory.newInstance();
> 	Service service = new org.apache.axis.client.Service();
> 
> 	Call call = (Call) service.createCall();
>  	call.setTargetEndpointAddress(new java.net.URL(sessionEndpoint));
> 
> 	call.addParameter(new QName("uid"),
> 			  new QName("int"),
> 			  ParameterMode.IN);
> 	call.addParameter(new QName("productId"), 
> 			  new QName("string"),
> 			  ParameterMode.IN);
> 	call.addParameter(new QName("sessionId"), 
> 			  new QName("int"),
> 			  ParameterMode.IN);
> 	call.addParameter(new QName("context"), 
> 			  new QName("string"),
> 			  ParameterMode.IN);
> 	call.setReturnType(new QName("PlayerSession"));
> 
> 	Integer userID = new Integer(100);
> 	String productID = new String("PP_TTO");
> 	Integer sessionID = new Integer(98765);
> 	String context = new String("Some string with text! ");
> 	Object [] args = 
> 	  new Object [] {userID, productID, sessionID, context};
> 
> 	QName opName = new QName("getSession"); 
> 	call.invoke(opName, args);
> 
> 
> Many thanks,
> 
> Vartan
> 
> 
> 
> 
> 
> --- Alick Buckley <Al...@lansa.com.au> wrote:
> 
> > 
> > Hi Rhimbo,
> > 
> > I have been setting the return type on the OperationDesc using the
> > following
> > QNames.
> > 
> > In this example the "com.acme.service.soap.Employee" bean is being
> > returned.
> > 
> > new javax.xml.namespace.QName ( "http://soap.service.acme.com",
> > "Employee" )
> > ) ;
> > 
> > For primitive types
> > 
> > new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> > "int" )
> > ) ;
> > new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> > "long" )
> > ) ;
> > new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> > "float"
> > ) ) ;
> > new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> > "double"
> > ) ) ;
> > new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> > "boolean" ) ) ;
> > 
> > new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> > "base64Binary" ) ) ;
> > new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema",
> > "string"
> > ) ) ;
> > 
> > 
> > -----Original Message-----
> > From: Rhimbo [mailto:rhimbo@yahoo.com]
> > Sent: Friday, 14 April 2006 3:18 AM
> > To: Axis users
> > Subject: How to set return type with QName in DII client?
> > 
> > 
> > Can anyone point me to a _good_ explanation of QName?  Specifically,
> > I'm having trouble setting the return type for a call to a web
> > service client that returns a Java Bean. 
> > 
> > A web service end point returns an instance of "Session", which is 
> > an interface I defined.  Actually it returns an instance of 
> > "PlayerSession", which is a Java Bean that implements the "Session" 
> > interface.
> > 
> > I'm trying this: 
> > 
> >     String myEndpoint = "http://localhost:8080/axis/services/....."
> > 
> >     Service service = new Service();
> >     Call call = (Call) service.createCall();
> >     call.setTargetEndpointAddress(new java.net.URL(myEndpoint));
> >     call.setOperationName("getSession");
> > 
> >     call.addParameter(new QName("uid"),
> > 	              new QName("int"),
> >                       ParameterMode.IN);
> >     Integer i1 = new Integer(100);
> >     call.setReturnType(new QName("Session"));         <--------
> > 
> >     call.invoke(new QName("getSession"), new Object [] {i1});
> > 
> > The line at "<---" is giving me trouble.  What do I enter here?
> > 
> > The org.apache.axis.client.Call Javadoc for 
> >     setReturnType(QName type) 
> > says 
> >     type - QName of the return value type.
> > 
> > (not terribly useful).
> > 
> > The Javadoc for 
> >     setReturnType(QName xmlType,
> >                   java.lang.Class javaType)
> > says
> >     xmlType - - QName of the data type of the return value
> >     javaType - - Java class of the return value
> > 
> > Hmm.  What is the QName?  What is the "local part" and what is
> > the namespace URI?  
> > 
> > When I execute my client, I get the following exception:
> > 
> > ; nested exception is:
> >         org.xml.sax.SAXParseException: Premature end of file.
> > 
> > 
> > Can anyone point me to some good documentation, something other 
> > than the W3C "Namespaces in XML" document? 
> >    
> > 
> > Thanks,
> > 
> > V
> > 
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around 
> > http://mail.yahoo.com 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com