XMLRPC vb.net 2.0 gives error: response contains array where struct expected
"madnuid" <[email protected]>
| Newsgroups | gmane.text.xml.rpc.specification |
|---|---|
| Message-ID | <[email protected]> |
Hi there,
I'll get an error: response contains array where struct expected
[repsonse] with my vbcode. Can someone help me te get the right code
(or mapping). I am a newbie on XML RPC and can't get the code
working.
Finally I want to get the resultset in a dataset. Please, who can
help me....
My code:
--------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim myproxy As New CountryDetails
myproxy.Credentials = New Net.NetworkCredential("xxx", "xxx")
Dim myc As CountryDetails.x
myc.countrycode = "nl"
myc.offset = 0
myc.rows = 1000
myproxy.getCountryDetails2(myc)
End Sub
<XmlRpcUrl("http://xxx/xml-rpc")> Public Class CountryDetails
Inherits XmlRpcClientProtocol
Public Structure Countries
Public languages() As String
Public area As String
Public code As String
Public name As String
End Structure
Public Structure x
Public countrycode As String
Public offset As Int32
Public rows As Int32
End Structure
<XmlRpcMethod("getCountryDetails")> _
Public Function getCountryDetails(ByVal myc As x) As
CountryDetails
Return Invoke("getCountryDetails", New Object() {myc})
End Function
<XmlRpcMethod("getCountryDetails")> _
Public Function getCountryDetails2(ByVal myc As x)
Dim arrCountries() As Countries
arrCountries = Invoke("getCountryDetails", New Object() {myc
})
End Function
End Class
The XML Answer
-------------------
<?ml.version="1.0".encoding="UTF-8">
<methodResponse>
<params>
<param>
<value>
<array>
<data>
<value>
<struct>
<member>
<name>languages</name>
<value>
<array>
<data>
<value>
<string>en</string>
</value>
<value>
<string>nl</string>
</value>
</data>
</array>
</value>
</member>
<member>
<name>area</name>
<value><string>Europe</string></value>
</member>
<member>
<name>name</name>
<value><string>Netherlands</string></value>
</member>
<member>
<name>code</name>
<value><string>nl</string></value>
</member>
</struct>
</value>
</data>
</array>
</value>
</param>
</params>
</methodResponse>
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/xml-rpc/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/