开发者

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

开发者 https://www.devze.com 2022-12-20 21:58 出处:网络
I\'m trying to consume a SOAP web service WSDL in ASP.Net(C#) from https://secure.ultracart.com/axis/services/AffiliateServiceV1?wsdl

I'm trying to consume a SOAP web service WSDL in ASP.Net(C#) from https://secure.ultracart.com/axis/services/AffiliateServiceV1?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:

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 res开发者_运维知识库ponseStream, 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...

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(); ?

I've never worked with SOAP before, but I've looked over many examples on the web and this error shouldn't be happening....

thank you so much if you can help! I really wish i knew how "Web Referances" in asp.net actually worked (i.e. .net's code behind this), thanks!


The .Net Framework has a hard time deserializing Axis classes in its automated proxy generation. This article may help. It talks about using a custom soap parser to handle this manually.

Invoking a Java/AXIS Web Service from .NET

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号