开发者

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>&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;ensisinfo@ensis.com&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>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 &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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜