Lee
Lee

Reputation: 25

Web Service Receive Null Data iOS

I had a very strange situation in using web service

Here is my Xcode Project File https://dl.dropbox.com/u/9507586/FubonTest.zip

I got the response back from the server as below.

2013-03-04 15:56:18.473 FubonTest[1059:f803] 1: connection: didReceiveResponse
2013-03-04 15:56:18.473 FubonTest[1059:f803] 2: connection: didReceiveData
2013-03-04 15:56:18.699 FubonTest[1059:f803] 2: connection: didReceiveData
2013-03-04 15:56:18.699 FubonTest[1059:f803] 3: Done. Received Bytes: 1789
2013-03-04 15:56:18.700 FubonTest[1059:f803] Return (null)

I did receive bytes, but the xml tag file is null. The server side people told me they use utf-8 encoding, but it just returned null. If I use ascii encoding, the returning data is not null, but it's not the xml tag file I expected.

The correct returning xml tag files should be as below. The returning xml tag file is using eclipse(window version) web service function.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:RegistResponse xmlns:ns1="http://service.fubon.com" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<RegistReturn xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:string">该用户未投保</RegistReturn> 
</ns1:RegistResponse>
</soapenv:Body>
</soapenv:Envelope>

Can someone help me to sort it out?

Upvotes: 0

Views: 611

Answers (1)

tolgamorf
tolgamorf

Reputation: 809

There is a misspelling. In your ViewController.m file, line 57:

Change forHTTPHeaderField: @"Contnet-Type"];

to forHTTPHeaderField: @"Content-Type"];

Upvotes: 1

Related Questions