cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi

Actually even I could get it working with arrays.

Now I'm trying to get it working with HashMap. When I test my web service with wsnavigator it gets the expected result but at VC it fails. I get portal request fail on testing the web service.

Does Vc support Java Collection classes like ArrayList and HashMap.

Thanks

former_member193545
Active Participant
Sathish
Employee
Employee
0 Kudos

VC does not support Array structure.

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

Former Member
0 Kudos

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

Former Member
0 Kudos
Former Member
0 Kudos

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