Using Web Service Event – Write Document With Response

In our previous articles on Web Service event, we described:

In the following section we will demonstrate the use of Web Service event with Write Document With Response command (Direction = Read and Write), i.e. 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:

We will try to simulate a scenario in which the client send the sales order data into NAV and expects a response from NAV containing relevant sales order number.

In this example we will use an existing template 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 and also add an XML Generator activity (for getting the response back).

  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 add XMLGENERATOR activity and 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_WS1). A dialog may pop up, click Yes.
    2. Direction (say Read and 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_WS1 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. You can check the result:
    1. Records are created in NAV. Check the History in BIS connection.
    2. NAV send back the response with the sales order details to the client. In this case check the output right window on WCF Storm.

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, Others, Solution Center and tagged , , , , , , , . Bookmark the permalink.

Leave a comment