0
votes

i am getting the data from .net web server like this.

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GenericAndroidMethodResponse xmlns="Mortgage"><GenericAndroidMethodResult>&lt;NewDataSet&gt;
  &lt;Table&gt;
    &lt;LoanOfficerID&gt;3581&lt;/LoanOfficerID&gt;
    &lt;FirstName&gt;Venkat&lt;/FirstName&gt;
    &lt;LastName&gt;Sreenu&lt;/LastName&gt;
    &lt;Address1&gt;d&lt;/Address1&gt;
    &lt;City&gt;d&lt;/City&gt;
    &lt;State&gt;Alabama&lt;/State&gt;
    &lt;WorkPhone&gt;19999999999&lt;/WorkPhone&gt;
    &lt;Country&gt;United States&lt;/Country&gt;
    &lt;EmailAddress&gt;[email protected]&lt;/EmailAddress&gt;
    &lt;companyName&gt;ensisinfo&lt;/companyName&gt;
    &lt;CompanyURL&gt;www.ensisinfo.com&lt;/CompanyURL&gt;
  &lt;/Table&gt;
&lt;/NewDataSet&gt;</GenericAndroidMethodResult></GenericAndroidMethodResponse></soap:Body></soap:Envelope>  

But i test in browser by passing xml parameters and method name i am getting like this.

<NewDataSet> <Table> <LoanOfficerID>3581</LoanOfficerID> <FirstName>Venkat</FirstName> <LastName>Sreenu</LastName> <Address1>d</Address1> <City>d</City> <State>Alabama</State> <WorkPhone>19999999999</WorkPhone> <Country>United States</Country> <EmailAddress>[email protected]</EmailAddress> <companyName>ensisinfo</companyName> <CompanyURL>www.ensisinfo.com</CompanyURL> </Table> </NewDataSet>

I am using NSUrlRequest

NSURL *url = [NSURL URLWithString:@"http://173.31.193.92/MobileGenericWebservice/GenericWebService.asmx"]; NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url]; NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]];

[theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue: @"Mortgage/GenericAndroidMethod" forHTTPHeaderField:@"SOAPAction"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];

why i am getting like this.

can any one please help me.

2

2 Answers

1
votes

In the XML are all of those &lt; and other codes visible like in your example?
If they are then the entire element is just getting parsed as one, giant string that is in the <GenericAndroidMethodResult> node.

0
votes

Tell your .NET guy to fix it. What you are getting is not a valid XML.