example java axis2 ws-security rampart

ws security java example



Deshabilitar espacios de nombres inclusivos en el cliente de eje/rampart (1)

Me estoy conectando a un servicio web con axis / rampart y me dijeron que eliminara los espacios de inclusión Inclusive como prefixList era "" lo que no está permitido. ¿Cómo puedo hacer eso?

La parte parece

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

¿Es posible configurar el eje / rampa para no imprimir el espacio de nombres incluido cuando está vacío?

Estoy usando axis / rampart 1.6.2 y conectándome a un servicio .NET

¿Alguna idea de cómo archivar esto? ¿O cómo hago que muestre una prefixList no vacía?


Debe agregar un controlador personalizado para filtrar la etiqueta xml no deseada.

controlador personalizado:

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

edita tu axis2.xml y declara el manejador:

<phase name="PostSecurity"> <handler name="FilterHandler" class="com.perre.InclusiveNamespacesFilter"/> </phase>

  • Usted debe estar listo para ir Encuentre más información sobre controladores personalizados here .