3

I have a JiBX binding file that specifies namespaces. However, I want to turn off namespace validation so that even an XML message with invalid namespace could be unmarshalled.

I have a binding file like the following:

<binding name="test_binding">

  <namespace prefix="soapenv" uri="http://www.w3.org/2003/05/soap-envelope" />

  <!-- Envelope -->
  <mapping name="Envelope" ns="http://www.w3.org/2003/05/soap-envelope"
    class="com.test.data.Envelope">
    <structure get-method="getHeader" set-method="setHeader"
      ns="http://www.w3.org/2003/05/soap-envelope" usage="optional" />
    <structure get-method="getBody" set-method="setBody"
      ns="http://www.w3.org/2003/05/soap-envelope" usage="optional" />
  </mapping>
...

I pass the following message to JiBX unmarshaller (with different namespace for Envelope element):

<?xml version="1.0" encoding="UTF-8" ?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope"> 
    <soapenv:Header> 
        <MyElement>
....

The following shows the error message when JiBX unmarshalls the message:

[Time:2011-10-04 17:39:29,802][Level:FATAL]org.jibx.runtime.JiBXException: No unmarshaller for element "{http://schemas.xmlsoap.org/soap/envelope}Envelope" (line 2, col 76)
...

Is there a way to disable namespace validation in JiBX? Thanks.

Tommy Siu
  • 1,265
  • 2
  • 10
  • 24

0 Answers0