Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
204 views
in Technique[技术] by (71.8m points)

java - JIBX : Ignoring unknown elements within an unordered group on a soap response

I want to ignore the unknown elements I receive in the response from a soap api. So I added these attributes flexible = true and odred = false in the binding file on the mapping of the element.

Extract from the binding file :

<mapping abstract="true" type-name="ns1:MakeReservationResponseType" class="com.path.MakeReservationResponseType" ordered="false" flexible="true">
  <structure map-as="ns1:ControlType" get-method="getControl" set-method="setControl" name="Control"/>
  <structure get-method="getResponse" set-method="setResponse" usage="optional" name="Response" ordered="false" flexible="true">
    <structure map-as="ns1:ResponseBaseFields-Group" get-method="getResponseBaseFields" set-method="setResponseBaseFields" usage="optional"/>
    <structure map-as="ns1:BookingType" get-method="getBooking" set-method="setBooking" name="Booking"/>
    <structure map-as="ns1:PriceDataType" get-method="getPrice" set-method="setPrice" name="Price"/>
  </structure>
  <structure map-as="ns1:ErrorResponseType" get-method="getError" set-method="setError" usage="optional" name="Error"/>
</mapping>

When i try to unmarshal the response that i receive, i have this error :

"Expected "{apiUrl}Response" end tag, found "{
apiUrl}Item" start tag (line -1, col -1, in SOAP-message), role=supplier, property=Expected "{apiUrl}Response" end tag, found "{
apiUrl}Item" start tag (line -1, col -1, in SOAP-message"

I have this error because i receive an unknown object not declared in my xsd and binding file. But in this documentation say if i add flexible = true and ordered = false, i can ignore unknown elements : http://jibx.sourceforge.net/tutorial/binding-extras.html#mixing But this solution doesn't work and i have the error above. I use this version of jibx : 1.3.3 So can someone help me please ? Thanks

question from:https://stackoverflow.com/questions/65886629/jibx-ignoring-unknown-elements-within-an-unordered-group-on-a-soap-response

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...