Monday, 15 September 2014

c# - MVC Parse XML from Web Service -



c# - MVC Parse XML from Web Service -

i trying parse xml results web service getting error {the best overloaded method match 'system.xml.linq.xelement.parse(string)' has invalid arguments"}

var service = new remoteservice.remotesoapclient("remotesoap"); var result = service.getdetails(systemid, appid); viewbag.surname = xelement.parse(result).descendants("customer").single().attribute("surname").value;

xml output

<?xml version="1.0" encoding="utf-8"?> -<list> -<customer> <surname>spack</surname> <firstname>bob</firstname> </customer> </list>

what doing wrong, please help.

if f12 xelement.parse can see has 2 separate method signatures, in both of expected first parameter string. i'm going guess service.getdetails not homecoming string.

if throw .tostring() @ end of viewbag.surname assignment should @ to the lowest degree out of compile error. whether or not gets info expect, hard say.

c# xml web-services asp.net-mvc-4

No comments:

Post a Comment