首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在axis/rampart客户端中禁用InclusiveNamespaces

在axis/rampart客户端中禁用InclusiveNamespaces
EN

Stack Overflow用户
提问于 2013-09-03 07:13:51
回答 1查看 999关注 0票数 17

我正在使用axis/rampart连接到was服务,并被告知删除InclusiveNamespaces,因为prefixList是"“,这是不允许的。我该怎么做?

这部分看起来像

代码语言:javascript
复制
<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>

是否可以将axis/rampart配置为在包含名称空间为空时不打印它?

我正在使用axis/rampart 1.6.2并连接到.NET服务

有没有办法把这个存档?或者我如何让它呈现一个非空的prefixList?

EN

回答 1

Stack Overflow用户

发布于 2014-02-18 07:01:47

您必须添加一个自定义处理程序来过滤不需要的xml标记。

自定义处理程序:

代码语言:javascript
复制
    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并声明处理程序:

代码语言:javascript
复制
 <phase name="PostSecurity">
      <handler name="FilterHandler" class="com.perre.InclusiveNamespacesFilter"/> 
 </phase>

  • 你应该已经准备好了。查找有关自定义处理程序here.

的更多信息

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18581926

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档