My first idea was to try to access the web service using jQuery. I felt that if I could successfully invoke the web service using jQuery or JavaScript, this would demonstrate that Microsoft technology wasn't necessary to use my service. However, I found that calling a SOAP based web service from client side scripting is not an easy task. In fact, I never got this to work, and there is not a lot of information out there about how to do this. One problem is that browsers have security measures to stop cross site scripting. So the web service has to be part of the same site. If you can get past that, you also have to manually build the SOAP envelope in your javascript which is tedious. On top of that you have to figure out how to specify your logon credentials within the request. I concluded that it is just not practical to call a SOAP service from the client. I think this is where the advantages of using a REST style web service really pay off.
I discovered a widely used application called SoapUI. It is a free download, and you can use it to invoke the methods of your web service for testing purposes. This is a way to independently test your web service operations without being bound to Microsoft.
Installation is straight forward and instructions can be found on the site. Note that you do not need to install Hermes if you're not testing a Java service.
Here is how to test a web service operation.
- Open SoapUI and right click on Projects, New SOAP Project.
- Name the project and specify the address of the WSDL of your service.
- Check the box that says Create Sample Requests.
- In the navigator, you'll see each operation of the service. If you click the plus sign next to each operation you will see the sample request that was created for you.
- Click on the request and find the request properties.
- If the web service security is set up for TransportWithMessageCredential, then set the username and password properties to something that works. Also set the WSS-Password Type to PasswordText.
- Double-click the request.
- In the request window, you'll see the SOAP envelope. You can see where the parameters go, and can set these here.
- Then, click the green arrow which sends the request to the web service.
- The results will be shown in the right-hand pane.
No comments:
Post a Comment