0

I'm involved in a project that would call a webservice dynamically.

I have figured out a way to call a webservice method that has no method parameters on it, but now what I need is for me to call web methods that have parameters on it.

Was wondering if there are good examples on how I could create a soap envelope and how I could include this in my HttpWebRequest?

Thank you so much!

Cheers, Ann

mallows98
  • 1,529
  • 4
  • 22
  • 37
  • Even if you knew the structure of the envelope, how would you know what data to put into it? – John Saunders Sep 17 '09 at 14:51
  • I basically know which data that needs to be passed in-between web services as I've written both web services. I don't think that the data parameters that I need to pass will change often so I've got a full definition of what data it needs. – mallows98 Sep 17 '09 at 16:53

2 Answers2

0

What about serialization with SoapFormatter?

SoapFormatter Class

You can also use strong typed classes by using interfaces and dynamicaly loaded assemblies via

Assembly a = Assembly.LoadFile("Path");

and you'll be able to "hot plug" new proxies or other types.

Jan Remunda
  • 7,840
  • 8
  • 51
  • 60
  • Will try doing this. Thanks for this! :) – mallows98 Sep 17 '09 at 16:53
  • Hi mallows98, Were you able to solve this problem? I had a similar issue here: http://stackoverflow.com/questions/1609294/invoking-an-asp-net-web-service-method-via-an-http-request – Tola Odejayi Nov 08 '09 at 22:13
  • Hi Shoko, No, I've basically re-designed my code and used the standard web services pattern where you need to set your web service as dynamic and making sure that all method signatures that I will be accessing for my web services are of the same name. Reason that I've re-designed my code is because I was running out of time for the project and I need to do something fast. Hope this helps! – mallows98 Nov 22 '09 at 20:25
-1

Is there any reason you want to generate SOAP envelopes manually and use HttpWebRequest to call a web service when you could generate a client proxy from the WSDL (using svcutil.exe or wsdl.exe) and let the framework do the heavy lifting for you?

Normally web services expose a contract that describes the operations you can invoke and the types that are involved allowing clients to discover it and use it.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • 1
    Thank you for your answer. There is a reason why I need to do it manually... I'm creating a generic email generator/sending service that will pull out email data from different clients. I have considered generating a proxy from the WSDL, but I'm assuming that the downside of it is that if we try to add a new stakeholder web app that would need to send emails I might need to recompile the code again every single time. I might be wrong in this assumption, but if you could suggest any other way that I could do this, I would really appreciate it! Cheers! – mallows98 Sep 17 '09 at 06:17