Using Web Service Event – Import Connection

In one of the previous articles “Using Web Service Event – Export Connection” we explained the use of Web Service event for an export connection.

In the following section we will demonstrate the use of Web Service event in an import connection (Direction = Write), where in you can import data into Microsoft Dynamics NAV. When you import data into Microsoft Dynamics NAV, an external party makes a call to Microsoft Dynamics NAV Web Service. The Web Service is linked to the BIS Web Service Event codeunit which triggers the pipeline. Other pipeline activities handle the rest of the data import.

There are two commands for importing the data from the external party into NAV:

  • Write Document: When you use this command, the data is exported to NAV and added to the Message Queue. The BIS Pipeline waits for the Job Queue to finalize the import. This is an asynchronous process.
  • Write Document With Response: When you use this command, the data is exported to NAV and immediately processed through the complete pipeline in a synchronous process.

As pointed out in earlier article, there are few things to note before we proceed with an example:

  • The Web Service Event uses standard Microsoft Dynamics NAV web service functionality. Please refer to the standard online help to learn about Working with Web Services.
  • You also need your own client to invoke the web service. This is not in the scope of BIS. However, for testing purpose, you can download and use WCF Storm. It is a free and open source tool for testing web services.

Example:

Setup the Connection:

In this example we will use an existing template to import sales order TI_CS_SALESORDER.IN (available in the software package Or download it here) and modify it to use Web Service event instead of File Reader endpoint.

  1. Click Departments/Business Integration Solutions/Connectivity Studio/Design/Connections
  2. Import the connection TI_CS_SALESORDER.IN from the sample templates.
  3. Remove the FILEREADER endpoint form the element list and add WEBSERVICEEVENT. Also make the necessary changes in the pipeline.
    image
  4. Edit the Web Service Event and fill in the following fields:
    1. Web Service (say SO_IMP_WS). A dialog may pop up, click Yes.
      image
    2. Direction (say Write).
      image

Check the Web Services:

  1. Click Departments/Administration/IT Administration/General/Web Services.
  2. Click Edit List.
  3. Select the web service created in previous step (SO_IMP_WS in this case).
  4. Select the Published checkbox. This will also automatically generate a SOAP URL.image

This SOAP URL is ready to be used by your client. Copy the URL and open it in a browser to check the result.

image

Invoking the Web Service Via Client:

  1. For testing purpose, run WCF Storm.
  2. Click Add and add the SOAP URL.
    image
  3. From the software package:
    1. Open the sample file SalesOrderDemo.xml in notepad.
      image
    2. Remove the Word Wrap check (Format, Word Wrap) from the notepad and put everything in one line.
      image
    3. Copy the content.
  4. On the WCF Storm window, paste the content in the value of documentString property.
    image
  5. Click Send.
    image
  6. Go the the TI_CS_SALESORDER.IN connection and check the result in History.
    image

The sales order have been imported into Microsoft Dynamics NAV.

About Paresh Sharma

Product Consultant for To-Increase Business Integration Solutions| Support Consultant for To-Increase BIS and IEM Solution|Certified Scrum Master|Over 10 years of experience in IT Industry
This entry was posted in BIS General, Connectivity Studio and tagged , , , , . Bookmark the permalink.

1 Response to Using Web Service Event – Import Connection

  1. Pingback: Using Web Service Event – Write Document With Response | Dynamics NAV Integration Insights from the Experts

Leave a comment