0
我使用ServiceClient對象(無客戶端代碼生成)從Java Axis 2客戶端調用SharePoint 2010 Web服務。Axis 2 Web服務上沒有AXIOMXPath的結果
我需要用xPath查詢結果以獲取結果代碼和其他數據在未來的發展。
使用AXIOMXPath我不能得到的結果...
這裏是Web服務調用的結果:
<CopyIntoItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<CopyIntoItemsResult>0</CopyIntoItemsResult>
<Results>
<CopyResult ErrorCode="Success" DestinationUrl="http://mss2010-vm1/siteBdL/GED/obligations/obli_interne.pdf">
</CopyResult>
</Results>
</CopyIntoItemsResponse>
我的代碼:
OMElement result = client.sendReceive(copyService);
if (result != null) {
AXIOMXPath xpathExpression = new AXIOMXPath("/CopyIntoItemsResponse/Results/CopyResult/@ErrorCode");
xpathExpression.addNamespace("", "http://schemas.microsoft.com/sharepoint/soap/");
Object node = xpathExpression.selectNodes(result);
if (node != null) {
OMAttribute attribute = (OMAttribute) node;
if (attribute.getAttributeValue().equals("Success")) {
succeeded = true;
}
}
}
任何想法,請?
我回來一段時間後給出了一個反饋。我無法確認爲什麼AXIOMXPath不能正常工作。我選擇使用Axiom OMElement API來獲得結果(使用幾個getChildren()來「導航」到XML中)。如果我有時間,我會測試你的第二個主張...... – Dino