different response is coming from .net web server using NSUrlrequest
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.开发者_如何学Corg/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GenericAndroidMethodResponse xmlns="Mortgage"><GenericAndroidMethodResult><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>ensisinfo@ensis.com</EmailAddress>
<companyName>ensisinfo</companyName>
<CompanyURL>www.ensisinfo.com</CompanyURL>
</Table>
</NewDataSet></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>ensisinfo@ensis.com</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?
In the XML are all of those <
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.
Tell your .NET guy to fix it. What you are getting is not a valid XML.
精彩评论