cancel
Showing results for 
Search instead for 
Did you mean: 

Web service with complex java type

Former Member
0 Kudos

Hi,

I create a web service method with String o with Array of Strings without problem. Now I nedd to create a ws that return a table, so I create a class like this:

public class User {

private String Name;

private String.Surname;

public void setName(String setName){

Name= setName;

}

public void setSurname(String setSurname){

Surname=setSurname;

}

}

In my ws class I use this object:

public User[] getUser(String a){

User[] user = new User[10];

for (int i=0;i<10;i++){

User<i>.setName("aaa");

User<i>.setSurname("bbb");

}

return user;

}

When in WebService Perspective I try to create my ws in wizard mode I see method getUser but I can't check it

Where is error?

Thanks

Andrea

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hi Andrea,

Class User should implement Serializible interface. Also I would recommend implement getters for name and surname properties for class User.

best regards, Maksim Rashchynski.

Answers (2)

Answers (2)

kishorg
Advisor
Advisor
0 Kudos

HI Andrea,

I think with present netweaver developer studio , we can create Web services with end points as simple data types in java and the array of that simple data types.

not sure whether it support our own custom developed classes as end points.

just go through these links.

http://help.sap.com/saphelp_nw2004s/helpdata/en/f7/af60f2e04d0848888675a800623a81/frameset.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/f7/af60f2e04d0848888675a800623a81/frameset.htm

from this we will get Restrictions for WS Endpoints.

Regards

Kishor Gopinathan

Former Member
0 Kudos

Is it only a typo, or error in your source code - your method should look like this:


public User[] getUser(String a) {
	User[] user = new User[10];
	for (int j=0;j<10;j++){
		user[j].setName("aaa");
		user[j].setSurname("bbb");
	}
	return user;
}