Reputation: 2613
I have created a form web site in Visual Studio. I want to send an XML message with the data of the form to another web service. How would I do this?
(I'm sorry if my question is too easy, I'm just doing this exercise for my university and I haven't worked on web services before!)
Upvotes: 0
Views: 5605
Reputation: 2848
Web-services are always called with XML messages. What I'm not sure from your question is whether you are meant to get Visual Studio to auto-generate a web-service proxy (by adding a web-reference) in your web-forms project, or if you need to create and post the XML to the web-service over HTTP yourself explicitly.
In the first case you need to add a web-reference to your project and point it at the URL of the service you need to call. You can then interact with this as if it is a method within your project. The nuts and bolts of your call being converted to XML and suchlike is hidden from you in this instance. The following step by step guide is an example: http://www.codeproject.com/KB/webservices/WebServiceConsumer.aspx
The alternative is that you need to build the SOAP / XML message yourself and perform an HTTP web request to post the XML content to the web-service. This is a lower level task, but would give a better understanding of the mechanics of what is actually taking place when the call is performed.
Upvotes: 2