jaxb - How to handle it when the same server request may return two different xml responses? -


I have seen a lot about how to boil many root elements in a single reaction. My problem is slightly different. Need to contact is a bit weird set up, even if there is an error, the server returns 200, but this error message will return the XML format in this way:

   

However, the expected response is a bit more:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Response & gt; & Lt; Number & gt; & Lt; / Number & gt; & Lt; LabelImage & gt; & Lt; / LabelImage & gt; & Lt; Name & gt; & Lt; / Name & gt; & Lt; Address 1 / & gt; & Lt; Address 2 & gt; & Lt; / Address 2 & gt; & Lt; City & gt; & Lt; / City & gt; & Lt; State & gt; & Lt; / State & gt; & Lt; Pin & gt; & Lt; / Zip & gt; & Lt; LabelSequenceNumber & gt; & Lt; / LabelSequenceNumber & gt; & Lt; Dropoff & gt; & Lt; / Dropoff & gt; & Lt; LogMessage / & gt; & Lt; / Reaction & gt;  

I am trying to figure out how I can accept these two answers with the same request.

I am using JXB and Rest templates to handle these requests and responses. I need to talk to API which is a terrific combination of Race and Soap, but I have no control over that part.

We resolved this issue by creating an interface for each class answering. I do not know why I did not think about this earlier, at this time my Jacobi's understanding was absent. When receiving the response, it was examined for the word "error", and if found, the error response was unreserved in class, otherwise it was indestructible in response to success.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -