2013-09-02 20 views
16

Mi sto connettendo a un servizio web con asse/rampart e mi è stato detto di rimuovere gli spazi InclusiveNames poiché il prefissoList era "" che non è consentito. Come lo faccio?Disabilita spazi Inclusive Names in client asse/rampart

La parte sembra

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

E 'possibile configurare l'asse/baluardo per non stampare l'inclusivenamespace quando è vuota?

sto usando asse/baluardo 1.6.2 e la connessione a un servizio .NET

Delle idee come archiviare questo? O come faccio a renderizzare un prefisso non vuoto?

risposta

1

È necessario aggiungere un gestore personalizzato per filtrare il tag xml indesiderato.

gestore personalizzato:

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; 
     } 

modificare la tua axis2.xml e dichiarare il gestore:

<phase name="PostSecurity"> 
     <handler name="FilterHandler" class="com.perre.InclusiveNamespacesFilter"/> 
</phase> 
  • si dovrebbe essere pronti a partire. Trova ulteriori informazioni sui gestori personalizzati here.
+0

Grazie, l'ho risolto utilizzando la modalità di reclamo non WSI. Darò questa prova quando avrò tempo. Grazie – Perre