axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Jones" <Tjo...@metamatrix.com>
Subject RE: [Axix2] java.lang.RuntimeException: Unexpected subelement value
Date Tue, 03 Apr 2007 01:37:14 GMT
Thanks for the feedback Anne. It is much appreciated. I'm using the ADB. I'll log a JIRA on
it and switch to a schema first approach. 

Thanks again,
Ted

-----Original Message-----
From: Anne Thomas Manes [mailto:atmanes@gmail.com]
Sent: Mon 4/2/2007 7:01 PM
To: axis-user@ws.apache.org
Subject: Re: [Axix2] java.lang.RuntimeException: Unexpected subelement value
 
But why is Axis2 putting the "value" element in the xsd namespace.
Your schema specifies that it should be in the
"http://helper.mywebservice.soap.widget.com/xsd" namespace. Which
databinding are you using? Can you give us more information on how the
message is being generated? You might want to file a JIRA on this one.

Meanwhile, if you can avoid it, you should not use an element of type
"xs:anyType" in your schema. Your first mistake was in letting Axis2
generate your schema. (it's a common mistake, though). When designing
interoperable web services, you should define your schema first, then
map the schema to your code.

But let's assume for the moment that you avoid my advice and continue
down the treacherous code-first development approach...

If you have an interface that includes an undefined Object, Axis2 has
no way of deciphering the expected type, so it defines it as
xs:anyType. You should do your best to define the structures that you
plan to expose through the interface. As a general rule, never expose
Java Collections. Only expose simple types, beans, and arrays. As long
as you follow these basic rules, things typically work reasonably
well.

Anne

On 4/2/07, Ted Jones <Tjones@metamatrix.com> wrote:
> Further analysis of the soap response leads me to believe the array of
> cells may be the culprit here. Here is a snippet from the response that
> shows an array of cells:
>
> <rows xmlns="http://helper.mywebservice.soap.widget.com/xsd">
> <cells>
> <xs:value xmlns:xs="http://www.w3.org/2001/XMLSchema">value1</xs:value>
> </cells>
> <cells>
> <xs:value xmlns:xs="http://www.w3.org/2001/XMLSchema">value2</xs:value>
> </cells>
> <cells>
> <xs:value xmlns:xs="http://www.w3.org/2001/XMLSchema">value3</xs:value>
> </cells>
> <cells><xs:value
> xmlns:xs="http://www.w3.org/2001/XMLSchema">value4</xs:value></cells>
> </rows>
>
> The elements "rows" and "cells" share the same namespace and the stub
> handles them just fine. The "value" element uses the XMLSchema namespace
> though and the stub bombs out since it is expecting the parent namespace
> from the "rows" element. This seems like a valid schema though so that
> would place the error in the generated stub code. Right?
>
> Thanks,
> Ted
>
> -----Original Message-----
> From: Ted Jones [mailto:Tjones@metamatrix.com]
> Sent: Monday, April 02, 2007 3:05 PM
> To: axis-user@ws.apache.org
> Subject: RE: [Axix2] java.lang.RuntimeException: Unexpected subelement
> value
>
> More info...
>
> The cell element is returned as part of an array. Not sure if this makes
> any difference or not.
>
> Thanks,
> Ted
>
> -----Original Message-----
> From: Ted Jones [mailto:Tjones@metamatrix.com]
> Sent: Saturday, March 31, 2007 11:56 AM
> To: axis-user@ws.apache.org
> Subject: RE: [Axix2] java.lang.RuntimeException: Unexpected subelement
> value
>
> That is how Axis2 generated the schema in my wsdl. I have a POJO (Cell)
> which has a field (Value) of type Object. Here is the schema generated
> by Axis2 that seems to be causing the issue:
>
> <xs:element name="Cell" type="ax21:Cell" /> <xs:complexType name="Cell">
> <xs:sequence> <xs:element name="value" type="xs:anyType" />
> </xs:sequence> </xs:complexType>
>
> This cell element is used in the response and the stub tries to compare
> it's namespace (http://helper.mywebservice.soap.widget.com/xsd) to
> create a QName to compare to the "value" element which uses the
> "http://www.w3.org/2001/XMLSchema" namespace and causes the "Unexpected
> subelement value" exception.
>
> Here is my POJO:
>
> public class Cell {
>
>         protected java.lang.Object value;
>
>         public java.lang.Object getValue() {
>                 return value;
>         }
>
>         public void setValue(java.lang.Object value) {
>                 this.value = value;
>         }
> }
>
> I have also attached my full wsdl.
>
> Thanks for your help,
> Ted
>
> -----Original Message-----
> From: Anne Thomas Manes [mailto:atmanes@gmail.com]
> Sent: Saturday, March 31, 2007 10:27 AM
> To: axis-user@ws.apache.org
> Subject: Re: [Axix2] java.lang.RuntimeException: Unexpected subelement
> value
>
> Why do you have an element in your message in the
> "http://www.w3.org/2001/XMLSchema" namespace? Does your message include
> a schema? If so, have you defined a <xs:schema> element as an element
> within your message structure? Or did you perhaps specify
> "http://www.w3.org/2001/XMLSchema" as the targetNamespace for your
> schema?
>
> An example would help us identify the problem.
>
> Anne
>
> On 3/30/07, Ted Jones <Tjones@metamatrix.com> wrote:
> >
> >
> > Thanks for your response Amila. The SOAP response looks correct when
> > validating against the wsdl. The issue seems to be in the generated
> > stub code when a check is done comparing the QName of the element. The
>
> > WSDL targetnamespace http://helper.webservice.soap.test.com/xsd
> > is used to compare against an element that has
> > http://www.w3.org/2001/XMLSchema as it's namespace so they don't match
>
> > up and consequently the "java.lang.RuntimeException: Unexpected
> > subelement value" exception is thrown.
> >
> > Here is the line I am referring to:
> >
> > if (reader.isStartElement() && new
> >
> javax.xml.namespace.QName("http://helper.mywebservice.soap.widget.com/xs
> d"
> > ,"value").equals(reader.getName())){
> >
> > Is this a limitation of ADB, an error in the stub generation, an error
>
> > in the wsdl generation, or something I can control in my stub
> generation?
> >
> > Thanks for any insight you can offer.
> >
> > Ted
> >
> >  ________________________________
> >  From: Amila Suriarachchi [mailto:amilasuriarachchi@gmail.com]
> > Sent: Thursday, March 29, 2007 11:48 PM
> > To: axis-user@ws.apache.org
> > Subject: Re: [Axix2] java.lang.RuntimeException: Unexpected subelement
>
> > value
> >
> >
> > we have discussed this senario in many times.
> >
> > First thing you have to do is to check the received soap message using
>
> > the tcp mon.
> > then validate the that received response message with the generated
> > wsdl (wsdl you used to generate the code)
> >
> > Amila.
> >
> >
> > On 3/30/07, Ted Jones <Tjones@metamatrix.com> wrote:
> > >
> > >
> > > I am receiving the following exception in my ADB generated stub
> > > while
> > processing my soap response: java.lang.RuntimeException: Unexpected
> > subelement value
> > >
> > > The WSDL used to generate my stub is auto generated (Axis2 1.1.1).
> > >
> > > Any ideas?
> > >
> > > TIA,
> > > Ted
> >
> >
> >
> > --
> > Amila Suriarachchi,
> > WSO2 Inc.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

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



Mime
View raw message