3

名前空間を指定する JiBX バインディング ファイルがあります。ただし、名前空間の検証をオフにして、無効な名前空間を持つ XML メッセージでもアンマーシャリングできるようにしたいと考えています。

次のようなバインディング ファイルがあります。

<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>
...

次のメッセージを JiBX アンマーシャラーに渡します (Envelope 要素の名前空間が異なります)。

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

以下は、JiBX がメッセージを非整列化するときのエラー メッセージを示しています。

[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)
...

JiBX で名前空間の検証を無効にする方法はありますか? ありがとう。

4

0 に答える 0