prevent web reference from generating object

Hi All,

I need to consume a 3rd party web service. However when adding a web reference to said web service the proxy service that is generated interprests the responses send by the web service in an inconsistant way.

What I would like to do is simply work with the xml responses directly rather than having auto generated code create objects for me that are in essence in an invalid state. And even if I was able to get objects in a valid state then I still would rather work directly with the xml response.

Can someone please help me acheive doing just this?

Kind regards
LVL 2
DaFouAsked:
Who is Participating?
 
alexey_gusevCommented:
usually all web refs proxies are generated in "Web References" subfolder of your project. the each reference is stored under separate folder (by it's name) - so you finally want Reference.cs file.

if you look inside, you'll see your ws proxy inherits from System.Web.Services.Protocols.SoapHttpClientProtocol and also many serialisation attributes.

re. string vs objects - it all depends on the ws, so if it returns xml string then be it, but if not, then that's where serialisation/deserialisation takes place. I'd avoid messing up with serialisation for complex objects, but simple types are fine.
0
 
Éric MoreauSenior .Net ConsultantCommented:
You cannot use a web service without a proxy. there is no way around it.
0
 
alexey_gusevCommented:
well, the previous post (#35308853) is a bit wrong I must say :)

in the worst case you could work at HTTP level with HttpWebRequest thus dealing with all SOAP attributes manually (ie creating all required nodes and attributes for SOAP payload, like envelopes etc etc). Such approach worked for me even with C++ in the early days of Windows Mobile without any support for soap at all. this is not the easiest way, but it works 100% with full control on your side. Here's some example: http://mikehadlow.blogspot.com/2006/05/making-raw-web-service-calls-with.html

you might try to edit generated proxy class (moving it to the other place to avoid overriding).
0
 
DaFouAuthor Commented:
Dear alexey_gusev,

Can you please teach me where the proxy classes are (hidden)located that are responsible for the sending ( after serialisation ) and the receiving ( deserialisation ) of the transports for the different methods exposed by the web service.

Also what is your opinion about this out of the box demand for deserialised responses? Whats wrong with plain old string that can be ( if needed ) parsed into an xml document for quering.

Kind Regards
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.