For reference I post a response-message that I get when calling the
webservice though soupui.

//Roland

2008/11/3 Roland Carlsson <[EMAIL PROTECTED]>

> 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.GetObjectResult
> _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...
>
> [EMAIL PROTECTED]
> 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_Fast3KObjectSoap_Client.main(Fast3KObjectSoap_Fast3KObjectSoap_Client.java:52)
>
>
> 2008/11/3 Daniel Kulp <[EMAIL PROTECTED]>
>
>
>> 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 <[EMAIL PROTECTED]>
>> >
>> > > 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-wrapperstyl
>> > >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-tp20260653p2026621
>> > >9.html Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Daniel Kulp
>> [EMAIL PROTECTED]
>> http://dankulp.com/blog
>>
>
>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
   <soap:Body>
      <GetObjectResponse xmlns="http://Fast3k//Services//fast3kObject";>
         <GetObjectResult>
            <xs:schema id="EstateObject" targetNamespace="http:/Fast3k/Services/fast3kObject.xsd" attributeFormDefault="qualified" elementFormDefault="qualified" xmlns:mstns="http:/Fast3k/Services/fast3kObject.xsd" xmlns="http:/Fast3k/Services/fast3kObject.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
               <xs:element name="EstateObject" msdata:IsDataSet="true" msdata:Locale="sv-SE">
                  <xs:complexType>
                     <xs:choice maxOccurs="unbounded">
                        <xs:element name="Object">
                           <xs:complexType>
                              <xs:sequence>
                                 <xs:element name="ObjectNo" type="xs:string" minOccurs="0"/>
                                 <xs:element name="PopDescr" type="xs:string" minOccurs="0"/>
                                 <xs:element name="Descr" type="xs:string" minOccurs="0"/>
                                 <xs:element name="RealEstate" minOccurs="0" maxOccurs="unbounded">
                                    <xs:annotation>
                                       <xs:appinfo>
                                          <msdata:Relationship name="Object_RealEstate" msdata:parent="Object" msdata:child="RealEstate" msdata:parentkey="ObjectNo" msdata:childkey="ObjectNo"/>
                                       </xs:appinfo>
                                    </xs:annotation>
                                    <xs:complexType>
                                       <xs:sequence>
                                          <xs:element name="ObjectNo" type="xs:string" minOccurs="0" msdata:Ordinal="0"/>
                                          <xs:element name="Descr" type="xs:string" minOccurs="0" msdata:Ordinal="1"/>
                                       </xs:sequence>
                                       <xs:attribute name="Object_Id" type="xs:int" use="prohibited"/>
                                    </xs:complexType>
                                 </xs:element>
                                 <xs:element name="EstateAddress" minOccurs="0" maxOccurs="unbounded">
                                    <xs:annotation>
                                       <xs:appinfo>
                                          <msdata:Relationship name="Object_EstateAddress" msdata:parent="Object" msdata:child="EstateAddress" msdata:parentkey="ObjectNo" msdata:childkey="ObjectNo"/>
                                       </xs:appinfo>
                                    </xs:annotation>
                                    <xs:complexType>
                                       <xs:sequence>
                                          <xs:element name="ObjectNo" type="xs:string" minOccurs="0" msdata:Ordinal="0"/>
                                          <xs:element name="AddressType" type="xs:string" minOccurs="0" msdata:Ordinal="1"/>
                                          <xs:element name="Street" type="xs:string" minOccurs="0" msdata:Ordinal="2"/>
                                          <xs:element name="PoBox" type="xs:string" minOccurs="0" msdata:Ordinal="3"/>
                                          <xs:element name="CoAdr" type="xs:string" minOccurs="0" msdata:Ordinal="4"/>
                                          <xs:element name="PostalCode" type="xs:string" minOccurs="0" msdata:Ordinal="5"/>
                                          <xs:element name="City" type="xs:string" minOccurs="0" msdata:Ordinal="6"/>
                                          <xs:element name="Country" type="xs:string" minOccurs="0" msdata:Ordinal="7"/>
                                       </xs:sequence>
                                       <xs:attribute name="Object_Id" type="xs:int" use="prohibited"/>
                                    </xs:complexType>
                                 </xs:element>
                              </xs:sequence>
                              <xs:attribute name="Object_Id" msdata:AutoIncrement="true" type="xs:int" msdata:AllowDBNull="false" use="prohibited"/>
                           </xs:complexType>
                        </xs:element>
                     </xs:choice>
                  </xs:complexType>
                  <xs:unique name="Constraint1" msdata:PrimaryKey="true">
                     <xs:selector xpath=".//mstns:Object"/>
                     <xs:field xpath="@mstns:Object_Id"/>
                  </xs:unique>
                  <xs:keyref name="Object_EstateAddress" refer="Constraint1" msdata:ConstraintOnly="true">
                     <xs:selector xpath=".//mstns:EstateAddress"/>
                     <xs:field xpath="@mstns:Object_Id"/>
                  </xs:keyref>
                  <xs:keyref name="Object_RealEstate" refer="Constraint1" msdata:ConstraintOnly="true">
                     <xs:selector xpath=".//mstns:RealEstate"/>
                     <xs:field xpath="@mstns:Object_Id"/>
                  </xs:keyref>
               </xs:element>
            </xs:schema>
            <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
               <EstateObject xmlns="http:/Fast3k/Services/fast3kObject.xsd">
                  <Object diffgr:id="Object1" msdata:rowOrder="0" msdata:hiddenObject_Id="0">
                     <ObjectNo>547200</ObjectNo>
                     <PopDescr>Attarpsskolan</PopDescr>
                     <Descr>Attarpsskolan, F-9/fth/fsk, Bibliotek Filial</Descr>
                     <RealEstate diffgr:id="RealEstate1" msdata:rowOrder="0">
                        <ObjectNo>547200</ObjectNo>
                        <Descr>ATTARP 2:230</Descr>
                     </RealEstate>
                     <EstateAddress diffgr:id="EstateAddress1" msdata:rowOrder="0">
                        <ObjectNo>547200</ObjectNo>
                        <AddressType>F2</AddressType>
                        <Street>ATTARPSVÄGEN 7</Street>
                        <Country>Sverige</Country>
                     </EstateAddress>
                     <EstateAddress diffgr:id="EstateAddress2" msdata:rowOrder="1">
                        <ObjectNo>547200</ObjectNo>
                        <AddressType>Belägenhetsadress</AddressType>
                        <Street>Attarpsvägen 7</Street>
                        <PostalCode>56433</PostalCode>
                        <City>Bankeryd</City>
                        <Country>Sverige</Country>
                     </EstateAddress>
                  </Object>
               </EstateObject>
            </diffgr:diffgram>
         </GetObjectResult>
      </GetObjectResponse>
   </soap:Body>
</soap:Envelope>

Reply via email to