2013-09-02 5 views
16

axis/rampartを使用してwebserviceに接続していて、prefixListが許可されていないInclusiveNamespacesを削除するように指示されました。それ、どうやったら出来るの?axis/rampartクライアントでInclusiveNamespacesを無効にする

部分は、それが空のときinclusivenamespaceを印刷しないように軸/城壁を構成することが可能である

<ds:SignedInfo> 
    <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> 
     <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="wsa soapenv" /> 
    </ds:CanonicalizationMethod> 
    <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> 
    <ds:Reference URI="#Id-289005241"> 
     <ds:Transforms> 
      <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">    
       <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="" /> 
      </ds:Transform> 
     </ds:Transforms> 
     <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />       
     <ds:DigestValue>bla bla bla=</ds:DigestValue> 
    </ds:Reference> 
</ds:SignedInfo> 

のように見えますか?

私はこれをアーカイブする方法任意のアイデアを軸/城壁1.6.2を使用して.NETサービス

に接続していますか?または、どのように非空のprefixListをレンダリングさせるのですか?

答えて

1

不要なxmlタグをフィルタリングするカスタムハンドラを追加する必要があります。

カスタムハンドラ:

package com.perre; 

     public class InclusiveNamespacesFilter extends AbstractHandler { 

     public InvocationResponse invoke(MessageContext ctx) throws AxisFault { 

      SOAPEnvelope msgEnvelope = ctx.getEnvelope(); 
      SOAPHeader msgHeader = msgEnvelope.getHeader(); 

      Iterator theDescendants = msgHeader.getDescendants(true); 
      while(theDescendants.hasNext()){ 

       Object o = theDescendants.next(); 

       //here, add your code to traverse DOM and get the node to filter 
       //... 
       Node aNode = ele.getElementsByTagName("ec:InclusiveNamespacesFilter").item(0); 
       if(aNode != null){ 
          ele.removeChild(aNode); 
       } 
      } 
      return InvocationResponse.CONTINUE; 
     } 

編集あなたのaxis2.xmlをハンドラを宣言するには:

<phase name="PostSecurity"> 
     <handler name="FilterHandler" class="com.perre.InclusiveNamespacesFilter"/> 
</phase> 
  • あなたは行く準備ができなければなりません。カスタムハンドラの詳細については、hereを参照してください。
+0

ありがとう、私は非WSIの苦情モードを使用して解決しました。私は時間があるときにこれを試してみます。ありがとうございました – Perre

関連する問題