2014-12-23 28 views
1

我是Axis2和webservices的新手。我有一個axis2 web服務。當ws-security關閉時,事情運行良好。當ws-security打開時,服務器日誌中會出現以下異常。我調試的服務類方法沒有被調用。附加的是兩個使用的service.xmls。org.apache.xml.security.c14n.CanonicalizationException:元素listFunctions有一個相對的名稱空間:xmlns =「xxx_xxx_listFunctions」

客戶端調用WebService的獲得followoing SOAP錯誤 - 意外EOF在序言

我得到Tomcat中的以下Java異常:

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) 

以下是在server.xml當WS-Security是關閉,工作的事情

<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是開啓

<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> 

回答

0

我想出了問題並解決了問題。這個問題不在Axis2中。我的問題中列出的例外與XML Security的工作方式有關。 .aar文件中的services.xml具有targetNamespace =「test_vish_listRoutines」。使用WS-Security將Web服務設置爲true的客戶端代碼正在使用此名稱空間。它調用了「listRoutines」,這是一個相對的命名空間,在標準的XMLSecurity中是不允許的。在服務器端,與listRoutines相關的服務方法沒有被調用。

更改爲標準URL類型命名空間,如'http://www.testing.com/webserice解決了這個問題。

舒緩的氣息。希望這可以幫助

相關問題