eBay的C#SDK不单声道工作 [英] eBay C# SDK doesn't work on Mono
问题描述
我下载了eBay SDK开发用于我们正在开发一个内部应用程序。美中不足的是,我们正在开发的单声道。当我运行在.NET上易趣的Hello World样本,它会显示以下输出:
I downloaded the eBay SDK for use in an internal application we are developing. The catch is we are developing on Mono. When I run the eBay Hello World sample on .NET, it displays the following output:
+++++++++++++++++++++++++++++++++++++++
+ Welcome to eBay SDK for .Net Sample +
+ - HelloWorld +
+++++++++++++++++++++++++++++++++++++++
Begin to call eBay API, please wait ...
End to call eBay API, show call result:
eBay official Time: 11/27/2013 3:02:19 PM
当我使用Mono运行它,我得到了以下内容:
When I run it with Mono, I get the following:
Unhandled Exception: eBay.Service.Core.Sdk.ApiException: Exception has been thrown by the target of an invocation.
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.InvalidOperationException: WebServiceBindingAttribute is required on proxy class 'eBay.Service.Core.Sdk.eBayAPIInterfaceService2'.
at System.Web.Services.Protocols.SoapTypeStubInfo..ctor (System.Web.Services.Protocols.LogicalTypeInfo logicalTypeInfo) [0x00000]
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (object,object[],System.Exception&)
etc...etc...etc...
我找到了一个解决办法,将它张贴在下面的答案。
I found a workaround and will post it in an answer below.
推荐答案
我搜索Xamarin的Bugzilla的一无所获,但我发现张贴在Novell的旧黑白的Bugzilla此相关的bug: HTTPS://bugzilla.novell。 COM / show_bug.cgi?ID = 693367
I searched Xamarin's Bugzilla and found nothing, but I found this relevant bug posted in Novell's old Mono Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=693367
于是我通过eBay的SDK源挖出,发现这确实是问题。 eBay.Service.Core.Sdk.eBayAPIInterfaceService2
从 eBay.Service.Core.Sdk.eBayAPIInterfaceService
继承,这是装饰以 System.Web.Services.WebServiceBindingAttribute
。
So I dug through the eBay SDK source and found that this was indeed the issue. eBay.Service.Core.Sdk.eBayAPIInterfaceService2
inherits from eBay.Service.Core.Sdk.eBayAPIInterfaceService
, which is decorated with a System.Web.Services.WebServiceBindingAttribute
.
于是我改变了 eBay.Service .Core.Sdk.eBayAPIInterfaceService2
,加入 [System.Web.Services.WebServiceBindingAttribute(NAME =eBayAPISoapBinding,命名空间=瓮:易趣:蜜蜂:eBLBaseComponents)]
,以便它现在看起来如下:
So I changed eBay.Service.Core.Sdk.eBayAPIInterfaceService2
, adding [System.Web.Services.WebServiceBindingAttribute(Name = "eBayAPISoapBinding", Namespace = "urn:ebay:apis:eBLBaseComponents")]
so that it now looks like the following:
using System;
using System.Net;
using eBay.Service.Core.Soap;
namespace eBay.Service.Core.Sdk {
/// <summary>
/// Enhanced eBayAPIInterfaceService with GZIP compression support.
/// </summary>
[System.Web.Services.WebServiceBindingAttribute(Name = "eBayAPISoapBinding", Namespace = "urn:ebay:apis:eBLBaseComponents")]
internal class eBayAPIInterfaceService2 : eBayAPIInterfaceService {
...
}
}
我也跟着在eBay SDK开发的指示从建设。来源和问题解决了。
I followed the instructions in the eBay SDK for building from the sources and the problem was solved.
脚注:顺便说一句,如果这是你第一次使用单声道连接到HTTPS Web服务,你可能会立即运行到另一个例外。这人会是这样的:
Footnote: Incidentally, if this is your first time using Mono to connect to an HTTPS web service, you will likely immediately run into another exception. That one will look like this:
Unhandled Exception: System.Net.WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
有关解决了,去这里: http://www.mono-project.com/FAQ:_Security
For the solution to that, go here: http://www.mono-project.com/FAQ:_Security
这篇关于eBay的C#SDK不单声道工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!