不同环境中的不同SOAP命名空间

不同环境中的不同SOAP命名空间,soap,websphere,cxf,ws-security,saaj,Soap,Websphere,Cxf,Ws Security,Saaj,我向需要WS-Security头的web服务编写了一个客户端(Java)。我使用cxf从WSDL生成源代码。当我在Tomcat上运行我的客户机时,它工作正常,但是,当我将其移动到Websphere时,我从服务返回一个错误,说签名无效。我比较了生成的soap信封,两者之间的所有标记都匹配,键值都相同。唯一的区别是WAS为soapenc、xsi和xsd添加了名称空间。然后将这些前缀添加到规范化方法的IncludedNamespaces中。从我所读到的,可以在签名的混合中得到。我无法判断Websphe

我向需要WS-Security头的web服务编写了一个客户端(Java)。我使用cxf从WSDL生成源代码。当我在Tomcat上运行我的客户机时,它工作正常,但是,当我将其移动到Websphere时,我从服务返回一个错误,说签名无效。我比较了生成的soap信封,两者之间的所有标记都匹配,键值都相同。唯一的区别是WAS为soapenc、xsi和xsd添加了名称空间。然后将这些前缀添加到规范化方法的IncludedNamespaces中。从我所读到的,可以在签名的混合中得到。我无法判断Websphere是否正在添加这些,或者它是否可能是正在获取的类的不同版本。无论哪种方式,Web服务都不会将其与这些名称空间一起接受。这些可以被移除吗

WebSphere命名空间包含

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

Websphere规范化标记

         <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="soapenc xsd xsi" />
         </ds:Transform>
      </ds:Transforms>
          <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="wsse soap" />
             </ds:Transform>
          </ds:Transforms>


Tomcat命名空间包含

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

Tomcat规范化标记

         <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="soapenc xsd xsi" />
         </ds:Transform>
      </ds:Transforms>
          <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="wsse soap" />
             </ds:Transform>
          </ds:Transforms>

这是我的WSS4jOutInterceptor Spring配置(删除了一些数据)



编辑:这似乎是由运行时中的某些存档引起的。有人知道什么包在jre和WebSphere8运行时中构建soap信封吗?这可能就是存在差异的地方。非常感谢您的帮助

事实证明,这与不正确的名称空间或规范化方法无关。默认情况下,Websphere将此调用设置为“BSP_兼容”,这将向密钥添加一些值

这些线路解决了这个问题

Map<String, Object> ctx = ((BindingProvider)port).getRequestContext();
ctx.put(WSHandlerConstants.IS_BSP_COMPLIANT, "false");
Map ctx=((BindingProvider)端口).getRequestContext();
ctx.put(WSHandlerConstants.IS_BSP_COMPLIANT,“false”);

是否可以添加带有错误消息的实际stacktrace?这实际上会删除整个节点。还有其他选择吗?