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?


Asked by: Vanessa450 | Posted: 28-01-2022

Answer 1

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.

Answered by: Edward273 | Posted: 01-03-2022

Similar questions

java - how to limit the json fields while getting response in spring rest

this the code: @RequestMapping(value="/find/city={city}", method=RequestMethod.GET) public List<Master_City> getCity(@PathVariable String city) { return City_Repository.findByCityLikeIgnoreCase(city); } All the JSON Fields are showing.I required only 2 Fields.

java - Response Writer in jsf

ResponseWriter writer=context.getResponseWriter(); I want to know about startElement, endElement, and writeAttribute methods on ResponseWriter.

java - Jetty Response with no Charset

I'm using Jetty to test a webservice we have and I am trying to get it to respond with no charset under the content-type header. Does anyone know how to do this? I've tried intercepting the Response and setting the CharacterEncoding to null or "" but that gives Exceptions. I am using Jetty 6.1.6.

java - Parse JSON response from Google Maps page

I'm trying to find the best way of parsing the response from a "normal" (i.e. not using the API) Google Maps page in my java code. Reason: I want to submit a query string requesting a listing (be it hotels, restaurants etc.) and then parse the JSON that comes back. I had looked into using the Google Maps API, but it doesn't seem to cover what I want to do, as this type of URL:

email - How to send an iCal meeting request using Java Mail, and receive the response

I'm trying to send an iCal to an outlook, using Java Mail Library, I've read already the Question, and I already have some sample code public class SendMeetingRequest { String host = "" ; String port = "" ; String sender = "" ; public static SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyyMM...

java - Return XML Response in REST Service

I am writing a RESTful web service where in I want to return a XML containing some resultset. I have used XSTREAM and parsed the object into XML string. Since I need to return this string, I need to know how to pass it back to the calling client. One way is to return the RESPONSE to the calling client. And my sample code here shows what it is that I am trying to do. @Path("somepath") public class ...

java - Caching using Axis 1.4 + web service response caching at client side

I want to cache web services response XML at client side. How can i cache response XML at client side, so we don't have to wait for Server side response ? Is there any mechanism available in Axis 1.4 that helps to caching server side response XML at client side ? Scenario : I am consuming 1 search detail service method, which hits the servers of supplier every minute for different search criteria and most o...

How to get HTTP response through socket in java?

I have written a code to send a HTTP request through a socket in java. Now I want to get the HTTP response that was sent by the server to which I sent HTTP request.

Proper way to decode response in Dojo cometd java client

I want to push arbitrary XMLEncoded java objects back and forth using Dojo cometd channels, and I have a problem decoding the payload properly. In order to do this I have this send method in a stripped down version of the chat room client demonstration program: private void send(String string) { Map<String, Object> map = new HashMap<String, Object>(); map.put("intArray", new int[] {1...

java - Modify Http response

I have a need to write a Servlet filter to inspect the HTML being sent out and modify all the links that point to /images in it to a different domain altogether so that they are served from a CDN(content delivery network) rather than my site. Is this recommended and how can I achieve this? -thanks

java - FTP upload code that returns any error response from the server

Can someone point me to some java code that can upload a file via FTP. The important thing is that if the FTP responds with an error message I need to obtain it. This is because I need to be sure the file was succesffully uploaded. I am using the following code, but it does not return an error if the upload fails. import; import; import jav...

Still can't find your answer? Check out these amazing Java communities for help...

Java Reddit Community | Java Help Reddit Community | Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)