hello people i have for the last few days been trying to bind a soap XML responce from a webservice request to a gridview in C# and everytime am ending up with errors, after lots of research here and there and trials i have got a visible error atleast can some help please. here is my code behind
SoapInvoker soapInvoker = new SoapInvoker();
soapInvoker.setURL("http://ift.tt/1oKmjJD");
soapInvoker.setMethod("ResolveMsisdn");
XDocument MsisdnRequest = SoapMethods.ResolveMsisdn(pin, msisdn);
XDocument MsisdnResponse = soapInvoker.CallSoapServiceInternal(MsisdnRequest);
string requestresp = MsisdnResponse.ToString();
XmlDocument xmldoc = new XmlDocument();
xmldoc.LoadXml(requestresp);
XmlElement root = xmldoc.DocumentElement;
txtsuppliername.Text = root.GetElementsByTagName("supplierName")[0].InnerText;
txtsuppliercode.Text = root.GetElementsByTagName("supplierCode")[0].InnerText;
txtcountryname.Text = root.GetElementsByTagName("countryName")[0].InnerText;
txtcountrycode.Text = root.GetElementsByTagName("countryCode")[0].InnerText;
var q = from c in MsisdnResponse.Root.Descendants("product")
select new
{
Code = c.Element("code").Value,
EAN = c.Element("ean").Value,
Description = c.Element("description").Value,
TypeCode = c.Element("typeCode").Value,
SubTypeCode = c.Element("subTypeCode").Value,
SupplierName = c.Element("supplierName").Value,
SupplierCode = c.Element("supplierCode").Value,
CountryName = c.Element("countryName").Value,
CountryCode = c.Element("countryCode").Value,
CurrencyCode = c.Element("currencyCode").Value,
Denominations = c.Element("denominations").Value,
MinValue = c.Element("minValue").Value,
MaxValue = c.Element("maxValue").Value,
buyMinValue = c.Element("buyMinValue").Value,
buyMaxValue = c.Element("buyMaxValue").Value,
BuyDenominations = c.Element("buyDenominations").Value,
BuyCurrencyCode = c.Element("buyCurrencyCode").Value,
SellCurrencyCode = c.Element("sellCurrencyCode").Value,
TransTypeId = c.Element("transTypeId").Value,
TransTypeCode = c.Element("transTypeCode").Value,
TransTypeDescription = c.Element("transTypeDescription").Value,
};
gvproducts.DataSource = q;
gvproducts.DataBind();
}
}
}
the response XML looks somehow like this its a long one cut some part of it
<soap:Envelope xmlns:soap="http://ift.tt/18hkEkn">
<soap:Body>
<ns2:SoapResolveMsisdnResponse xmlns:ns2="http://ift.tt/1wkp2af">
<header>
<agentTransactionId>100</agentTransactionId>
<transactionId>17368</transactionId>
<resultCode>0</resultCode>
<resultDescription>Success</resultDescription>
</header>
<supplierName>Kenya - Airtel Kenya</supplierName>
<supplierCode>63903</supplierCode>
<countryName>Kenya</countryName>
<countryCode>KEN</countryCode>
<products>
<product>
<code>TOP63903</code>
<ean>1234563233</ean>
<description>KEN Airtel Kenya - Topup</description>
<typeCode>TOPUP</typeCode>
<subTypeCode>TOP</subTypeCode>
<supplierName>Kenya - Airtel Kenya</supplierName>
<supplierCode>63903</supplierCode>
<countryName>Kenya</countryName>
<countryCode>KEN</countryCode>
<currencyCode>KES</currencyCode>
<denominations>100.0</denominations>
<minValue>100.0</minValue>
<maxValue>100.0</maxValue>
<buyMinValue>1.17</buyMinValue>
<buyMaxValue>1.17</buyMaxValue>
<buyDenominations>1.17</buyDenominations>
<buyCurrencyCode>USD</buyCurrencyCode>
<sellCurrencyCode>USD</sellCurrencyCode>
<transTypeId>119</transTypeId>
<transTypeCode>Rech</transTypeCode>
<transTypeDescription>Account Recharge</transTypeDescription>
</product>
<product>
<code>TOP63903</code>
<ean>1234563233</ean>
<description>KEN Airtel Kenya - Topup</description>
<typeCode>TOPUP</typeCode>
<subTypeCode>TOP</subTypeCode>
<supplierName>Kenya - Airtel Kenya</supplierName>
<supplierCode>63903</supplierCode>
<countryName>Kenya</countryName>
<countryCode>KEN</countryCode>
<currencyCode>KES</currencyCode>
<denominations>600.0</denominations>
<minValue>600.0</minValue>
<maxValue>600.0</maxValue>
<buyMinValue>6.87</buyMinValue>
<buyMaxValue>6.87</buyMaxValue>
<buyDenominations>6.87</buyDenominations>
<buyCurrencyCode>USD</buyCurrencyCode>
<sellCurrencyCode>USD</sellCurrencyCode>
<transTypeId>119</transTypeId>
<transTypeCode>Rech</transTypeCode>
<transTypeDescription>Account Recharge</transTypeDescription>
</product>
</ns2:SoapResolveMsisdnResponse>
when i trace the error in debug mode it says that The data source does not support server-side data paging can any one please help me on how to bind the data to gridview in case am doing it wrong or tell me how to overcome the error? also i dont know what wromg where but everytime i run into an error it loads the following error message
Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated
No comments:
Post a Comment