WebException:服务器违反了协议。 Section=ResponseStatusLine(调用 Marketo SOAP API)
我正在尝试调用 Marketo SOAP Web 服务 通过 ASP.NET / C#。 我成功添加了 Web 服务引用并尝试使用这行代码调用它:
SuccessGetLead lead = service.getLead(paramsgetlead);
问题是我也遇到此异常:
[WebException:服务器违反了协议。部分=ResponseStatusLine]
System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest请求)+263
System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest请求)+4
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(字符串方法名,对象[]参数)+172
com.marketo.soap.MktMktowsApiService.getLead(ParamsGetLead paramsGetLead) 在 c:\Users\hubert.grininger\AppData\Local\Temp\Temporary ASP.NET Files\dynaweb2007\82e21235\d41bf12a\App_WebReferences.liqikruc.7 中。 CS:206
_test_marketo.Page_Load(对象发送者,EventArgs e)位于 d:\workspace_c\dynaweb2007_test\marketo.aspx.cs:48
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp,对象o,对象t,EventArgs e)+14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(对象发送者,EventArgs e)+35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(布尔 includeStagesBeforeAsyncPoint,布尔 includeStagesAfterAsyncPoint)+627
我也尝试添加
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing = "true" />
</settings>
</system.net>
,但这也没有帮助。
我认为请求从未发送到 Marketo,但错误已经发生在我这边。
感谢您的任何帮助或提示。
I'm trying to call the Marketo SOAP Webservice
via ASP.NET / C#.
I successfully added the web service reference and tried to call it with this line of code:
SuccessGetLead lead = service.getLead(paramsgetlead);
The problem is I also get this exception:
[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
I also tried adding
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing = "true" />
</settings>
</system.net>
but that didn't help either.
I think the request is never sent to Marketo but the error already occurs on my end.
Thanks for any help or hint.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解决了。问题是 wsdl(由 Marketo 提供)错误地将 localhost 指向作为 Web 服务端点。
我通过 WebServiceObject.Url 属性以编程方式设置 URL,现在它可以工作了。
Solved. Problem was that the wsdl (provided by Marketo) wrongly pointed to localhost as webservice endpoint.
I programmatically set the URL via WebServiceObject.Url property and it works now.
只需尝试使用 HTTP/1.0 而不是 HTTP/1.1
看看下面的代码
它对我有用;-)
Just try to use HTTP/1.0 instead of HTTP/1.1
look at the following code
It worked for me ;-)