![]() |
Table of Contents
Visual Basic .NETIntroductionVisual Basic .NET is the most popular programming language on the .NET framework. For more details of the .NET platform and the development environments see our .NET tutorial. Microsoft .NET SDK and MonoCreate Service Stubs
From the service WSDL (e.g. http://www.ebi.ac.uk/ws/services/WSDbfetch?wsdl) generate stub classes using the wsdl /l:VB "http://www.ebi.ac.uk/ws/services/WSDbfetch?wsdl" Use ServiceThen in the program create an instance of the service object: Dim Dbfetch As WSDBFetchServerService = New WSDBFetchServerService()
This object provides methods corresponding to those defined in the WSDL so to call the Dim result As String result = Me.Dbfetch.fetchData("UNIPROT:ADH1A_HUMAN", "default", "raw")
The Console.Write(result) Compile Program
Once the program has been completed, it needs to be compiled. Assuming the program is in a file called Microsoft .NET SDKvbc wsdbfetch.vb WSDBFetchServerService.vb Monovbnc wsdbfetch.vb WSDBFetchServerService.vb Run the Program
The resulting MS Windows, assuming the .NET runtime is installed: wsdbfetch.exe Non-Windows Mono environments: mono wsdbfetch.exe Note: some non-Windows environments (e.g. Linux) can be configured to support direct execution of .NET programs, allowing the use of the Windows style method. Using Data Structures
The methods in the WSDbfetch service all use simple string parameters. Many of the other EBI services use more complex input structures. For example WSInterProScan requires a structure containing the various parameters and the input sequence to be passed to the ' The input parameters Dim input As inputParams = New inputParams() ' Set the required parameters input.email = "your@email" input.async = True input.seqtype = "p" input.crc = true ' The input data Dim content As data() content = New data(0) {} content(0) = New data() ' Input type content(0).type = "seqeunce" ' Input data content(0).content = ">Q8E5Q5_STRA3" & Environment.NewLine & _ "MKLSKRYRFWQKVIKALGVLALIATLVLVVYLYKLGILNDSNELKDLVHKYEFWGPMIFI" & Environment.NewLine & _ "VAQIVQIVFPVIPGGVTTVAGFLIFGPTLGFIYNYIGIIIGSVILFWLVKFYGRKFVLLF" & Environment.NewLine & _ "MDQKTFDKYESKLETSGYEKFFIFCMASPISPADIMVMITGLSNMSIKRFVTIIMITKPI" & Environment.NewLine & _ "SIIGYSYLWIYGGDILKNFLN" ' Submit the job Dim InterProScan As WSInterProScanService = New WSInterProScanService() Dim jobId As String = InterProScan.runInterProScan(input, content) Console.WriteLine(jobId)
The Dim status As String = "PENDING" ' Check status and wait if not finished While status = "RUNNING" OrElse status = "PENDING" status = InterProScan.getStatus(jobId) Console.WriteLine(status) If status = "RUNNING" OrElse status = "PENDING" Then ' Wait before polling again. System.Threading.Thread.Sleep(15000) End If End While ' Get results Dim res As Byte() = InterProScan.poll(jobId, "toolraw") ' Convert result into a string for output Dim enc As New System.Text.ASCIIEncoding() Dim tempStr As String = enc.GetString(res) ' Output the result Console.Write(tempStr) Integrated Development Environment (IDE)MonoDevelopMonoDevelop: http://monodevelop.com/ To generate web service stubs (“Web Reference”) using MonoDevelop:
For an example see: https://vtluug.org/wiki/MonoDevelop SharpDevelopSharpDevelop: http://sharpdevelop.net/OpenSource/SD/ To generate web service stubs (“Web Reference”) using SharpDevelop:
For an example see: http://community.sharpdevelop.net/blogs/mattward/pages/AddingAndRemovingWebReferences.aspx Visual Studio
Visual Studio 2005To generate web service stubs (“Web Reference”) using Visual Studio 2005 (http://msdn.microsoft.com/en-us/library/d9w023sx(v=vs.80).aspx):
Visual Studio 2008 & 2010
From Visual Studio 2008 onwards Windows Communication Foundation (WCF) based “Service Reference” are used by default. It is possible to generate a Sample ClientsMost SOAP Web Services at EMBL-EBI have sample clients which provide command-line access to the service and example code. For .NET some of the clients are implemented in Visual Basic .NET, for example: Document/literal SOAP
RPC/encoded SOAP
![]() |