Embedding Assemblies and Accessing Web Services - Blog
Go Search
Home
Developer's Blog
Products
Languages
InfoCenter
Free Trial
Purchase
Contact Us
  

Home > Blog > Posts > Embedding Assemblies and Accessing Web Services
Embedding Assemblies and Accessing Web Services

One of the more novel features of Inference for .NET is that it allows you to encapsulate .NET assemblies that you want to call from an Inference document directly into the document itself.  By embedding an assembly into an Inference document, anyone that you give or send this document to only needs to have Inference for .NET installed to execute the document -- the embedded assemblies get extracted at runtime.  This makes deployment of your document a cinch -- all your target users need is Office and Inference -- there’s no need to deploy anything other than the specific document.

Let’s take a look at an actual example of this.  I’m going to share an Inference for Word sample that illustrates embedding and accessing an assembly that encapsulates a web service in a Word document.  Specifically, this sample utilizes a web service available from the Nation Center for Biotechnology Information (NCBI) available from:

http://www.ncbi.nlm.nih.gov

The NCBI provides public databases useful in computational biology and genome research.  You can download this sample (called "NCBI ELink Web Service in Word Sample.docx" from Inference Online).

To start, I created a .NET assembly that encapsulates the NCBI web service, which I called NCBIWebService:

Then I created a new Word document, added an Inference Parts Container, and embedded the assembly DLL created above into the document:

Next, I added the requisite IronPython code that will access the web service (specifically, the code queries for a list all available publication indices) and prints out the results:

And that’s all I need to do.  I can then export the document to a "Webpage View":

...which when executed is shown in a web browser:

That’s all there is to it.  This sample shows how easy it is to embed and access .NET assemblies in Inference documents.

Comments

There are no comments yet for this post.
    © 2008 Blue Reference, Inc. All rights reserved. | 3052 NW Merchant Way, Suite 100, Bend, Oregon 97701 | 541-316-2343 | Terms of Use