• We are sorry, but NCBI web applications do not support your browser and may not function properly. More information

NCBI Bookshelf. A service of the National Library of Medicine, National Institutes of Health.

Entrez Programming Utilities Help [Internet]. Bethesda (MD): National Center for Biotechnology Information (US); 2010-.

Cover of Entrez Programming Utilities Help

Entrez Programming Utilities Help [Internet].

Show details

Using Entrez Utilities Web Service with C# and MS Visual Studio 2008

Last Update: November 10, 2010.

Entrez Utilities Web Service has been tested with:

  • Microsoft .NET Framework Version 3.5 SP1
  • Microsoft Visual Studio 2008 Version 9.0.30729.1 SP

Creating a Web Service Client Project

The following walkthrough describes how to create a new C# project to access the NCBI Entrez Utilities Web Service using MS Visual Studio 2008.

To create Windows application:

1.

Press Ctrl+Shift+N or Select File menu, then New, and then click Project to open the New Project dialog.

2.

Select Visual C# in Project types list.

3.

Select Windows Forms Application in Templates list.

4.

Click OK to create a new project.

5.

Select View menu and then Toolbox to open a Toolbox window.

6.

From the Toolbox, drag a Textbox and a Button to the design surface of Form1. Set Textbox’ Multiline property to true.

7.

On the Project menu, click Add Service Reference.

8.

In the Address field of the Add Service Reference dialog, type the URL http://eutils.ncbi.nlm.nih.gov/soap/v2.0/eutils.wsdl or path to local file (for example, C:\SOAP\eUtils\v2.0\eutils.wsdl) if you downloaded eUtils WSDL/XSD files from our FTP site

9.

Click the Go button to retrieve information about the XML Web service.

10.

In the Namespace field type eUtils.

11.

Click OK. The new eUtils item will appear in Service References list in the Solution Explorer view.

12.

Double-click the button on Form1 to create an event-handling method for this button.

13.

In the button1_Click method enter the following code:
// eInfo utility returns a list of available databases
try
{
eUtils.eUtilsServiceSoapClient serv = new eUtils.eUtilsServiceSoapClient();
// call NCBI EInfo utility
eUtils.eInfoResult res = serv.run_eInfo(new eUtils.eInfoRequest());
// results output
textBox1.Text = "";
for(int i=0; i<res.DbList.Items.Length; i++) {
textBox1.Text += res.DbList.Items[i]+"\r\n";
}
}
catch (Exception eee)
{
textBox1.Text = eee.ToString();
}

14.

Build and run application.

Important: Currently, the default maximum length of the SOAP message is only 64Kb. C# application fails when Web Service response size exceeds this value. To increase the limit open app.config file located in the application’s root directory and change all maxReceivedMessageSize and maxBufferSize parameters to the same larger value, for example, 2000000.

NCBI Entrez Utilities Web Service API

Below is a list of available methods.

Click on parameter to get its description.

Click on method name to see the usage example.

public Result run_eGquery(eGqueryRequest params)

eGqueryRequest class properties:

public eInfoResult run_eInfo(eInfoRequest params)

eInfoRequest class properties:

public eLinkResult run_eLink(eLinkRequest params)

eLinkRequest class properties:

public ePostResult run_ePost(ePostRequest params)

ePostRequest class properties:

public eSearchResult run_eSearch(eSearchRequest params)

eSearchRequest class properties:

public eSpellResult run_eSpell(eSpellRequest params)

eSpellRequest class properties:

public eSummaryResult run_eSummary(eSummaryRequest params)

eSummaryRequest class properties:

public eFetchResult run_eFetch(eFetchRequest params)

eFetchRequest class properties:

Properties available for Sequence databases:

Examples

PubReader format: click here to try

Views

Other titles in this collection

Recent Activity

Your browsing activity is empty.

Activity recording is turned off.

Turn recording back on

See more...