0
我是GO的新手,開始學習如何處理SOAP請求。我在命名空間方面遇到了一些困難:我不知道如何構建結構體來反映web服務中的這類數據,以解開它。你能在這裏給我幾點提示嗎?我使用GO 1.5.1在GOLANG中使用名稱空間的SOAP
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://webapi.allegro.pl/service.php">
<SOAP-ENV:Body>
<ns1:doQueryAllSysStatusResponse>
<ns1:sysCountryStatus>
<ns1:item>
<ns1:countryId>1</ns1:countryId>
<ns1:programVersion>1.0</ns1:programVersion>
<ns1:catsVersion>1.1.87</ns1:catsVersion>
<ns1:apiVersion>1.0</ns1:apiVersion>
<ns1:attribVersion>1.0</ns1:attribVersion>
<ns1:formSellVersion>1.4.46</ns1:formSellVersion>
<ns1:siteVersion>1.0</ns1:siteVersion>
<ns1:verKey>123131231</ns1:verKey>
</ns1:item>
<ns1:item>
<ns1:countryId>56</ns1:countryId>
<ns1:programVersion>1.0</ns1:programVersion>
<ns1:catsVersion>1.0.43</ns1:catsVersion>
<ns1:apiVersion>1.0</ns1:apiVersion>
<ns1:attribVersion>1.0</ns1:attribVersion>
<ns1:formSellVersion>1.0.69</ns1:formSellVersion>
<ns1:siteVersion>1.0</ns1:siteVersion>
<ns1:verKey>00000101</ns1:verKey>
</ns1:item>
</ns1:sysCountryStatus>
</ns1:doQueryAllSysStatusResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
'encoding/xml'標準包本身支持命名空間 - 編碼和解碼規則在這裏解釋[https:// golan g.org/pkg/encoding/xml/#Marshal)和[there](https://golang.org/pkg/encoding/xml/#Unmarshal)。參考手冊有點幹,所以你嘗試[搜索](http://stackoverflow.com/search?q= [去] + XML +命名空間)?特別是,[this](http://stackoverflow.com/q/10812294/720999)可能是這種方法的很好例證。 – kostix
您好kostix和謝謝你的偉大的建議。我認爲你提供的鏈接(http://stackoverflow.com/q/10812294/720999)回答我所有的dilemas,好像我錯過了「ATTR」 – Greg