1
我試圖用ASIHTTPREQUEST實現我的soap web服務,但我面臨一些錯誤。soap webservice with ASIHTTPREQUEST
這是我的代碼。
[request addRequestHeader:@"Content-Type" value:@"application/xml; charset=utf-8"];
[request addRequestHeader:@"SOAPAction" value:[xmlnsString stringByAppendingString:@"GetDetail"]];
[request addRequestHeader:@"Content-Length" value:msgLength];
[request setRequestMethod:@"POST"];
[request appendPostData: [yourPOSTstring dataUsingEncoding:NSUTF8StringEncoding]];
[request setDefaultResponseEncoding:NSUTF8StringEncoding];
和我面對這個錯誤
The server cannot service the request because the media type is unsupported.
我已經做了這方面的一些谷歌上搜索,發現有一些問題「內容類型」。我不確定這一點。
我試過這個和許多其他選項,但它給我「錯誤請求」作爲響應字符串。
[request addRequestHeader:@"Content-Type" value:@"text/xml; charset=utf-8"];
讓我知道你是否有這個解決方案。
你是如何解決這個問題的?請提出任何提示? –
沒有它沒有解決。我放棄了一個想法,用ASIHTTPREQUEST實現並用nomarl nsdata和連接方法實現。 –