You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Dan Leahu <da...@gmail.com> on 2008/08/12 21:16:40 UTC

Axis2 array wrappers

Hi,

    I've an axis2 web service that has the following structure:

       1. name
       2. surname
       3. Phone[] phone

    The problem here is that when I want to see a response from this 
service it always gives me something like this:

<ns:sayHelloWorldFromResponse>
<ns:return type="example.Person">
<ns:arr type="example.Phone">
<ns:id>100</ns:id>
<ns:nr>0421</ns:nr>
</ns:arr>
<ns:arr type="example.Phone">
<ns:id>200</ns:id>
<ns:nr>1234</ns:nr>
</ns:arr>
<ns:name>xaas</ns:name>
<ns:surname>xa1</ns:surname>
</ns:return>
</ns:sayHelloWorldFromResponse>


The problem with this is when I want to use this service from a VBA 
client. The code on the VBA side is generated correctly but when I run 
it it always takes only the first element in the array of Phone. I've 
tried with another web 
service(http://euro2008.dataaccess.eu/footballpoolwebservice.wso/AllGames) 
and this one works correctly since the response is like this:

<ArrayOftGamesInfo>
    <tGamesInfo>
        <iId>1</iId>
        <sDescription>Round 1</sDescription>
        <dPlayDate>2008-06-07</dPlayDate>
        <tPlayTime>18:00:00</tPlayTime>
        <Cards>
          <card>
             ....
          </card>
        </Cards>
    <tGamesInfo>
    <tGamesInfo>
        <iId>1</iId>
        <sDescription>Round 1</sDescription>
        <dPlayDate>2008-06-07</dPlayDate>
        <tPlayTime>18:00:00</tPlayTime>
    <tGamesInfo>
</ArrayOftGamesInfo>

The idea is that somehow the guys that written the euro2008 web 
services, managed to return the arrays having a parent element, e.g. 
ArrayOfGamesInfo, Cards.

Any idea how could I make Axis2 return arrays in this way - having a 
parent element that wraps them?

Thanks a lot,

    Dan.

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


Re: Axis2 array wrappers

Posted by Detelin Yordanov <de...@gmail.com>.
Hi,
  Afaik .Net web services do this array wrapping, unfortunately Axis2 does
not work that way.
However, if changing the code is not a problem you can try creating a custom
class "ArrayOfPhones" that contains a Phone[] field and use that instead.

Regards,
   Detelin

On Tue, Aug 12, 2008 at 10:16 PM, Dan Leahu <da...@gmail.com> wrote:

> Hi,
>
>   I've an axis2 web service that has the following structure:
>
>      1. name
>      2. surname
>      3. Phone[] phone
>
>   The problem here is that when I want to see a response from this service
> it always gives me something like this:
>
> <ns:sayHelloWorldFromResponse>
> <ns:return type="example.Person">
> <ns:arr type="example.Phone">
> <ns:id>100</ns:id>
> <ns:nr>0421</ns:nr>
> </ns:arr>
> <ns:arr type="example.Phone">
> <ns:id>200</ns:id>
> <ns:nr>1234</ns:nr>
> </ns:arr>
> <ns:name>xaas</ns:name>
> <ns:surname>xa1</ns:surname>
> </ns:return>
> </ns:sayHelloWorldFromResponse>
>
>
> The problem with this is when I want to use this service from a VBA client.
> The code on the VBA side is generated correctly but when I run it it always
> takes only the first element in the array of Phone. I've tried with another
> web service(
> http://euro2008.dataaccess.eu/footballpoolwebservice.wso/AllGames) and
> this one works correctly since the response is like this:
>
> <ArrayOftGamesInfo>
>   <tGamesInfo>
>       <iId>1</iId>
>       <sDescription>Round 1</sDescription>
>       <dPlayDate>2008-06-07</dPlayDate>
>       <tPlayTime>18:00:00</tPlayTime>
>       <Cards>
>         <card>
>            ....
>         </card>
>       </Cards>
>   <tGamesInfo>
>   <tGamesInfo>
>       <iId>1</iId>
>       <sDescription>Round 1</sDescription>
>       <dPlayDate>2008-06-07</dPlayDate>
>       <tPlayTime>18:00:00</tPlayTime>
>   <tGamesInfo>
> </ArrayOftGamesInfo>
>
> The idea is that somehow the guys that written the euro2008 web services,
> managed to return the arrays having a parent element, e.g. ArrayOfGamesInfo,
> Cards.
>
> Any idea how could I make Axis2 return arrays in this way - having a parent
> element that wraps them?
>
> Thanks a lot,
>
>   Dan.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>