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 Lindsey Hess <li...@yahoo.com> on 2007/02/12 07:05:00 UTC

simpledeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize

Hi,
   
  I've run Axis 1.4's WSDL2Java against my WSDL and associated schemas, and generated a number of classes.  My WSDL contains a number of complex types.
   
  When I invoke a web service from some client code, I get the following exception:
   
  "simpledeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize"
   
  I don't understand why I'm getting this, as I'm setting the required parameters in my server code as specified in my WSDL.  Does anyone have any suggestions?
   
  Thank you,
   
  Lindsey

 	
---------------------------------
Everyone is raving about the all-new Yahoo! Mail beta.

Re: simpledeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize

Posted by Lindsey Hess <li...@yahoo.com>.
Thanks, Anne.  I will try your suggestions.  Is it necessary to set the resultType for my my call?  Should I do something like this:
   
  QName qnSearchResponse=new QName("urn:ifis-wsdl", "SearchResponseType");
  callSearch.setReturnType(qnSearchResponse);
   
  Or is that wrong or unncessary?

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

First issue: You've imported your schema namespace incorrectly. You
can't use the to import a schema. You must use
instead. must appear within the 
definition.

Second issue: Based on your current WSDL, your method signature looks like this:

searchResponse search(searchRequest);

If you want your method signature to accept and return parameters
rather than value objects, then you must define the WSDL using the
"wrapped" convention (see [1]), and in your WSDD you should define the
service thus:



Third issue: Remove the "namespace" attribute from your 
and definitions. (The namespace attribute should be used
only with style="rpc".) They should be defined thus:


and


I've also seen a recurring problem with schemas that have a namespace
URI that ends with "#". If you fix the issues above and still have
this problem, I suggest your try removing the "#" from the namespace.

Anne

On 2/12/07, Lindsey Hess 
wrote:
> Hi Anne,
>
> Attached is the WSDL.
>
> From my client code, I'm doing this:
>
> Object[] opParamsSearch=(new PostiveInteger(m_Timeout), queryType);
> //queryType is a complex type
>
> SearchResponseType searchResponse;
> try{
>
> searchResponse=(SearchResponseType)callSearch.invoke(opParamsSearch);
> }catch(Exception e)
> {
> e.printStackTrace();
> }
>
>
> It may not be apparent from the WSDL, but SearchResponseType returns an id
> and a result of type ResultType. ResultType is a complex type. It contains
> a number of required parameters, included a complex type called metadata.
> Metadata is essentially an array. So, every search response will contain an
> id, results, and an array of metadata.
>
> I should note that in my server-config.wsdd file I have all of the necessary
> serializes/deserializers listed (WSDL2Java created them). I'm also defining
> my service as follows:
>
> 
>
> Thank you!
>
> Lindsey
>
> Anne Thomas Manes wrote:
> Can you post the WSDL please?
>
> On 2/12/07, Lindsey Hess wrote:
> > Hi,
> >
> > I've run Axis 1.4's WSDL2Java against my WSDL and associated schemas, and
> > generated a number of classes. My WSDL contains a number of complex types.
> >
> > When I invoke a web service from some client code, I get the following
> > exception:
> >
> > "simpledeserializer encountered a child element, which is NOT expected, in
> > something it was trying to deserialize"
> >
> > I don't understand why I'm getting this, as I'm setting the required
> > parameters in my server code as specified in my WSDL. Does anyone have any
> > suggestions?
> >
> > Thank you,
> >
> > Lindsey
> >
> > ________________________________
> > Everyone is raving about the all-new Yahoo! Mail beta.
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>
>
> ________________________________
> Any questions? Get answers on any topic at Yahoo! Answers. Try it now.
> --0-1514824370-1171307635=:47831--
>
>
>


 
---------------------------------
 Get your own web address.
 Have a HUGE year through Yahoo! Small Business.

Re: simpledeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize

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

First issue: You've imported your schema namespace incorrectly. You
can't use the <wsdl:import> to import a schema. You must use
<xs:import> instead. <xsd:import> must appear within the <xs:schema>
definition.

Second issue: Based on your current WSDL, your method signature looks like this:

  searchResponse search(searchRequest);

If you want your method signature to accept and return parameters
rather than value objects, then you must define the WSDL using the
"wrapped" convention (see [1]), and in your WSDD you should define the
service thus:

   <service name="search" provider="java:RPC" style="wrapped" use="literal">

Third issue: Remove the "namespace" attribute from your <soap:body>
and <soap:fault> definitions. (The namespace attribute should be used
only with style="rpc".) They should be defined thus:

   <soap:body use="literal">
       and
   <soap:fault name="[name]" use="literal">

I've also seen a recurring problem with schemas that have a namespace
URI that ends with "#". If you fix the issues above and still have
this problem, I suggest your try removing the "#" from the namespace.

Anne

On 2/12/07, Lindsey Hess <li...@yahoo.com> wrote:
> Hi Anne,
>
> Attached is the WSDL.
>
> From my client code, I'm doing this:
>
> Object[] opParamsSearch=(new PostiveInteger(m_Timeout), queryType);
> //queryType is a complex type
>
> SearchResponseType searchResponse;
> try{
>
> searchResponse=(SearchResponseType)callSearch.invoke(opParamsSearch);
> }catch(Exception e)
> {
>   e.printStackTrace();
> }
>
>
> It may not be apparent from the WSDL, but SearchResponseType returns an id
> and a result of type ResultType.  ResultType is a complex type.  It contains
> a number of required parameters, included a complex type called metadata.
> Metadata is essentially an array.  So, every search response will contain an
> id, results, and an array of metadata.
>
> I should note that in my server-config.wsdd file I have all of the necessary
> serializes/deserializers listed (WSDL2Java created them).  I'm also defining
> my service as follows:
>
> <service name="search" provider="java:RPC" style="document" use="literal">
>
> Thank you!
>
> Lindsey
>
> Anne Thomas Manes <at...@gmail.com> wrote:
> Can you post the WSDL please?
>
> On 2/12/07, Lindsey Hess wrote:
> > Hi,
> >
> > I've run Axis 1.4's WSDL2Java against my WSDL and associated schemas, and
> > generated a number of classes. My WSDL contains a number of complex types.
> >
> > When I invoke a web service from some client code, I get the following
> > exception:
> >
> > "simpledeserializer encountered a child element, which is NOT expected, in
> > something it was trying to deserialize"
> >
> > I don't understand why I'm getting this, as I'm setting the required
> > parameters in my server code as specified in my WSDL. Does anyone have any
> > suggestions?
> >
> > Thank you,
> >
> > Lindsey
> >
> > ________________________________
> > Everyone is raving about the all-new Yahoo! Mail beta.
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>
>
>  ________________________________
> Any questions? Get answers on any topic at Yahoo! Answers. Try it now.
> --0-1514824370-1171307635=:47831--
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: simpledeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize

Posted by Anne Thomas Manes <at...@gmail.com>.
Can you post the WSDL please?

On 2/12/07, Lindsey Hess <li...@yahoo.com> wrote:
> Hi,
>
> I've run Axis 1.4's WSDL2Java against my WSDL and associated schemas, and
> generated a number of classes.  My WSDL contains a number of complex types.
>
> When I invoke a web service from some client code, I get the following
> exception:
>
> "simpledeserializer encountered a child element, which is NOT expected, in
> something it was trying to deserialize"
>
> I don't understand why I'm getting this, as I'm setting the required
> parameters in my server code as specified in my WSDL.  Does anyone have any
> suggestions?
>
> Thank you,
>
> Lindsey
>
>  ________________________________
> Everyone is raving about the all-new Yahoo! Mail beta.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org