tags:

views:

88

answers:

1

Hello.

I have an Axis2 Web Service that requests the status of some objects. The objects can either exist on the server, or not exist.

The web service is implemented with POJOs, and the wsdl is generated with java2wsdl tool.

Lets say the relevant part of the SOAP response looks like this:

String int int String ......

What I want to do is this: - when the object is found in the list of objects, I want all the fields to have a value and be sent to the client. - when the object in not found in the list of objects, I only want the objectName and objectStatus fields to have values and be sent to the client. The other object properties values should be missing from the SOAP message.

How can I do that?

Thanks.

+1  A: 

I would add a boolean flag to the Response, something like isObjectPresent. Your clients can then take a look at this flag to determine if the object "is present" or not. Any values you do not set in the response object will have their default values set (int = 0, String = ""), but this way you can signal to the client not to pay attention to those fields.

matt b