C#调用WebService如何设定请求的Content Type?(可私下给你300~500分)

softdoctor 2003-07-07 08:12:09
我有很多可用分,一定要帮我解决这个问题。

下面是错误信息:

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Protocol</faultcode>
<faultstring>Unsupported content type "application/x-www-form-urlencoded", must be: "text/xml".</faultstring>
<faultactor>/ui/servlet/rpcrouter</faultactor>
</SOAP-ENV:Fault>

</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
...全文
1218 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
softdoctor 2003-07-11
  • 打赏
  • 举报
回复
解决了
softdoctor 2003-07-08
  • 打赏
  • 举报
回复
紧急呼救
public class Web2: System.Web.Services.Protocols.HttpPostClientProtocol
{

[System.Diagnostics.DebuggerStepThroughAttribute()]
public Web2()
{

this.Url = "http://159.226.248.204:8900/ui/servlet/rpcrouter";
}

[System.Web.Services.Protocols.HttpMethodAttribute(typeof(System.Web.Services.Protocols.XmlReturnReader), typeof(System.Web.Services.Protocols.HtmlFormParameterWriter))]
[return: System.Xml.Serialization.XmlRootAttribute("double", Namespace="urn:test.math.sin", IsNullable=false)]
public double getSinValue(System.Double input)
{
//object[] results = this.Invoke("getSinValue", new object[] { input});
//return ((double)(results[0]));
return ((double)(this.Invoke("getSinValue", (this.Url + ""), new object[] {input})));
}
}

怎么设ContentType?
ywqzxj 2003-07-08
  • 打赏
  • 举报
回复
[WebMethod]
public double getSinValue(System.Double input)
{
//object[] results = this.Invoke("getSinValue", new object[] { input});
//return ((double)(results[0]));
return ((double)(this.Invoke("getSinValue", (this.Url + ""), new object[] {input})));
}

12,162

社区成员

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

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