Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

WSO2 Governance Registry can be used as a SOA Registry to store artifacts such as WSDL, Schema and Policy. You can point to the WSO2 Governance Registry using Microsoft Visual Studio and build Web Service Clients using the .NET framework in a few easy steps. Read more to understand how to connect to WSO2 Governance Registry from Visual Studio to discover Web Services and build clients.

...

Code Block
sh wso2server.sh

See Starting Governance Registry Management Console on Windows or Starting Governance Registry Management Console on Linux.

Info
titleTip

Though this sample will only work in a Windows environment, the WSO2 Governance Registry server can run on a Linux Server.

...

We assume that you already have added or imported a few WSDLs in WSO2 Governance Registry installation. See Managing WSDLs to learn more on how you could upload or import WSDL files into Governance Registry.

...

1. Launch Visual Studio and create a new Console Application.

Image RemovedImage Added

 2. Right-click on the References section and select Add Service Reference.

Image RemovedImage Added

3. Click on the Advanced button on the Add Service Reference dialog box.

Image RemovedImage Added

4. In the Service Reference Settings screen select Add Web Reference.

Image RemovedImage Added

5. In the Add Web Reference dialog box, type the Management Console URL (in our example we have used  https://localhost:9443/carbon) and click the Go button.

Image RemovedImage Added

6. The WSO2 Governance Registry homepage opens within Visual Studio.

Note
titleNotice

A situation may occur in which Visual Studio displays an insecure connection message, requiring the user's confirmation to proceed.

Image RemovedImage Added

The WSO2 Governance Registry Management Console is based on HTTPS protocol, which is a combination of HTTP and SSL protocols. This protocol is generally used to encrypt the traffic from the client to server for security reasons. The certificate with which it works is used for encryption purposes only and does not verify the server's identity. So, when users try to access the WSO2 Governance Registry Management Console, they may receive a warning that they are trying to connect to an untrusted connection. In order to continue working with this certificate, you must "accept" the certificate before access to the site is permitted. Please note that an insecure connection warning may be displayed every time the server is accessed.

This scenario is suitable for testing purposes or for running the program on a company's internal networks. But in cases where there is a need to provide an interface to the outside world, a company should obtain a certificate signed by a well-known CA. The role of a CA is to verify that the server accessed actually has the name by which it is accessed and that this server actually belongs to the given organization.

7. Once you have established a connection to the WSO2 Governance Registry, you will be prompted for a "Username" and "Password." Type in default "admin" as the "Username" and "admin" as the "Password." Click "Sign-in."

Image RemovedImage Added

8. This should bring up the bring up the home screen of the WSO2 Governance Registry Management Console.

Note
titleNotice

A situation may occur in which Visual Studio appears to hang while trying to search for Web Services.

Image RemovedImage Added

The embedded browser of Microsoft Visual Studio has been specifically designed to search for Web Services deployed on remote web sites. However, the process of searching can take longer than anticipated and can become frustrating to a user. If such happens, please click on the Stop button, which will make the current page load almost instantly.

Visual Studio might also present you with error messages asking your consent on running scripts.

Image RemovedImage Added

Please click on Yes if prompted. The embedded browser of Microsoft Visual Studio is not as advanced as a typical web browser that you find today, and might run into difficulties when running complex Java Scripts. Our use of the WSO2 Governance Registry through Visual Studio does not require these scripts to run, and so it is safe to continue despite some script errors.

Please note that you might have to repeat one or both of these steps while following the rest of these guidelines.

Image RemovedImage Added

9. Navigate to the WSDL List page and select the SimpleStockQuoteService.wsdl file to open it in the Resource Browser.

Image RemovedImage Added

10. Expand the metadata section after the page has completely loaded.

Image RemovedImage Added

11. Right-click on the HTTP permalink and select Copy Shortcut.

Image RemovedImage Added

12. Replace the URL by clicking on it to selecting it, then right-clicking and finally selecting Paste.

Image RemovedImage Added

13. Click to Go button to open the WSDL within the embedded browser of Microsoft Visual Studio.

Image RemovedImage Added

14. Visual Studio will present you with a security challenge when accessing the permalink requiring you to provide your credentials. Type in default "admin" as the "Username" and "admin" as the "Password." Click the OK button.

Image RemovedImage Added

Note
titleNotice

Microsoft Visual Studio will prompt you with a warning on your credentials being forwarded to the server via clear text. Click Yes to ignore (or read below on how to avoid this check). You also might be requested to provide your credentials again.

Image RemovedImage Added

The WSO2 Governance Registry uses HTTP Basic Authentication between client and server when you are using HTTP and HTTPS permalinks. If it is a risk to provide your credentials to access these resources please consider granting anonymous read permissions to the WSDL resource and its dependencies. See Managing Role Permissions for more information on how grant READ access to wso2.anonymous.role.

15. Microsoft Visual Studio will now complete discovering the Web Service. Click the Add Reference button to complete the operation.

Image RemovedImage Added

16. The Web Reference should now be added to your project in Microsoft Visual Studio.

Image RemovedImage Added

17. Double-click on the name of the Web Reference to open it and start working with it in your .NET application. The name is WebReference in this case.

Image RemovedImage Added

Info
titleInfo

You can repeat the same steps to add more Web Service clients. Please note that the same steps can be followed for projects of types other than Console Application and we have taken it only as an example.

Excerpt
hiddentrue

General information about using Microsoft Visual Studio to discover Web Services on WSO2 Governance Registry and build clients.