gpt4 book ai didi

c# - WebException : The server committed a protocol violation. Section=ResponseStatusLine(调用 Marketo SOAP API)

转载 作者:行者123 更新时间:2023-11-30 14:18:34 25 4
gpt4 key购买 nike

我正在尝试调用 Marketo SOAP Web 服务通过 ASP.NET/C#。我成功添加了 Web 服务引用并尝试使用这行代码调用它:

SuccessGetLead lead = service.getLead(paramsgetlead);

问题是我也遇到了这个异常:

[WebException: The server committed a protocol violation. Section=ResponseStatusLine]

System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request) +263

System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request) +4

System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +172

com.marketo.soap.MktMktowsApiService.getLead(ParamsGetLead paramsGetLead) in c:\Users\hubert.grininger\AppData\Local\Temp\Temporary ASP.NET Files\dynaweb2007\82e21235\d41bf12a\App_WebReferences.liqikruc.7.cs:206

_test_marketo.Page_Load(Object sender, EventArgs e) in d:\workspace_c\dynaweb2007_test\marketo.aspx.cs:48

System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14

System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35

System.Web.UI.Control.OnLoad(EventArgs e) +99

System.Web.UI.Control.LoadRecursive() +50

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

我也试过添加

<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing = "true" />
</settings>
</system.net>

但这也没有帮助。

我认为请求从未发送到 Marketo,但错误已经在我这边发生了。

感谢您的帮助或提示。

最佳答案

已解决。问题是 wsdl(由 Marketo 提供)错误地将 localhost 指向 web 服务端点。我通过 WebServiceObject.Url 属性以编程方式设置 URL,它现在可以工作了。

关于c# - WebException : The server committed a protocol violation. Section=ResponseStatusLine(调用 Marketo SOAP API),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4279070/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com