org.apache.xml.security.c14n.CanonicalizationException:元素listFunctions具有相对名称空间:xmlns =“xxx_xxx_listFunctions”

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

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

我在tomcat中得到以下javaexception:

 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

    This service is to get the list functions   vish.web.ws.service.ListFunctionsService      

打开ws-security时,以下是services.xml

  Service description for test_vish_listRoutines  test.web.ws.service.ListRoutinesService true       UsernameToken test.web.ws.control.PWCBHandler    

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

更改为标准URL类型命名空间,如’ http://www.testing.com/webserice解决了问题。

松了一口气。 希望这可以帮助