On Mon, 2012-11-26 at 12:40 +0100, moh.sushi wrote:
> Hi Tim,
> 
> thank yor for your answer.
> 
> going into generated source code, apply
> "https://recettage.ria.neopod.fm-ged.com/ws"; in first arg for qname
> =>         private static final javax.xml.namespace.QName RETURN$0 =
>             new
> javax.xml.namespace.QName("https://recettage.ria.neopod.fm-ged.com/ws";,
> "return");
> 
> Repack jar-file (of generated classes)
> 
> and start test
> 
> Unfortunately, test fails
> => java.lang.ClassCastException:
> org.apache.xmlbeans.impl.values.XmlAnyTypeImpl cannot be cast to
> com.fm_ged.neopod.ria.recettage.ws.Order
>       at 
> com.fm_ged.neopod.ria.recettage.ws.impl.GetImageURLResponseDocumentImpl$GetImageURLResponseImpl.getReturn(GetImageURLResponseDocumentImpl.java:102)
> 

Well, you shouldn't have to monkey with the generated code like that.
If it wasn't generated correctly you need to look into why that's
happening.  The ClassCastException may just be another side effect of
incorrectly generated code.

Another possibility is to make sure the client has
schemaorg_apache_xmlbeans available in its classpath.  This should be
produced from the xmlbeans compiler.  I'm no expert but I think the
XmlAnyType is what xmlbeans uses when it can't map an xml doc to a
schema and thus a bean type.  Which suggests the client may not have
these in its classpath (even if they're physically present on the
client).  But if it's in the root of the client jar and you're running
this from the jar then that should be sufficient.

Also, maybe consider using the latest version of XmlBeans if possible.
I've been using v2.5.0 so I may be talking apples to your oranges.

> 
> 
> Regards,
> Sascha
> 
> 
> 
> On Mon, Nov 26, 2012 at 12:09 PM, Tim Watts <t...@cliftonfarm.org> wrote:
> > On Mon, 2012-11-26 at 08:37 +0100, moh.sushi wrote:
> >> Hello together,
> >>
> >> i have a problem with using xmlbeans.
> >> Following situation is given.
> >>
> >> - remote wsdl available (see http://pastebin.com/5qnFScMx)
> >> - code generation using axis2 and databinding xmlbeans
> >>
> >> i can do a request and i get a response, too.
> >>
> >> The problem is while iterating through given response.
> >> I just want to get part of the response with xmlbeans therefore i post
> >> the question on this mailing list.
> >>
> >> this is toString-ouput of the response:
> >>
> >> (1)
> >> <GetImageURLResponse xmlns="https://recettage.ria.neopod.fm-ged.com/ws";
> >>       xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
> >>       xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> >>       xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
> >>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
> >>       <return>
> >>               <CODE_ORDER>xyz</CODE_ORDER>
> >>               <PICTURES>
> >>                       <item>
> >>                               <OCD>2011-10-20</OCD>
> >>                               <PICTURE_ID>1</PICTURE_ID>
> >>                               <URL>https://host.fr/images/1.jpg</URL>
> >>                               <SCAN_DATE>2011-11-18</SCAN_DATE>
> >>                       </item>
> >>                       <item>
> >>                               <OCD>2011-10-20</OCD>
> >>                               <PICTURE_ID>2</PICTURE_ID>
> >>                               <URL>https://host.fr/images/2.jpg</URL>
> >>                               <SCAN_DATE>2011-10-31</SCAN_DATE>
> >>                       </item>
> >>                       <item>
> >>                               <OCD>2011-10-20</OCD>
> >>                               <PICTURE_ID>3</PICTURE_ID>
> >>                               <URL>https://host.fr/images/3.jpg</URL>
> >>                               <SCAN_DATE>2011-11-18</SCAN_DATE>
> >>                       </item>
> >>               </PICTURES>
> >>       </return>
> >> </GetImageURLResponse>
> >>
> >> the toString output of the return fragement
> >> (2)
> >> <xml-fragment xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
> >> xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> >> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> >> xmlns:ws="https://recettage.ria.neopod.fm-ged.com/ws";>
> >>       <ws:return>
> >>               <ws:CODE_ORDER>yxz</ws:CODE_ORDER>
> >>               <ws:PICTURES>
> >>                       <ws:item>
> >>                               <ws:OCD>2011-10-20</ws:OCD>
> >>                               <ws:PICTURE_ID>1</ws:PICTURE_ID>
> >>                               <ws:URL>https://host.fr/images/1.jpg</ws:URL>
> >>                               <ws:SCAN_DATE>2011-11-18</ws:SCAN_DATE>
> >>                       </ws:item>
> >>                       <ws:item>
> >>                               <ws:OCD>2011-10-20</ws:OCD>
> >>                               <ws:PICTURE_ID>2</ws:PICTURE_ID>
> >>                               <ws:URL>https://host.fr/images/2.jpg</ws:URL>
> >>                               <ws:SCAN_DATE>2011-10-31</ws:SCAN_DATE>
> >>                       </ws:item>
> >>                       <ws:item>
> >>                               <ws:OCD>2011-10-20</ws:OCD>
> >>                               <ws:PICTURE_ID>3</ws:PICTURE_ID>
> >>                               <ws:URL>https://host.fr/images/3.jpg</ws:URL>
> >>                               <ws:SCAN_DATE>2011-11-18</ws:SCAN_DATE>
> >>                       </ws:item>
> >>               </ws:PICTURES>
> >>       </ws:return>
> >> </xml-fragment>
> >>
> >>
> >> Following code snippet i use:
> >> fully object "GetImageURLResponseDocument response" is given  (see 1)
> >> GetImageURLResponse imageResponse = response.getGetImageURLResponse();  
> >> (see 2)
> >> Order order = imageResponse.getReturn();  <==  null returns
> >>
> >> method body of "getReturn" is :
> >>         public com.fm_ged.neopod.ria.recettage.ws.Order getReturn()
> >>         {
> >>             synchronized (monitor())
> >>             {
> >>                 check_orphaned();
> >>                 com.fm_ged.neopod.ria.recettage.ws.Order target = null;
> >>                 target =
> >> (com.fm_ged.neopod.ria.recettage.ws.Order)get_store().find_element_user(RETURN$0,
> >> 0);   <= nothing is found therefore null
> >>                 if (target == null)
> >>                 {
> >>                     return null;
> >>                 }
> >>                 return target;
> >>             }
> >>         }
> >>
> >> The variable "RETURN$0" is:
> >>         private static final javax.xml.namespace.QName RETURN$0 = new
> >> javax.xml.namespace.QName("", "return");
> >>
> >
> > I think you need to use "https://recettage.ria.neopod.fm-ged.com/ws"; in
> > the first QName arg above.
> >
> >> i use
> >> Axis 1.6.0
> >> xmlbeans-2.3.0.jar
> >>
> >> What is going wrong?
> >> Is the server response maybe wrong?
> >> Something wrong on my client side?
> >>
> >> Any help is appreciated!
> >>
> >> Thanks in advance!
> >>
> >>
> >> Regards,
> >> Sascha
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
> >> For additional commands, e-mail: user-h...@xmlbeans.apache.org
> >>
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
> For additional commands, e-mail: user-h...@xmlbeans.apache.org
> 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to