Skip to main content

How to pass whole (Value)Objects as parameter to a webservice?

2 replies [Last post]
Joined: 2008-10-21

Nearly all of the web service examples show on how to pass single input parameters as "string" or "int" to a web service.

But what if I want to pass a whole Java class ValueObject like e.g.

public class MyValueObj {
public String name;
public int value;
protected boolean result; }

Is there somewhere an example (client and webservice implementation)
of passing such more complex ValueObjects to a web service?


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-11-04

Use getters and setters....

public class MyValueObj {
privateString name;
private int value;
private boolean result;

private String name;
private int value;
private boolean result;
public String getName() {
return name;
public void setName(String name) { = name;
public int getValue() {
return value;
public void setValue(int value) {
this.value = value;
public boolean isResult() {
return result;
public void setResult(boolean result) {
this.result = result;



During web service invokation(Client End),
Set these parameters and pass the whole object...

Web Service Side,

Implement the Service Method in such a way that it should accept the whole object


public MyWebService(MyValueObj myValueObject) throws Exception{

String name = myValueObject.getName();


Joined: 2004-11-17

Hi Can you please give some code sample for the same. i means i want to see the WSDl file structure of the same. and how to test this service