开发者

calling a webservice and deserializing soap without a wsdl

开发者 https://www.devze.com 2023-04-03 22:27 出处:网络
I have a vendor who doesn\'t seem to have a wsdl or is unwilling or doesn\'t know开发者_如何转开发 how to provide it. They have a number of web services (technically they are JSPs that return soap mes

I have a vendor who doesn't seem to have a wsdl or is unwilling or doesn't know开发者_如何转开发 how to provide it. They have a number of web services (technically they are JSPs that return soap messages) and I need to use about 10-15 of these to get my stuff done.

Since there isn't a WSDL, I can't use the 'add web reference' functionality to generate proxy classes and such. I've gotten around this by using WebClient to make the calls and return the response as a string, but now I need to deserialize the response into client classes.

I've already made c# classes to match the xml that's returned, but I'm not sure how to deserialize from SOAP since there's so much xml noise. I could strip the SOAP envelope tags and then use the XML serializer to deserialize to a List<SomeType>, but that seems really dirty. Is there a nicer way?


i published an article detailing on how to deserialize a complex xml.

here is the link : http://blog.impact-works.com/2011/06/30/how-to-serializedeserialize-complex-xml-in-asp-net-c/

hope it helps


Have you tried using SoapFormatter.Deserialize() for deserializing the response. If so, this would be helpful. http://msdn.microsoft.com/en-us/library/system.runtime.serialization.formatters.soap.soapformatter.deserialize(v=vs.71).aspx

0

精彩评论

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