带有 ASIHTTPREQUEST 的 SOAP Web 服务

发布于 2024-12-07 11:59:38 字数 904 浏览 1 评论 0原文

我正在尝试使用 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.

我对此进行了一些谷歌搜索,发现“Content-Type”存在一些问题。我对此不太确定。

我尝试了这个和许多其他选项,但它给了我“错误请求”作为响应字符串。

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

如果您对此有任何解决方案,请告诉我。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风筝有风,海豚有海 2024-12-14 11:59:38

试试这个:

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

希望它有效!

Try this:

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

Hope it works!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文