You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Scott Sauyet <li...@sauyet.com> on 2007/08/22 22:11:09 UTC

Using soap.encoding.Array

If this doesn't belong on this list, could someone kindly suggest a more 
appropriate list?  Thanks,  -- SS

I'm using Axis with XMLBeans as the client to an existing service, and 
everything is working fine until I try to get data from an array.  I get 
back an element of an interface extending

     org.xmlsoap.schemas.soap.encoding.Array

But this doesn't seem to let me get at the actual data inside the array. 
  Sniffing the SOAP messages assures me that there is in fact data being 
returned, but the API appears to offer me no way to retrieve it.  This 
must be a simple oversight on my part, but I've been staring at it too 
long without any insights.

Can someone explain how to get the elements of type MyClass from this 
array?  (More details are below.)

Thanks,

   -- Scott

More details:

The schema in the WSDL contains the following:

     <xs:complexType name="Event">
       <xs:sequence>
          <xs:element name="EventDateTime" type="xs:dateTime"/>
          <xs:element name="EventDescription" type="xs:string"/>
          <xs:element name="EventId" type="xs:long"/>
          <xs:element name="EventTitle" type="xs:string"/>
          <!-- many more fields -->
       </xs:sequence>
     </xs:complexType>

     <xs:complexType name="arEvent">
       <xs:complexContent>
         <xs:restriction base="soapenc:Array">
           <xs:sequence />
           <xs:attribute ref="soapenc:arrayType"
                         n1:arrayType="ro:Event[]"
                         xmlns:n1="http://schemas.xmlsoap.org/wsdl/"
           />
         </xs:restriction>
       </xs:complexContent>
     </xs:complexType>

toString() on the resulting ArEvent object looks like this:

     <xml-fragment
             xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:HNS="http://tempuri.org/"
             xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:dat="Databox"
     >
       <dat:Event>
         <dat:EventDateTime>2005-05-20T20:00:00</dat:EventDateTime>
         <dat:EventDescription>Description here</dat:EventDescription>
         <dat:EventId>1</dat:EventId>
         <dat:EventTitle>The title</dat:EventTitle>
         <!-- more fields -->
       </dat:Event>
       <dat:Event>
         <dat:EventDateTime>2005-05-20T20:00:00</dat:EventDateTime>
         <dat:EventDescription>Description field</dat:EventDescription>
         <dat:EventId>6</dat:EventId>
         <dat:EventTitle>Test event One</dat:EventTitle>
       </dat:Event>
       <!-- many more events -->
     </xml-fragment>

So the data is clearly there.  And the class representing the Event is 
created by the WSDL2Java tool.  I just can't figure out how to get at it.

Thanks again.



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


Re: Using soap.encoding.Array

Posted by Scott Sauyet <li...@sauyet.com>.
Scott Sauyet wrote:
> Thanks for your help.  I'm still frustrated, but I think I'll go take 
> that out on the vendor! :-)

I did, and was told that it's a problem that was fixed this week and 
will be in next weekend's build.  With their help, I was able to 
temporarily work around it.

Thank you very much for your help.

   -- Scott


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


Re: Using soap.encoding.Array

Posted by Scott Sauyet <li...@sauyet.com>.
Jacob,

Thanks for your help.  I'm still frustrated, but I think I'll go take 
that out on the vendor! :-)

   -- Scott

Jacob Danner wrote:
> Interesting, usually when I've seen soap encoding its been for RPC based WSDL.
> The way I've seen doc/literal arrays declared is with something like:
> <xs:element name="someName" type="xs:int" minOccurs="0" maxOccurs="unbounded" />

I've been told elsewhere that this is pretty much a hard rule.  It looks 
like the vendor's idea of doc/lit is a bit off.  I will follow up with 
the vendor on that.

> Can you post some of the code you are using to walk to XML?

Apache Axis is supposed to be doing that for me...  I'm not looking at 
the XML directly.  This whole exercise was an attempt to get from the 
SOAP coming from our site, but through a third-party tool, into Java 
objects in some straightforward manner.  It's been pretty frustrating.

> In answer to your original question:
> Can someone explain how to get the elements of type MyClass from this
> array?
> I would assume its something like
> ArEvent.getEvent()[index].getEventDateTime();
> 
> Is that not working for you?

No such method is in the generated class.  In fact the generated class 
does not add anything to the underlying Array class except for a static 
Factory class containing several newInstance() variations and a large 
number of parse() methods all returning an instance of this Array subclass.

There is also a Factory class in the generated Event class.  This 
factory class has many parse methods taking Streams, Readers, Strings, 
Files, URLs, and Nodes, each one returning an instance of the class.  So 
there may be some way to walk the XML that is returned to get the 
elements.  But these tools were supposed to let me avoid that!  I could 
probably walk the SOAP document too, but I really don't want to.  ;-)

Again, thanks for your help,

   -- Scott


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


Re: Using soap.encoding.Array

Posted by Jacob Danner <ja...@gmail.com>.
Interesting, usually when I've seen soap encoding its been for RPC based WSDL.
The way I've seen doc/literal arrays declared is with something like:
<xs:element name="someName" type="xs:int" minOccurs="0" maxOccurs="unbounded" />

with that maxOccurs attribute turning whatever someName would be to an
array whenever the value is >1.

Can you post some of the code you are using to walk to XML?

In answer to your original question:
Can someone explain how to get the elements of type MyClass from this
array?
I would assume its something like
ArEvent.getEvent()[index].getEventDateTime();

Is that not working for you?

Thanks,
-Jacobd

On 8/22/07, Scott Sauyet <li...@sauyet.com> wrote:
> Jacob Danner wrote:
> > Is the WSDL rpc/encoded?
> > -Jacob Danner
>
> No, it's document/literal, at least it's supposed to be.  :-)
>
> The vendor tool which runs the server has recently been updated to
> support doc/lit; and there may be problems with it...
>
>    -- Scott
>
> > On 8/22/07, Scott Sauyet <li...@sauyet.com> wrote:
> >> If this doesn't belong on this list, could someone kindly suggest a more
> >> appropriate list?  Thanks,  -- SS
> >>
> >> I'm using Axis with XMLBeans as the client to an existing service, and
> >> everything is working fine until I try to get data from an array.  I get
> >> back an element of an interface extending
> >>
> >>      org.xmlsoap.schemas.soap.encoding.Array
> >>
> >> But this doesn't seem to let me get at the actual data inside the array.
> >>   Sniffing the SOAP messages assures me that there is in fact data being
> >> returned, but the API appears to offer me no way to retrieve it.  This
> >> must be a simple oversight on my part, but I've been staring at it too
> >> long without any insights.
> >>
> >> Can someone explain how to get the elements of type MyClass from this
> >> array?  (More details are below.)
> >>
> >> Thanks,
> >>
> >>    -- Scott
> >>
> >> More details:
> >>
> >> The schema in the WSDL contains the following:
> >>
> >>      <xs:complexType name="Event">
> >>        <xs:sequence>
> >>           <xs:element name="EventDateTime" type="xs:dateTime"/>
> >>           <xs:element name="EventDescription" type="xs:string"/>
> >>           <xs:element name="EventId" type="xs:long"/>
> >>           <xs:element name="EventTitle" type="xs:string"/>
> >>           <!-- many more fields -->
> >>        </xs:sequence>
> >>      </xs:complexType>
> >>
> >>      <xs:complexType name="arEvent">
> >>        <xs:complexContent>
> >>          <xs:restriction base="soapenc:Array">
> >>            <xs:sequence />
> >>            <xs:attribute ref="soapenc:arrayType"
> >>                          n1:arrayType="ro:Event[]"
> >>                          xmlns:n1="http://schemas.xmlsoap.org/wsdl/"
> >>            />
> >>          </xs:restriction>
> >>        </xs:complexContent>
> >>      </xs:complexType>
> >>
> >> toString() on the resulting ArEvent object looks like this:
> >>
> >>      <xml-fragment
> >>              xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> >>              xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >>              xmlns:HNS="http://tempuri.org/"
> >>              xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> >>              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >>              xmlns:dat="Databox"
> >>      >
> >>        <dat:Event>
> >>          <dat:EventDateTime>2005-05-20T20:00:00</dat:EventDateTime>
> >>          <dat:EventDescription>Description here</dat:EventDescription>
> >>          <dat:EventId>1</dat:EventId>
> >>          <dat:EventTitle>The title</dat:EventTitle>
> >>          <!-- more fields -->
> >>        </dat:Event>
> >>        <dat:Event>
> >>          <dat:EventDateTime>2005-05-20T20:00:00</dat:EventDateTime>
> >>          <dat:EventDescription>Description field</dat:EventDescription>
> >>          <dat:EventId>6</dat:EventId>
> >>          <dat:EventTitle>Test event One</dat:EventTitle>
> >>        </dat:Event>
> >>        <!-- many more events -->
> >>      </xml-fragment>
> >>
> >> So the data is clearly there.  And the class representing the Event is
> >> created by the WSDL2Java tool.  I just can't figure out how to get at it.
> >>
> >> Thanks again.
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> >> For additional commands, e-mail: user-help@xmlbeans.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> > For additional commands, e-mail: user-help@xmlbeans.apache.org
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>

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


Re: Using soap.encoding.Array

Posted by Scott Sauyet <li...@sauyet.com>.
Jacob Danner wrote:
> Is the WSDL rpc/encoded?
> -Jacob Danner

No, it's document/literal, at least it's supposed to be.  :-)

The vendor tool which runs the server has recently been updated to 
support doc/lit; and there may be problems with it...

   -- Scott

> On 8/22/07, Scott Sauyet <li...@sauyet.com> wrote:
>> If this doesn't belong on this list, could someone kindly suggest a more
>> appropriate list?  Thanks,  -- SS
>>
>> I'm using Axis with XMLBeans as the client to an existing service, and
>> everything is working fine until I try to get data from an array.  I get
>> back an element of an interface extending
>>
>>      org.xmlsoap.schemas.soap.encoding.Array
>>
>> But this doesn't seem to let me get at the actual data inside the array.
>>   Sniffing the SOAP messages assures me that there is in fact data being
>> returned, but the API appears to offer me no way to retrieve it.  This
>> must be a simple oversight on my part, but I've been staring at it too
>> long without any insights.
>>
>> Can someone explain how to get the elements of type MyClass from this
>> array?  (More details are below.)
>>
>> Thanks,
>>
>>    -- Scott
>>
>> More details:
>>
>> The schema in the WSDL contains the following:
>>
>>      <xs:complexType name="Event">
>>        <xs:sequence>
>>           <xs:element name="EventDateTime" type="xs:dateTime"/>
>>           <xs:element name="EventDescription" type="xs:string"/>
>>           <xs:element name="EventId" type="xs:long"/>
>>           <xs:element name="EventTitle" type="xs:string"/>
>>           <!-- many more fields -->
>>        </xs:sequence>
>>      </xs:complexType>
>>
>>      <xs:complexType name="arEvent">
>>        <xs:complexContent>
>>          <xs:restriction base="soapenc:Array">
>>            <xs:sequence />
>>            <xs:attribute ref="soapenc:arrayType"
>>                          n1:arrayType="ro:Event[]"
>>                          xmlns:n1="http://schemas.xmlsoap.org/wsdl/"
>>            />
>>          </xs:restriction>
>>        </xs:complexContent>
>>      </xs:complexType>
>>
>> toString() on the resulting ArEvent object looks like this:
>>
>>      <xml-fragment
>>              xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
>>              xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>              xmlns:HNS="http://tempuri.org/"
>>              xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
>>              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>              xmlns:dat="Databox"
>>      >
>>        <dat:Event>
>>          <dat:EventDateTime>2005-05-20T20:00:00</dat:EventDateTime>
>>          <dat:EventDescription>Description here</dat:EventDescription>
>>          <dat:EventId>1</dat:EventId>
>>          <dat:EventTitle>The title</dat:EventTitle>
>>          <!-- more fields -->
>>        </dat:Event>
>>        <dat:Event>
>>          <dat:EventDateTime>2005-05-20T20:00:00</dat:EventDateTime>
>>          <dat:EventDescription>Description field</dat:EventDescription>
>>          <dat:EventId>6</dat:EventId>
>>          <dat:EventTitle>Test event One</dat:EventTitle>
>>        </dat:Event>
>>        <!-- many more events -->
>>      </xml-fragment>
>>
>> So the data is clearly there.  And the class representing the Event is
>> created by the WSDL2Java tool.  I just can't figure out how to get at it.
>>
>> Thanks again.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
>> For additional commands, e-mail: user-help@xmlbeans.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 
> 
> 



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


Re: Using soap.encoding.Array

Posted by Jacob Danner <ja...@gmail.com>.
Is the WSDL rpc/encoded?
-Jacob Danner

On 8/22/07, Scott Sauyet <li...@sauyet.com> wrote:
> If this doesn't belong on this list, could someone kindly suggest a more
> appropriate list?  Thanks,  -- SS
>
> I'm using Axis with XMLBeans as the client to an existing service, and
> everything is working fine until I try to get data from an array.  I get
> back an element of an interface extending
>
>      org.xmlsoap.schemas.soap.encoding.Array
>
> But this doesn't seem to let me get at the actual data inside the array.
>   Sniffing the SOAP messages assures me that there is in fact data being
> returned, but the API appears to offer me no way to retrieve it.  This
> must be a simple oversight on my part, but I've been staring at it too
> long without any insights.
>
> Can someone explain how to get the elements of type MyClass from this
> array?  (More details are below.)
>
> Thanks,
>
>    -- Scott
>
> More details:
>
> The schema in the WSDL contains the following:
>
>      <xs:complexType name="Event">
>        <xs:sequence>
>           <xs:element name="EventDateTime" type="xs:dateTime"/>
>           <xs:element name="EventDescription" type="xs:string"/>
>           <xs:element name="EventId" type="xs:long"/>
>           <xs:element name="EventTitle" type="xs:string"/>
>           <!-- many more fields -->
>        </xs:sequence>
>      </xs:complexType>
>
>      <xs:complexType name="arEvent">
>        <xs:complexContent>
>          <xs:restriction base="soapenc:Array">
>            <xs:sequence />
>            <xs:attribute ref="soapenc:arrayType"
>                          n1:arrayType="ro:Event[]"
>                          xmlns:n1="http://schemas.xmlsoap.org/wsdl/"
>            />
>          </xs:restriction>
>        </xs:complexContent>
>      </xs:complexType>
>
> toString() on the resulting ArEvent object looks like this:
>
>      <xml-fragment
>              xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
>              xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>              xmlns:HNS="http://tempuri.org/"
>              xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
>              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>              xmlns:dat="Databox"
>      >
>        <dat:Event>
>          <dat:EventDateTime>2005-05-20T20:00:00</dat:EventDateTime>
>          <dat:EventDescription>Description here</dat:EventDescription>
>          <dat:EventId>1</dat:EventId>
>          <dat:EventTitle>The title</dat:EventTitle>
>          <!-- more fields -->
>        </dat:Event>
>        <dat:Event>
>          <dat:EventDateTime>2005-05-20T20:00:00</dat:EventDateTime>
>          <dat:EventDescription>Description field</dat:EventDescription>
>          <dat:EventId>6</dat:EventId>
>          <dat:EventTitle>Test event One</dat:EventTitle>
>        </dat:Event>
>        <!-- many more events -->
>      </xml-fragment>
>
> So the data is clearly there.  And the class representing the Event is
> created by the WSDL2Java tool.  I just can't figure out how to get at it.
>
> Thanks again.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>

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