简体   繁体   中英

how can i leave out fields from an axis2 soap response?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM