Java org.apache.xml.security.c14n.CanonicalizationException:元素listFunctions具有相对命名空间:xmlns=";xxx“u xxx”列表函数;
我不熟悉Axis2和Web服务。我有一个axis2 web服务。当ws-security关闭时,一切正常。当ws-security打开时,我在服务器日志中得到以下异常。我调试了未调用的服务类方法。随附所使用的两个service.xml 调用Web服务的客户端在prolog中获得以下soap错误-意外的EOF 我在tomcat中得到以下java异常:Java org.apache.xml.security.c14n.CanonicalizationException:元素listFunctions具有相对命名空间:xmlns=";xxx“u xxx”列表函数;,java,xml,web-services,soap,Java,Xml,Web Services,Soap,我不熟悉Axis2和Web服务。我有一个axis2 web服务。当ws-security关闭时,一切正常。当ws-security打开时,我在服务器日志中得到以下异常。我调试了未调用的服务类方法。随附所使用的两个service.xml 调用Web服务的客户端在prolog中获得以下soap错误-意外的EOF 我在tomcat中得到以下java异常: org.apache.xml.security.c14n.CanonicalizationException: Element listFuncti
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
<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>
此服务用于获取列表函数
vish.web.ws.service.ListFunctionsService
当ws-security打开时,下面的示例将显示services.xml
<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>
测试视图列表例程的服务说明
test.web.ws.service.ListRoutineService
真的
令牌
test.web.ws.control.PWCBHandler
我解决了问题并解决了问题。问题不在于Axis2。我的问题中列出的例外与XML安全性的工作方式有关。.aar文件中的services.xml具有targetNamespace=“test\u vish\u listRoutines”。使用WS-Security设置为true的Web服务的客户机代码正在使用此命名空间。它正在调用“listRoutines”,这是一个相对的命名空间,在标准XMLSecurity中是不允许的。在serer方面,与listRoutines相关的服务方法本身没有被调用
更改为标准URL类型命名空间,如“解决了问题”
终于松了一口气。希望这能帮上忙救了我一天!!我应用了SpringWSS4J拦截器,并替换了相对的名称空间URI,这很有吸引力