You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Doug Price <Do...@presagis.com> on 2009/10/16 20:41:03 UTC

generating wsdl for complex return types

I was able to get a simple web service running w/ Axis2/C using the approach shown here<http://wso2.org/library/3534>, which creates a WSDL file from a Java interface using the Axis2 java2wsdl and then uses the WSDL file to create the C skeleton and stubs using wsdl2c.  So far so good.  Now I'd like to create a more sophisticated interface.  For example, what if I need to return multiple values, or a list of objects?

For example, let's say I have some data that represents a user (e.g. name, password, id, etc.) and my service has two methods getUser and getActiveUsers.  The first would return the data for the user w/ the given id and the second would return the data for all users that are currently logged onto the system.  I'd expect the SOAP responses to be something like the following:

<getUserResponse>
    <User>
        <name>fred</name>
        ...
    </User>
</getUserResponse>

< getActiveUsersResponse>
    <User>
        <name>fred</name>
        ...
    </User>
    <User>
        <name>barney</name>
        ...
    </User>
</ getActiveUsersResponse>

How do I write the Java interface to produce such a result w/ java2wsdl?  I would have hoped something like the following would have done it, but that WSDL generated seems like it wants to pass the object reference instead.  Any help would be greatly appreciated.

class User {
    string name;
    ...
}

interface MyInterface {
    public User getUser(int id);
    public User [] getActiveUsers();
}


--
Doug Price
Research Director | Presagis

T. +1 972 943.2433 F. +1 469 467.4564 C. +1 469 867.8399

DISCLAIMER: This e-mail message is for the sole use of the intended recipient(s) and may contain confidential and/or proprietary information. Do not read, copy, or disseminate this message unless you are the addressee. Any unauthorized review, use, disclosure or distribution is strictly prohibited. If you have received this message in error, please contact the sender by reply e-mail and delete the original and any copies from your system.


RE: generating wsdl for complex return types

Posted by Doug Price <Do...@presagis.com>.
Thanks for the tip.  The book sounds like a good investment.


--
Doug Price
Research Director | Presagis

T. +1 972 943.2433 F. +1 469 467.4564 C. +1 469 867.8399

DISCLAIMER: This e-mail message is for the sole use of the intended recipient(s) and may contain confidential and/or proprietary information. Do not read, copy, or disseminate this message unless you are the addressee. Any unauthorized review, use, disclosure or distribution is strictly prohibited. If you have received this message in error, please contact the sender by reply e-mail and delete the original and any copies from your system.

From: Sam Carleton [mailto:scarleton@gmail.com]
Sent: Friday, October 16, 2009 2:05 PM
To: Apache AXIS C User List
Subject: Re: generating wsdl for complex return types

Doug,

A basic WSDL is by no means simple.  There are a number of different concepts that are captured in a complete WSDL document.  I am not a big fan of buying books anymore, but the Developing Web Services with Apache Axis2<http://bit.ly/JcZxs> was VERY helpful in getting me jump started in the world of Axis2/C.  The book focuses on Axis2/Java, but it does a wonderful job of explaining the basics of WSDL and show how to use the GUI editor in Eclipse to create and edit them.  The best part of the book is that it is NOT wordy!!!!  Now when I edit my Axis2/C WSDL's, I simply edit the XML directly.

Sam

On Fri, Oct 16, 2009 at 2:41 PM, Doug Price <Do...@presagis.com>> wrote:
I was able to get a simple web service running w/ Axis2/C using the approach shown here<http://wso2.org/library/3534>, which creates a WSDL file from a Java interface using the Axis2 java2wsdl and then uses the WSDL file to create the C skeleton and stubs using wsdl2c.  So far so good.  Now I’d like to create a more sophisticated interface.  For example, what if I need to return multiple values, or a list of objects?

For example, let’s say I have some data that represents a user (e.g. name, password, id, etc.) and my service has two methods getUser and getActiveUsers.  The first would return the data for the user w/ the given id and the second would return the data for all users that are currently logged onto the system.  I’d expect the SOAP responses to be something like the following:

<getUserResponse>
    <User>
        <name>fred</name>
        …
    </User>
</getUserResponse>

< getActiveUsersResponse>
    <User>
        <name>fred</name>
        …
    </User>
    <User>
        <name>barney</name>
        …
    </User>
</ getActiveUsersResponse>

How do I write the Java interface to produce such a result w/ java2wsdl?  I would have hoped something like the following would have done it, but that WSDL generated seems like it wants to pass the object reference instead.  Any help would be greatly appreciated.

class User {
    string name;
    …
}

interface MyInterface {
    public User getUser(int id);
    public User [] getActiveUsers();
}


--
Doug Price
Research Director | Presagis

T. +1 972 943.2433 F. +1 469 467.4564 C. +1 469 867.8399

DISCLAIMER: This e-mail message is for the sole use of the intended recipient(s) and may contain confidential and/or proprietary information. Do not read, copy, or disseminate this message unless you are the addressee. Any unauthorized review, use, disclosure or distribution is strictly prohibited. If you have received this message in error, please contact the sender by reply e-mail and delete the original and any copies from your system.




Re: generating wsdl for complex return types

Posted by Sam Carleton <sc...@gmail.com>.
Doug,
A basic WSDL is by no means simple.  There are a number of different
concepts that are captured in a complete WSDL document.  I am not a big fan
of buying books anymore, but the Developing Web Services with Apache
Axis2<http://bit.ly/JcZxs> was
VERY helpful in getting me jump started in the world of Axis2/C.  The book
focuses on Axis2/Java, but it does a wonderful job of explaining the basics
of WSDL and show how to use the GUI editor in Eclipse to create and edit
them.  The best part of the book is that it is NOT wordy!!!!  Now when I
edit my Axis2/C WSDL's, I simply edit the XML directly.

Sam


On Fri, Oct 16, 2009 at 2:41 PM, Doug Price <Do...@presagis.com> wrote:

>   I was able to get a simple web service running w/ Axis2/C using the
> approach shown here <http://wso2.org/library/3534>, which creates a WSDL
> file from a Java interface using the Axis2 java2wsdl and then uses the WSDL
> file to create the C skeleton and stubs using wsdl2c.  So far so good.  Now
> I’d like to create a more sophisticated interface.  For example, what if I
> need to return multiple values, or a list of objects?
>
>
>
> For example, let’s say I have some data that represents a user (e.g. name,
> password, id, etc.) and my service has two methods getUser and
> getActiveUsers.  The first would return the data for the user w/ the given
> id and the second would return the data for all users that are currently
> logged onto the system.  I’d expect the SOAP responses to be something like
> the following:
>
>
>
> <getUserResponse>
>
>     <User>
>
>         <name>fred</name>
>
>         …
>
>     </User>
>
> </getUserResponse>
>
>
>
> < getActiveUsersResponse>
>
>     <User>
>
>         <name>fred</name>
>
>         …
>
>     </User>
>
>     <User>
>
>         <name>barney</name>
>
>         …
>
>     </User>
>
> </ getActiveUsersResponse>
>
>
>
> How do I write the Java interface to produce such a result w/ java2wsdl?  I
> would have hoped something like the following would have done it, but that
> WSDL generated seems like it wants to pass the object reference instead.
> Any help would be greatly appreciated.
>
>
>
> class User {
>
>     string name;
>
>     …
>
> }
>
>
>
> interface MyInterface {
>
>     public User getUser(int id);
>
>     public User [] getActiveUsers();
>
> }
>
>
>
>  --
> *Doug Price*
> Research Director | *Presagis*
>
> *T.* +1 972 943.2433 *F.* +1 469 467.4564 *C.* +1 469 867.8399
>
>
> DISCLAIMER: This e-mail message is for the sole use of the intended
> recipient(s) and may contain confidential and/or proprietary information. Do
> not read, copy, or disseminate this message unless you are the addressee.
> Any unauthorized review, use, disclosure or distribution is strictly
> prohibited. If you have received this message in error, please contact the
> sender by reply e-mail and delete the original and any copies from your
> system.
>
>
>