Đã Hủy

Fix IOS Xcode SOAP ERROR .

Here is what the error looks like

------------------------------

2011-04-27 13:01:[url removed, login to view] AdvancedTableViewCells[920:207] Data return <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="[url removed, login to view]" xmlns:xsi="[url removed, login to view]" xmlns:xsd="[url removed, login to view]"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Server did not recognize the value of HTTP Header SOAPAction: [url removed, login to view]</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope>

----------------------------

All we are trying to do is submit some variables to our web service and get a response back.

Here is what the code looks like

NSString *soapMessage = [NSString stringWithFormat:

@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"

"<SOAP-ENV:Envelope \n"

"xmlns:xsd=\"[url removed, login to view]\" \n"

"xmlns:xsi=\"[url removed, login to view]\" \n"

"xmlns:SOAP-ENC=\"[url removed, login to view]\" \n"

"SOAP-ENV:encodingStyle=\"[url removed, login to view]\" \n"

"xmlns:SOAP-ENV=\"[url removed, login to view]\"> \n"

"<SOAP-ENV:Body> \n"

"<ActivateApp xmlns=\"[url removed, login to view]\">\n"

"<ActivationKey>77887</ActivationKey><SystemMode>testapproved</SystemMode><GPS_Lat>string</GPS_Lat><GPS_Long>string</GPS_Long>\n"

"</ActivateApp> \n"

"</SOAP-ENV:Body> \n"

"</SOAP-ENV:Envelope>"];

NSURL *url = [NSURL URLWithString:@"[url removed, login to view]"];

NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];

NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]];

[theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];

[theRequest addValue: @"[url removed, login to view]" forHTTPHeaderField:@"SOAPAction"];

[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];

[theRequest setHTTPMethod:@"POST"];

[theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];

NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

NSData *returnData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:nil error:nil];

NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];

NSLog(@"Data return %@",returnString);

Kỹ năng: Cocoa, iPad, iPhone, Objective C

Xem thêm: xcode initwithdata encoding, soap fault ios, ios soap, xcode soap, fault code soap xcode, ios delegate, soap encoding xcode, xcode soap ios, xcode c, error 0, xcode, soap, soap server, nil, ios code, ios a, ios 8, error, envelope, asmx, url fix, server ios, client server encoding, xmlns, ios recognize

Về Bên Thuê:
( 24 nhận xét ) Montreal, Canada

Mã Dự Án: #1039777

2 freelancer đang chào giá trung bình $75 cho công việc này

minalelo

please check your inbox...

$100 USD trong 1 ngày
(12 Đánh Giá)
5.4
everhome

Hi, let me help you now. check PM please.

$50 USD trong 1 ngày
(0 Đánh Giá)
0.0