Version 8.2.1
 —  Natural Business Services Visual Studio Add-in  —

Using the Visual Studio Add-in

Using the Natural Business Services Visual Studio add-in, you can perform the following tasks:


Configure Connections

Before you can use the Natural Business Services Visual Studio add-in, you must define connections to a remote repository.

Start of instruction setTo configure a connection:

Connections Tab

Use the Connections tab to view, edit, delete, or add connections. These connections define communication paths and options to remove business service repositories running on a Natural server. The Connections tab lists the available connections on the left side and details about the current selected connection on the right (under Settings).

This section covers the following topics:

Add a Broker Connection

A Broker connection uses the EntireX communication protocol to connect to Natural Business Services servers running in Natural. This type of connection is suitable for developing, testing, and running Natural Business Services applications.

Tip:
If you have an existing connection that is similar to the one you want to add, you can copy the connection and then modify it to suit your requirements. For information, see Copy an Existing Connection.

Start of instruction setTo add a Broker connection:

  1. Select New on the Configuration Utility panel.

    Note:
    You can also open the context menu for an existing connection and select New on the submenu.

    A menu is displayed.

  2. Select Broker connection.

    A blank Broker connection is loaded on the right side. For example:

    graphics/connections-tab-add-broker-connection.png

  3. Type the Broker ID.

    Tip:
    If you have a Natural Business Services server on the mainframe, you cannot use the IP address in your configuration files for the Broker ID. Use the actual broker name and define the IP address in your hosts file if necessary. If you use the IP address, you may receive the EntireX communicator error message '20/186 API Char "." or "," not allowed in ACI CB' when downloading metadata.

  4. Type the TCP/IP port number the EntireX broker is running on.

    Note:
    If you intend to define the port in your Windows services file, leave this option blank.

    Optionally, you can specify the following information:

    Setting Description
    Connection ID Unique name of the server component that provides communications between the client and server. This name is listed in the Business Service Explorer and used in code when creating connections to business services. All communications are done by Connection ID.
    Secure server Select this option if the server is running Natural Security or Natural Business Services security and a password must be transported in the communication buffer.

    Note:
    If you select this option, also select Encryption.

    Encryption Select this option to encrypt messages transported to and from the server. This value is based on the EntireX ACI settings for encryption.
    Compression Select this option to compress messages at a specified level. This value is based on the EntireX ACI settings for compression.

    Note:
    The higher the level, the more CPU processing is required to compress and decompress the message. As this may end up saving a lot of network bandwidth, it is worth the CPU trade off in most instances.

    Kernel security Select this option to use Broker security for the EntireX server. If you are not sure which security is used, you can leave this setting on Auto. To achieve the best network performance, however, you should select Yes or No.
    Server class EntireX server class defined for your business services. If you do not know this value, ask your Natural Business Services administrator.
    Dispatcher, CFactory, Attach, and Security Timestamp server names of the four Natural Business Services runtime servers. Leave these values as the defaults; only your Natural Business Services administrator should change these values.
  5. Select OK to save your new Broker connection.

  6. Open the context menu for the Connections node in the Business Service Explorer.

  7. Select Refresh on the submenu.

    The connection is added to the list of available connections.

Environment Tab

This tab contains the System Files and Step Libraries tables for your new Broker connection. For example:

graphics/connections-tab-environment-tab.png

Use this tab to override the current defaults used in the Natural Business Services server environment.

Note:
Unless you have a compelling reason to override the defaults, we recommend that you do not change the defaults.

Optional Tab

This tab defines optional settings for your business service connections. For example:

graphics/connections-tab-optional-tab.png

Use this tab to define the following optional settings for your new connection:

Setting Description
Timeout Timeout value used by the Natural Business Services dispatcher when making remote service calls. The default is 30S (30 seconds).
Packet size Default packet size for communication messages. If you have many business services using interfaces larger than the default (31643 bytes), increase this size.

Note:
If required, Natural Business Services will increase the size dynamically at runtime, but this will affect performance.

Description Description of the connection. For example, you can type "This is a development connection".
Uppercase credentials Select this option if the user ID and password must be sent in upper case.

Note:
This option is not recommended for Natural Business Services server environments running on UNIX or Linux.

Add a SPoD Connection

A SPoD connection uses the Natural Single Point of Development (SPoD) protocol to communicate with the Natural Development Server (NDV) running in a Natural environment that contains Natural Business Services. This type of connection is only suitable for developing and testing Natural Business Services applications.

Note:
The Optional tab contains the same options as when adding a new Broker connection. For information, see Optional Tab.

Tip:
If you have an existing connection that is similar to the one you want to add, you can copy the connection and then modify it to suit your requirements. For information, see Copy an Existing Connection.

Start of instruction setTo add a SPoD connection:

  1. Select New on the Configuration Utility panel.

    Note:
    You can also open the context menu for an existing connection and select New on the submenu. For information, see Copy an Existing Connection.

    A menu is displayed.

  2. Select SPoD connection.

    A blank SPoD connection is loaded on the right side. For example:

    graphics/connections-tab-add-spod-connection.png

  3. Enter the following information on the Settings tab:

    Setting Description
    Connection ID Unique name of the server component that provides communications between the client and server. This name is listed in the Business Service Explorer and used in code when creating connections to business services. All communications are done by Connection ID.
    Host name Name of the server running Natural Development Server (NDV). You may also enter a TCP/IP address.
    Server port TCP/IP port for the NDV server. This value is required.

    Note:
    You cannot use the Windows services file to look up this value.

  4. Enter the following information on the Optional tab:

    Setting Description
    Session parameters Any session parameters required to connect to your environment. This can be a profile setting, such as PROFILE=NBS52.
  5. Select OK to save your new SPoD connection.

  6. Open the context menu for the Connections node in the Business Service Explorer.

  7. Select Refresh on the submenu.

    The connection is added to the list of available connections.

Copy an Existing Connection

To save time and effort, you can copy an existing connection and then modify it to suit your requirements.

Start of instruction setTo copy an existing connection:

  1. Open the context menu for an existing connection on the Configuration Utility panel.

  2. Select Copy on the submenu.

    The settings for the Copy of ConnectionName connection are displayed. The new connection has the same settings as the existing connection.

  3. Change the settings as required.

    For example, change the connection name from Copy of ConnectionName to another name.

  4. Select OK to save the new connection.

  5. Open the context menu for the Connections node in the Business Service Explorer.

  6. Select Refresh on the submenu.

    The connection is added to the list of available connections.

Modify an Existing Connection

This option allows you to change the settings for an existing connection.

Start of instruction setTo modify an existing connection:

  1. Open the context menu for an existing connection in the Business Service Explorer.

  2. Select Configuration on the submenu.

    The Configuration Utility panel is displayed.

  3. Modify the configuration settings as desired.

    For information on the configuration settings, see:

  4. Select OK to save the new settings.

Import a Connection

This option allows you to import connection IDs from different sources: SDC.ini or XML.

Start of instruction setTo import a connection from SDC.ini or XML:

  1. Select Import on the Configuration Utility panel.

    The Broker Connection Import wizard is displayed. For example:

    graphics/broker-connection-import-wizard.png

  2. Select one of the following options:

    Option Description
    Import from SDC.ini Select this option to import a Broker connection from SDC.ini. Enter the name of the connection file in File name.
    Import from XML Select this option to import either a Broker or SPoD connection from XML. Enter the name of the connection file in File name.
  3. Select Finish to import the connection.

Test a Connection

Start of instruction setTo test a connection:

  1. Select the connection you want to test on the Configuration Utility panel.

  2. Select Test.

    The Connection Test window is displayed.

    Note:
    If the connection is secured, select Credentials to enter the user ID and password for the connection.

  3. Select Run.

    Natural Business Services performs the following test process:

    1. Pings the specified Broker ID or Host name.

    2. Connects to the Broker ID or Host name and port using TCP/IP.

    3. Pings the Natural Business Services attach server.

    4. If the attach server is running, attempts to ping a Natural Business Services dispatcher.

    5. If no dispatchers are running, asks the attach server to initiate a new dispatcher.

    6. Sends the system profile command to a running dispatcher.

    7. Performs a test service call, which invokes the Calculator business service in the Demo domain.

    The following example shows the results of testing a connection:

    graphics/connection-test.png

Delete an Existing Connection

This option allows you to remove a connection from the list of available connections.

Start of instruction setTo delete an existing connection:

  1. Open the context menu for an existing connection on the Configuration Utility panel.

  2. Select Delete on the submenu.

    A confirmation window is displayed.

  3. Select Yes.

  4. Open the context menu for the Connections node in the Business Service Explorer.

  5. Select Refresh on the submenu.

    The connection is removed from the list of available connections.

Visual Studio Add-in Tab

The following example shows the Natural Business Services Visual Studio Add-in tab on the Configuration Utility panel:

graphics/config-utility-vsaddin-tab.png

Use this tab to define the Visual Studio add-in settings used for all connections. These settings include:

Setting Description
Templates root Path on your system to the code templates required by the Natural Business Services wizards for code generation.
Custom templates root Path to the directory containing customizations or modifications to the supplied templates. Templates stored in this location must follow the same folder structure and naming standards as the Templates Root path. Any templates located in this folder are loaded first.
Default user ID Default user ID used when connecting to Natural Business Services repositories.
Default Natural connection Default connection ID used by the Visual Studio add-in.
Web Roots Paths used by the add-in (for information, see Modify Web.config Files).

Optional Tab

The following example shows the Optional tab on the Visual Studio Add-in tab:

graphics/vsaddin-tab-optional-tab.png

Use this tab to define optional settings used for all connections. These settings include:

Setting Description
Compare command Path to a comparison utility used by the code generator wizards. When you select Show differences in the generate results, this comparison utility is invoked. Use %1 and %2 to pass in the names of the files you want to compare.
HTML editor Name of the default HTML editor used by the Visual Studio add-in.
XSL editor Name of the default XSL editor used by the Visual Studio add-in.
Default refresh metadata If this field is marked, the Natural Business Services wizards download new copies of service metadata when regenerating classes or Web services.

Web Services Tab

The following example shows the Web Services tab on the Configuration Utility panel:

graphics/config-utility-web-services-tab.png

Use this tab to configure the Web.config file for Natural Business Services web roots defined in IIS (Internet Information Server). These settings are:

Setting Description
Message database Indicates where messages are located. You can either supply the file location for your own messages (for example, mymessages.xml) or you can modify messages in the supplied messages.xml file (message numbers 5700–5799). For more information, see Messagedatabase.
Connection ID Unique name of the server component that provides communications between the client and server. This name is listed in the Business Service Explorer and used in code when creating connections to business services. All communications are done by Connection ID.
Mode Natural Business Services security mode for Web services.
Token cache timeout Timeout limit for the security token cache. The default is 25 minutes.
User ID Default user ID sent with SOAP messages.
Password Default password sent with SOAP messages.

These settings are used for all connections; they are not specific to one type of connection. For more information, see Modify Web.config Files.

Optional Tab

The following example shows the Optional tab on the Web Services tab:

graphics/web-services-tab-optional-tab.png

Use this tab to define optional settings for Web services. These settings are:

Setting Description
Name Default name of the Web.config file for Web services.
Enable metadata retrieval Select this option to allow Web services to retrieve metadata.
Default language Default language for Web services.

Top of page

Use the Business Service Explorer

The Business Service Explorer lists all defined business service connections in a tree view.

Note:
To create new business services, see Natural Business Services Natural Plug-in and Natural Business Services Administration.

Start of instruction setTo access the Business Service Explorer:

  1. Select Business Service Explorer on the NBS menu.

    The Business Service Explorer is displayed. For example:

    graphics/business-service-explorer.png

  2. Move the explorer window to the location of your choosing.

    Note:
    By default, the window is dockable. You can use the context menu for the Business Service Explorer title bar to redefine this window as Floating or Tabbed Document.

Use the Business Service Explorer to:

Access the Business Services

Start of instruction setTo access the business services:

  1. Select the connection node containing the business services.

    The Logon window is displayed.

  2. Enter your user ID and password.

  3. Select OK in the Logon window.

    The Natural Business Services server retrieves the list of domains for the specified connection.

  4. Select a domain node.

    The server retrieves the list of business services in the selected domain. For example:

    graphics/business-service-explorer-domain.png

Find a Business Service

Start of instruction setTo find all business services in a specific domain:

  1. Open the context menu for a domain listed in the Business Service Explorer.

  2. Select Find service/create Web service on the submenu.

    The Find Services window is displayed. For example:

    graphics/find-services.png

  3. Select the name of the domain from Domain.

  4. Select Find.

    Natural Business Services returns a list of the business services in the specified domain. The following example shows the results of searching the Demo domain for all services:

    graphics/find-services-all-in-domain.png

    Optionally, you can use this window to:

    Task Procedure
    Group the results by column. Drag the column heading to the shaded area.
    Rearrange the columns. Drag the column heading to the far left of this window (for example, to sort by version, drag the Version heading to the left of the Domain heading).
  5. Select the service for which you want to create a Web service.

  6. Select OK to display the Web Service wizard.

You can refine the results by limiting the search as follows:

Find Specific Services in All Domains

Start of instruction setTo find specific business services in all domains:

  1. Select All from Domain.

  2. Do one of the following:

    Note:
    You can also use options on the Advanced tab to limit the search. For information, see Use the Advanced Tab.

  3. Select Find.

    Natural Business Services returns a list of all specified business services in all domains. The following example shows the results of searching all domains for a service containing "customer" in its description:

    graphics/find-services-results-search.png

  4. Select OK.

Find a Specific Service in a Domain

Start of instruction setTo find a specific business service in a domain:

  1. Select the name of the domain from Domain.

  2. Type the name of a business service in Service name.

    Note:
    Ensure you use the correct case for Service name. For example, use "Calculator", not "calculator", to find the Calculator service.

  3. Select Find.

    Natural Business Services returns a list of all business services in the domain with that name in their name.

  4. Select OK.

Use the Advanced Tab

Start of instruction setTo limit the search of business services:

  1. Type one or more keywords in Keyword(s).

  2. Select the Advanced tab in the Find Services window.

    The Find Services window is displayed. For example:

    graphics/find-services-advanced-tab.png

  3. Specify the search criteria as follows:

    Search Type Procedure
    Search for whole words only. Select Whole word. For example, if you type "Customers" in Keyword(s), business services containing "Customer" will not be returned).
    Search for either all words specified in Keyword(s) or any word. Select All words to search for business services containing all words specified in Keyword(s); select Any word to search for business services containing any word specified in Keyword(s). For example, if you type "Customer record" in Keyword(s) and select All words, only business services containing both "Customer" and "record" will be returned; if you select Any word, business services containing either "Customer" or "record" will be returned.
    Search for words using a particular case. Select Case sensitive. For example, if you type "Customer" in Keyword(s) and select Case sensitive, business services containing "customer" will not be returned.
    Search for business services and their subprogram metadata. Select Include subprogram metadata. The search will include the subprogram metadata for services containing the keyword specified in Keyword(s).
    Search for business services containing a specific method type. Select All (for all method types), Multimaint (for multimaint method types) or Browse/FindBy/BROWSE (for the browse method types).
  4. Select Find.

    Natural Business Services returns a list of all business services with the specified criteria.

Set Trace Options

Select the Trace enabled option at the bottom of the Business Service Explorer to troubleshoot configuration and connection issues. This option records what is happening internally within the Visual Studio add-in and wizards. In addition, you can:

Note:
You can also enable the tracing options from the wizard panels.

The Visual Studio add-in will display runtime information in the standard Visual Studio Output window. For example:

graphics/trace-output.png

Show Environment Information for a Connection

Start of instruction setTo display environment information for a connection:

  1. Open the context menu for a connection listed in the Business Service Explorer.

  2. Select Show environment on the submenu.

    The Natural Business Services - Environment Check window is displayed. For example:

    graphics/show-environment-option.png

    This window displays information about the environment for the current connection.

  3. Select Close.

Top of page

Regenerate a Business Service from the Command Line

After using the Natural plug-in to create a business service, you can regenerate and compile an entire solution in Visual Studio from the command line using the following syntax:

Devenv.exe <solution name> /command "BusinessServicesAddIn.Connect.RegenSilent"

For example:

Devenv.exe s:\local\consoleapplication1\consoleapplication1.sln /command "BusinessServicesAddIn.Connect.RegenSilent"

The example above:

  1. Loads the ConsoleApplication1 solution.

  2. Retrieves all business services.

  3. Regenerates the services.

  4. Compiles the solution.

  5. Closes Visual Studio.

Top of page

Use Code Snippets

Code snippets are small pieces of code you can use in Visual Basic .NET. Natural Business Services supplies this code in the following folder:

<Install Folder>\Samples\VB\Code Snippets

The code snippets supplied with Natural Business Services are:

Short Cut Name File Name Description
Displogon Displogon.snippet Log onto a dispatcher.
NBSdisp CreateDispatcher.snippet Create an IRemoteCaller (dispatcher) object.
NBSTest TestService.snippet Test a business service.

Start of instruction setTo add the code snippets to Visual Studio:

  1. Select Code Snippets Manager on the Tools menu.

    The Code Snippets Manager window is displayed. For example:

    graphics/code-snippets-manager-window.png

  2. Select Add.

  3. Select <Install Folder>\Samples\VB\Code Snippets.

  4. Select OK.

Start of instruction setTo invoke the code snippet:

  1. Type the short cut name in the Visual Studio code window.

  2. Press Tab.

    The code snippet is copied into the code window.

Top of page

Upgrade an Existing Web Service

This section describes how to upgrade a Web service that was created using a previous version of Natural Business Services and import the service into Visual Studio.

Start of instruction setTo upgrade and import existing Web services into Visual Studio:

  1. Select Upgrade existing Web services on the NBS menu.

    The Web Service Upgrade wizard is displayed. For example:

    graphics/upgrade-web-service-wizard-1.png

  2. Select Next.

    The following panel is displayed:

    graphics/upgrade-web-service-wizard-2.png

  3. Enter the following Web service root settings for the existing service:

    Setting Description
    Folder Root location of IIS. The default is c:\inetpub\wwwroot\. Note: If your services are in a different location, enter the location of the parent folder in this field.
    Machine name Name of the current machine or host. This value is used when creating the new Web service project.

    Note:
    The wizard will not connect to the remote machine; it only uses this name during the upgrading process.

    Server path Subfolder within the folder specified above; this is the Web service root.
    Port TCP/IP port number the web server is currently running on.
  4. Select Next.

    The following panel is displayed:

    graphics/upgrade-web-service-wizard-3.png

  5. Enter the folder location and project name for the new project.

    When naming projects, the following restrictions apply to the name:

  6. Select Next.

    The following panel is displayed:

    graphics/upgrade-web-service-wizard-4.png

  7. Select any additional options for the new project.

    These options are:

    Option Description
    Add project to current solution If this option is selected, the new project is added to other projects in the Solution Explorer.
    Backup the existing project to a .zip file If this option is selected, a backup zip file is created for the existing Web service folder.

    Note:
    We recommend that you select this option.

    Download metadata from server If this option is selected, metadata will be downloaded from the server for each service.

    Note:
    This option will significantly slow down the upgrade process.

    Connection ID This option is available when you select the Download metadata from server option. You can select a different connection and refresh the metadata.
  8. Select Finish to upgrade the service.

Top of page