简体   繁体   English

在ASP.Net中使用SOAP:org.xml.sax.SAXException:…找不到类型的反序列化器

[英]consuming SOAP in ASP.Net: org.xml.sax.SAXException: …could not find deserializer for type

I'm trying to consume a SOAP web service WSDL in ASP.Net(C#) from https://secure.ultracart.com/axis/services/AffiliateServiceV1?wsdl 我正在尝试从https://secure.ultracart.com/axis/services/AffiliateServiceV1?wsdl在ASP.Net(C#)中使用SOAP Web服务WSDL

so in Visual Studio 2008 in Asp.Net I right-click and "Add Web Reference..." and I feed it my WSDL url and it seams to add it ok to the project, and the classes show up in IntelliSense fine, so I write the fallowing code: 因此,在Asp.Net中的Visual Studio 2008中,我右键单击并单击“添加Web引用...”,然后将其输入WSDL URL,并通过接缝将其添加到项目中,并在IntelliSense中正常显示类,因此我写下面的代码:

using com.ultracart.secure;


var affiliateService = new AffiliateServiceService();
var cridtials = new Credentials() { login = "username", password = "password", merchantId = "MERID", };
var resultAffiliate = affiliateService.getAffiliateByEmail(cridtials, "email@example.com");

and try to run it, but I get this error: 并尝试运行它,但出现此错误:

org.xml.sax.SAXException: Deserializing parameter 'c':  could not find deserializer for type {http://v1.ultraship.soap.api.ultracart.bpsinfo.com}Credentials

Exception Details: System.Web.Services.Protocols.SoapException: org.xml.sax.SAXException: Deserializing parameter 'c':  could not find deserializer for type {http://v1.ultraship.soap.api.ultracart.bpsinfo.com}Credentials

Source Error: 

Line 239:        [return: System.Xml.Serialization.SoapElementAttribute("getAffiliateByEmailReturn")]
Line 240:        public Affiliate getAffiliateByEmail(Credentials c, string email) {
Line 241:            object[] results = this.Invoke("getAffiliateByEmail", new object[] {
Line 242:                        c,
Line 243:                        email});

Source File: c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website1\f651361a\a12a13b7\App_WebReferences.juj3lvko.0.cs    Line: 241 

Stack Trace: 

[SoapException: org.xml.sax.SAXException: Deserializing parameter 'c':  could not find deserializer for type {http://v1.ultraship.soap.api.ultracart.bpsinfo.com}Credentials]
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +431714
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +204
com.ultracart.secure.AffiliateServiceService.getAffiliateByEmail(Credentials c, String email) in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website1\f651361a\a12a13b7\App_WebReferences.juj3lvko.0.cs:241
Class1.makeaff() in c:\Users\~\Documents\Visual Studio 2008\WebSites\WebSite1\App_Code\Class1.cs:25
Handler.ProcessRequest(HttpContext context) in c:\Users\~\Documents\Visual Studio 2008\WebSites\WebSite1\Handler.ashx:10
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

my question is, does this error happen after it makes the request to the server and the server returns something back and it's invalid or what is happening here? 我的问题是,在向服务器发出请求并且服务器返回了某些内容后,此错误发生了吗?或者它是无效的? ...and of course is there anything I can do to make it work properly? ...当然可以做些什么使它正常工作?

I'm about ready to implement my own interface to this that parses the xml and sends/receives the correct response... 我即将准备实现自己的接口来解析xml并发送/接收正确的响应...

I found this same type of error around the internet but no-one seams to ever answer them... is there something I should be doing when creating an instance of new AffiliateServiceService(); 我在互联网上发现了相同类型的错误,但是没有一个接缝可以回答它们……在创建新的AffiliateServiceService()的实例时我应该做些什么? ?

I've never worked with SOAP before, but I've looked over many examples on the web and this error shouldn't be happening.... 我以前从未使用过SOAP,但是我在网络上查看了许多示例,因此不应发生此错误。

thank you so much if you can help! 非常感谢您的帮助! I really wish i knew how "Web Referances" in asp.net actually worked (ie .net's code behind this), thanks! 我真的希望我知道asp.net中的“ Web参考”实际上是如何工作的(即,.net背后的代码),谢谢!

The .Net Framework has a hard time deserializing Axis classes in its automated proxy generation. .Net Framework很难在其自动代理生成中反序列化Axis类。 This article may help. 本文可能会有所帮助。 It talks about using a custom soap parser to handle this manually. 它讨论了使用自定义肥皂分析器手动处理此问题。

Invoking a Java/AXIS Web Service from .NET 从.NET调用Java / AXIS Web服务

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM