Reputation: 188
I have been trying to figure this our for far too long and I cannot get my head around it. Every example I have seen seems to be far more complex that I need.
I have a web service in my project (.asmx). I want to call it very simply from a button on a webpage.
Can someone show me a simple example in vb, or even something they think will help me better understand what I need to do?
Upvotes: 0
Views: 1280
Reputation: 5650
Using the jQuery library (not the only option, but a darn good one) vastly simplifies this problem. Here's an example of what to put in your button's onclick event:
$.post('MyWebService.asmx', '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Contact xmlns="http://mywebsite.com/">
<firstName>string</firstName>
<lastName>string</lastName>
</Contact>
</soap:Body>
</soap:Envelope>');
More info here: http://api.jquery.com/jQuery.post/
Upvotes: 1