org.apache.xml.security.c14n.CanonicalizationException:元素listFunctions具有相对名称空间:xmlns =" xxx_xxx_listFunctions" [英] org.apache.xml.security.c14n.CanonicalizationException: Element listFunctions has a relative namespace: xmlns="xxx_xxx_listFunctions"

查看:137
本文介绍了org.apache.xml.security.c14n.CanonicalizationException:元素listFunctions具有相对名称空间:xmlns =" xxx_xxx_listFunctions"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Axis2 和webservices的新手。我有一个axis2网络服务。当ws-security关闭时,事情运行正常。打开ws-security时,我在服务器日志中收到以下异常。我调试了没有调用的服务类方法。附件是两个service.xmls使用。

I am new to Axis2 and webservices. I have a axis2 web services. Things run fine when ws-security is turned off. When ws-security is turned on, I get the following exception in the server log. I debugged the service class method is not called. Attached are two service.xmls used.

调用webservice的客户端得到了后续的soap错误 - prolog中意外的EOF

The client invoking the webservice get the followoing soap fault - unexpected EOF in prolog

我得到以下java tomcat中的异常:

I get the following java exception in tomcat :

org.apache.xml.security.c14n.CanonicalizationException: Element listFunctions has a relative namespace: xmlns="test_vish_listFunctions"
    at org.apache.xml.security.c14n.implementations.Canonicalizer20010315.handleAttributesSubtree(Unknown Source)
    at org.apache.xml.security.c14n.implementations.CanonicalizerBase.canonicalizeSubTree(Unknown Source)
    at org.apache.xml.security.c14n.implementations.CanonicalizerBase.engineCanonicalizeSubTree(Unknown Source)
    at org.apache.xml.security.c14n.implementations.CanonicalizerBase.engineCanonicalizeSubTree(Unknown Source)
    at org.apache.xml.security.c14n.Canonicalizer.canonicalizeSubtree(Unknown Source)
    at org.apache.xml.security.utils.XMLUtils.outputDOM(Unknown Source)

当ws-security关闭且工作正常时,以下是server.xml

Following is the server.xml when ws-security is off and things works

    <service name="test_vish_listFunctions" targetNamespace="test_vish_listFunctions">
   <description>
        This service is to get the list  functions
   </description>
   <schema schemaNamespace="test_listFunctions"/>
   <parameter name="ServiceClass">vish.web.ws.service.ListFunctionsService</parameter>
   <operation name="listFunctions">
        <messageReceiver  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
   </operation>
   <module ref="soapmonitor"/>
 </service>

以下打开ws-security时的services.xml

The following the services.xml when ws-security is turned on

<service name="test_vish_listRoutines" targetNamespace="test_vish_listRoutines">
   <description>Service description for test_vish_listRoutines</description>
  <schema schemaNamespace="test_vish_listRoutines"/>
  <parameter name="ServiceClass">test.web.ws.service.ListRoutinesService</parameter>
  <parameter name = "disasbleREST">true</parameter>
  <operation name="listRoutines">
  <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</operation>
<module ref="soapmonitor"/>
<module ref="rampart" />
<parameter name = "InflowSecurity"><action>
<items>UsernameToken</items>
<passwordCallbackClass>test.web.ws.control.PWCBHandler</passwordCallbackClass>
</action>
</parameter>
</service>


推荐答案

我找出了问题并解决了问题。问题不在于Axis2。我的问题中列出的例外与XML Security的工作方式有关。 .aar文件中的services.xml具有targetNamespace =test_vish_listRoutines。使用WS-Security设置为true的Web服务的客户端代码正在使用此命名空间。它调用了'listRoutines',它是一个相对命名空间,在标准XMLSecurity中是不允许的。在serer端,与listRoutines相关的服务方法没有被调用。

I figured out the problem and fixed the issue. The issue was not with Axis2.The exception as listed in my question relates to the way XML Security works. The services.xml in .aar file had targetNamespace="test_vish_listRoutines". The client code consuming the webservices with WS-Security set to true, was using this namespace. It was calling 'listRoutines', which is a relative namespace and not allowed in standard XMLSecurity. On the serer side, the service method related to listRoutines was not getting called itself.

更改标准网址类型命名空间,例如' http: //www.testing.com/webserice 解决了这个问题。

Changing is to a standard URL type namespace like 'http://www.testing.com/webserice solved the problem.

感到高兴。希望这有帮助

Sigh of relief atlast. Hope this helps

这篇关于org.apache.xml.security.c14n.CanonicalizationException:元素listFunctions具有相对名称空间:xmlns =&quot; xxx_xxx_listFunctions&quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆