Skip to Content
avatar image
Former Member

Web Service returning array of user defined objects not working from VC

I have written a web service in java which returns an array of user defined objects. When I test this web service using Netweaver's Developer Studio, Enterprise Portal perspective for Wsdl check, it all works fine.

I'm able to add this web service into VC but when I try to run it's test service (execute) I get an error "Portal request failed could not execute web service operation".

I tried out another web service which returns just a user defined object, this works fine in VC , problem occurs when I try to return an array of objects.

any help will be really appreciated

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Jan 04, 2007 at 07:23 PM

    See the Visual Composer WIKI FAQ:

    https://wiki.sdn.sap.com/wiki/display/VC/Connectivity

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Mario

      I have already checked the link you have mentioned. Although it states that VC complains if the return type is an array, I have got a web service WeatherForcast which does return a user defined array and in-turn has an array within which works fine.

      So still not sure if arrays are supported by VC now, if yes is there a particular format in which it expects the array content in the WSDL to be.

      Thanks

  • avatar image
    Former Member
    Jan 11, 2007 at 06:49 PM

    Hi Zeenie,

    Try to reduce the depth of your structure. So if your array is made up of say A objects which in turn are made up of B objects and so on and so on then try getting rid of one level or two.

    Regards,

    Allen

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 12, 2007 at 08:23 AM

    VC does not support Array structure.

    You have to change the input/return type so that the values can be passed back.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 15, 2007 at 11:05 AM

    Hi,

    VC Does support Array as input an output ports.

    I have created and tested many Web services that return an array of element and get an array of elements.

    Please look at the pasted source code:

    <b>example one:</b>

    public class RetrunStringArray {

    public String[] retrunStringArray(String[] output){

    return output ;

    }

    }

    <b>Example 2:</b>

    Person object:

    import java.util.*;

    public class Person {

    String name = "";

    String lastName = "" ;

    int phoneNumber ;

    Date dateOfBirth ;

    public Person(){}

    public void addPerson(String n, String ln, int ph, Date dBirth){

    this.name = n ;

    this.lastName = ln;

    this.phoneNumber = ph ;

    this.dateOfBirth = dBirth ;

    }

    /**

    • @return

    */

    public Date getDateOfBirth() {

    return dateOfBirth;

    }

    /**

    • @return

    */

    public String getLastName() {

    return lastName;

    }

    /**

    • @return

    */

    public String getName() {

    return name;

    }

    /**

    • @return

    */

    public int getPhoneNumber() {

    return phoneNumber;

    }

    /**

    • @param date

    */

    public void setDateOfBirth(Date date) {

    dateOfBirth = date;

    }

    /**

    • @param string

    */

    public void setLastName(String string) {

    lastName = string;

    }

    /**

    • @param string

    */

    public void setName(String string) {

    name = string;

    }

    /**

    • @param i

    */

    public void setPhoneNumber(int i) {

    phoneNumber = i;

    }

    <b>Example 2 this is the end point class:</b>

    public class Persons {

    public Persons(){}

    public Person[] addPersons(Person[] p){

    Person[] pArray= new Person[10] ;

    for(int i=0;i < p.length ; i++){

    Person p1 = new Person();

    p1.addPerson(p<i>.name,p<i>.lastName,p<i>.phoneNumber,p<i>.dateOfBirth);

    pArray<i> = p1 ;

    }

    return pArray;

    }

    }

    If this does not help you can contact me directly at :

    [Email removed by moderator]

    Regards,

    Asaf

    Add comment
    10|10000 characters needed characters exceeded