cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: How to use the generated classes
Date Mon, 03 Nov 2008 20:41:35 GMT

That explains quite a bit.   That message is not valid according to the 
schema.

      <s:element name="GetObjectResponse"> 
        <s:complexType> 
          <s:sequence> 
            <s:element minOccurs="0" maxOccurs="1" name="GetObjectResult"> 
              <s:complexType> 
                <s:sequence> 
                  <s:any namespace="http:/Fast3k/Services/fast3kObject.xsd" /> 
                </s:sequence> 
              </s:complexType> 
            </s:element> 
          </s:sequence> 
        </s:complexType> 
      </s:element> 

The GetObjectResponse object is allowed at most a single "GetObjectResult" 
child element, which does match. The GetObjectResult element can only have a 
SINGLE child element, and it's namespace must be 
http:/Fast3k/Services/fast3kObject.xsd.     Your message has two child 
elements.   The first is a "xs:schema" element, the second is 
a "diffgr:diffgram" element.   Neither properly matches.

Dan



On Monday 03 November 2008 3:34:40 pm Roland Carlsson wrote:
> For reference I post a response-message that I get when calling the
> webservice though soupui.
>
> //Roland
>
> 2008/11/3 Roland Carlsson <buurdb@gmail.com>
>
> > Thanks for your reply. I added your suggestion to the
> > Fast3KObjectSoap_Fast3KObjectSoap_Client (see code  and output below) .
> > Unfortunally the "any" object can't be cast to an EstateObject. Is the
> > problem with the wsdl? The webservice is created with MS Visual Studio.
> >
> > Thanks in advance
> > Roland
> >
> > ----------- code
> > Fast3KObject ss = new Fast3KObject(wsdlURL, SERVICE_NAME);
> > Fast3KObjectSoap port = ss.getFast3KObjectSoap();
> >
> >  {
> > System.out.println("Invoking getObject...");
> > java.lang.String _getObject_objectNo = "547200";
> > se.redpill.alfresco.module.jkp.wsclient.fast3k.GetObjectResponse.GetObjec
> >tResult _getObject__return = port.getObject(_getObject_objectNo);
> > System.out.println("getObject.result=" + _getObject__return);
> > System.out.println("any=" + _getObject__return.any);
> > EstateObject estateObject = (EstateObject)_getObject__return.getAny();
> > System.out.println(estateObject);
> > }
> >
> > -------------- output
> > 2008-nov-03 21:09:38 org.apache.cxf.bus.spring.BusApplicationContext
> > getConfigResources
> > INFO: No cxf.xml configuration file detected, relying on defaults.
> > Invoking getObject...
> >
> > getObject.result=se.redpill.alfresco.module.jkp.wsclient.fast3k.GetObject
> >Response$GetObjectResult@783859 any=[diffgr:diffgram: null]
> > Exception in thread "main" java.lang.ClassCastException:
> > com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to
> > se.redpill.alfresco.module.jkp.wsclient.fast3k.EstateObject
> >         at
> > se.redpill.alfresco.module.jkp.wsclient.fast3k.Fast3KObjectSoap_Fast3KObj
> >ectSoap_Client.main(Fast3KObjectSoap_Fast3KObjectSoap_Client.java:52)
> >
> >
> > 2008/11/3 Daniel Kulp <dkulp@apache.org>
> >
> >> Not seeing the actual soap message, it's hard to say, but most likely,
> >> you would do:
> >>
> >> EstateObject obj = (EstateObject)result.getAny();
> >>
> >> Your schema doesn't "type" the data in the GetObjectResult.   It uses
> >> an "xs:any".   The code generators map that to an "Object", but at
> >> runtime,
> >> it should be castable into the EstateObject.
> >>
> >> The getAny() call MAY return a JAXBElement that holds the EstateObject.
> >> Not
> >> really sure.   You would need to try it and see.
> >>
> >> Dan
> >>
> >> On Friday 31 October 2008 11:46:53 am Roland Carlsson wrote:
> >> > Hi Glen!
> >> >
> >> > I have generated java-files with wsdl2java (see attached wsdl files).
> >> >
> >> > The generated files (also attached) allows me to call the webservice
> >> > (successfully as far as I can see).
> >> > The generated files does not allow me to get any of the content that
> >> > the webservice generates.
> >> >
> >> > How am I supposed to get the values that the webservice return? Am I
> >> > not supposed to use the EstateObject (se attached zipfile) to access
> >> > the returned object from the webservice?
> >> >
> >> > Is it so that wsdl2java can't handle the wsdl?
> >> > Is it so that something is wrong with the wsdl?
> >> >
> >> > The link about wrapper/non-wrapper i didn't understand. Shouldn't
> >>
> >> wsdl2java
> >>
> >> > handle this for me?
> >> >
> >> > Best regards
> >> > Roland
> >> >
> >> >
> >> >
> >> >
> >> > 2008/10/31 Glen Mazza <glen.mazza@gmail.com>
> >> >
> >> > > If I understand your problem correctly (and I may be quite wrong
> >>
> >> here),
> >>
> >> > > you have a JAXB object called "Human" that has a String property
> >> > > (variable) called "Name".  You want to work with Human objects but
> >> > > the web service calls are just giving you names instead.
> >> > >
> >> > > You can probably just create a Human object and initialize it with
> >> > > the name variable that the web service call is returning, if you
> >> > > wish.
> >> > >
> >> > > I would also look more at the wrapper/non-wrapper discussion here:
> >>
> >> http://cwiki.apache.org/CXF20DOC/wsdl-to-java.html#WSDLtoJava-wrappersty
> >>l
> >>
> >> > >e
> >> > >
> >> > > HTH,
> >> > > Glen
> >> > >
> >> > > Roland Carlsson-5 wrote:
> >> > > > _getObject_return is not an EstateObject and gives me no way
of
> >>
> >> getting
> >>
> >> > > > the
> >> > > > EstateObject. Wsdl2java has generated an class called
> >> > > > EstateObject.
> >>
> >> But
> >>
> >> > > > how
> >> > > > am I supposed to get an instance of it?
> >> > > >
> >> > > > Three questions:
> >> > > > 1) Is there anything wrong with the wsdl that could cause
> >> > > > wsdl2java
> >>
> >> go
> >>
> >> > > > banans?
> >> > > > 2) Is there anything wrong with wsdl2java?
> >> > > > 3) Is there anything I have missed, if so please complete the
> >> > > > above example
> >> > > > with the line of code missing.
> >> > >
> >> > > --
> >> > > View this message in context:
> >>
> >> http://www.nabble.com/How-to-use-the-generated-classes-tp20260653p202662
> >>1
> >>
> >> > >9.html Sent from the cxf-user mailing list archive at Nabble.com.
> >>
> >> --
> >> Daniel Kulp
> >> dkulp@apache.org
> >> http://dankulp.com/blog



-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Mime
View raw message