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

    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
    Posts
    11,920
    Rep Power
    19

    Default

    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
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    368
    Rep Power
    5

    Default

    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 java.io.Serializable {
    ...

    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 Cars.name 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, 02: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, 11:20 AM
  3. Granite Data Services 1.1.0 RC3
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 07-19-2008, 04:16 PM
  4. Granite Data Services 1.1.0 RC1
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 04-26-2008, 08:30 PM
  5. List views, a type of object
    By Leprechaun in forum New To Java
    Replies: 2
    Last Post: 02-06-2008, 03: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
  •