.NET从程序调用PHP写的WebService,出错:客户端发现响应内容类型为“text/html”,但应为“text/xml”

pellet 2006-06-21 02:43:17
因为要把PHP的论坛和.net的页面作一些联动,如远程添加帖子什么的,所以写了一个php的WebService

但是用.net程序调用这个WebService,却返回错误

客户端发现响应内容类型为“text/html”,但应为“text/xml”。
请求失败,错误信息为:
--
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:ws_phpwind" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:add_commentResponse><add_commentReturn xsi:type="xsd:int">19</add_commentReturn></ns1:add_commentResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

--.

返回的明明就是xml嘛,为什么.net会认为是text/html呢?
php那边也正常执行了,我想添加的帖子也添加到数据库里了

这里
<add_commentReturn xsi:type="xsd:int">19</add_commentReturn>
这个19也是正确的返回结果

请问这是为什么呢?怎么解决?
...全文
464 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
TobyLee 2006-06-24
  • 打赏
  • 举报
回复
在PHP里输入XML内容之前加一句header("Content-Type:text/xml");
pellet 2006-06-21
  • 打赏
  • 举报
回复
顺便说一下哦,用php调用该WebService也是没有问题的

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧