调用“SOAP扩展”出错
扩展类:
public class soaploggerattribute:soapextensionattribute
public class soaplogger:soapextension
webmethod:
[webmethod,soaplogger]
public author getauthorinfo()
直接使用web服务测试页,调用一切正常;
在aspx调用:
private void button1_click(object sender, system.eventargs e)
{
myauthor=mysample.getauthorinfo();
}
出错:
客户端发现响应内容类型为“”,但应该是“text/xml”。
说明: 执行当前 web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: system.invalidoperationexception: 客户端发现响应内容类型为“”,但应该是“text/xml”。
请问各位我应如何设置?
推荐阅读
the error doesnt mean anything, since you said it was ok to access the web service through the browser
what if you remove the soapextension, does it still work?
most likely, its your soapextension code that corrupted the outgoing soap message. (soapextension is skipped when you are using web test page, which uses http get).


讨论区