Results 1 to 3 of 3
  1. #1
    dishachhabra is offline Member
    Join Date
    Nov 2010
    Rep Power

    Default How to use list data type in web services execution

    We have been using the primitive data types in java for web service execution. Now we want to add a List data type. Wats the way of giving soap input in case of list.The wsdl file is showing anytype if we use List type.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power


    If you hand carve your wsdl you won't have this problem.
    You should be defining your interface (the wsdl) before coding the Java.

  3. #3
    FON is offline Senior Member
    Join Date
    Dec 2009
    Belgrade, Serbia
    Rep Power


    Use some WSDL editor (Eclipse has one within) to do this.

    First create operations and messages.

    Then move on to your own wsdl:types.

    Here is example which will explain you concept of how to use your own Business Object and place them in data structures,
    so you can work with complex data in your web service calls:

    Let's say your client want to know names of all Cars models some Person have. Person has name, age and Car list.

    1. Create Entity (Cars)
    Create elements of Cars entity with types and cardinality:
    -manufacturer string [1..1]
    -name string [1..1 )

    2. Create Entity Person
    Create elements of Person entity with types and cardinality:
    -name string [1..1]
    -age int [1..1]
    -carsList Cars [0..*]

    All the time pay attention on WSDL src that is being created and new xsd:complexTypes.

    Now let's say you want to send a name of person to service,
    and get list of all car models that person has.

    When you generate a client form WSDL you notice all Complex type (entities) became Java classes that are serializable (and my Axis engine creates some static block with rules for cardinality....)

    So class Person has Array of cars:

    public class Person implements {

    private org.example.Cars[] carList;

    Use proxy to call your operation, hand it name of person.
    On server side there will be some logic to take that name, and iterate through all Cars array in it, extract of each one and place it into String[] carNames and send back in response to client.

    I know this is not exactly what you need but i gave you all crucial concepts and explanation how to model them,
    really hope this will help!

    TIP: Always try to keep communication between client and server as simple as you can - do not put much of your Business logic and objects on client side,
    in perfect world exchange only simple data types.

Similar Threads

  1. Replies: 10
    Last Post: 11-29-2010, 03:02 PM
  2. Web Services: Axis vs Metro vs Spring Web Services
    By davidbaker29 in forum Advanced Java
    Replies: 0
    Last Post: 01-28-2009, 12:20 PM
  3. Granite Data Services 1.1.0 RC3
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 07-19-2008, 05:16 PM
  4. Granite Data Services 1.1.0 RC1
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 04-26-2008, 09:30 PM
  5. List views, a type of object
    By Leprechaun in forum New To Java
    Replies: 2
    Last Post: 02-06-2008, 04:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts