简体   繁体   English

如何从axis2肥皂响应中删除字段?

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

I have an Axis2 Web Service that requests the status of some objects. 我有一个Axis2 Web服务,它要求某些对象的状态。 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. 该Web服务是使用POJO实现的,而wsdl是使用java2wsdl工具生成的。

Lets say the relevant part of the SOAP response looks like this: 可以说SOAP响应的相关部分如下所示:

String int int String ...... String int int字符串......

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. -当在对象列表中找不到该对象时,我只希望objectName和objectStatus字段具有值并发送给客户端。 The other object properties values should be missing from the SOAP message. SOAP消息中应缺少其他对象属性值。

How can I do that? 我怎样才能做到这一点?

Thanks. 谢谢。

I would add a boolean flag to the Response, something like isObjectPresent . 我将在响应中添加一个boolean标志,类似于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. 您未在响应对象中设置的任何值都将设置其默认值(int = 0,String =“”),但是通过这种方式,您可以向客户端发出信号,使其不注意那些字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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