Paras Gandhi
Paras Gandhi

Reputation: 823

soap webservice with ASIHTTPREQUEST

I am trying to implement my soap web services with ASIHTTPREQUEST and i am facing some error.

Here is my code.

    [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];

and i am facing this error

The server cannot service the request because the media type is unsupported.

i have done some googling on this and found that there is some problem with "Content-Type". i am not sure about that.

i tried this and many other option but its gives me "Bad Request" as a response string.

[request addRequestHeader:@"Content-Type"  value:@"text/xml; charset=utf-8"];

let me know if you have nay solution for this.

Upvotes: 1

Views: 1780

Answers (1)

Fran Sevillano
Fran Sevillano

Reputation: 8163

Try this:

[request addRequestHeader:@"Content-Type"  value:@"application/soap+xml; charset=utf-8"];

Hope it works!

Upvotes: 1

Related Questions