WCFServices

From CORSIS

Jump to: navigation, search

WCFServices is a Mathematica package that enables connection to services using .NET and WCF (Windows Communication Foundation).

It uses svcutil from Windows SDK and and a C# compiler for automation and supports NetTcpBinding as well as all other WCF configurations.

Download

Example

In[1]:= << WCFServices`

In[2]:= WCFServicesInformation[]
WCFServicesQ[]

Out[2]//TableForm=
Company                 -- research.corsis.eu --
WCFServicesVersion	{0,9,0}
Bindings	        {net.tcp}
Channels	        {Simplex}
NETRuntimeVersion	{4,0,30319}
NETRuntimeBitness	64
WindowsSDKDirectory	C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\x64
ServiceUtilityTool	C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\x64\svcutil.exe
OutputDirectory	        C:\Users\Cetin\AppData\Local\Temp
Compiler	        C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe
WCFServicesSupport	True

Out[3]= True

In[4]:= ?WCFInstallService

WCFInstallService["url"] installs service operations discoverable at given the URL.
WCFInstallService["url", "context`"] installs service operations in the specified context.

In[5]:= WCFInstallService["net.tcp://fserver:3400","F`"]@Info                       (* Install service in custom context and show metadata *)
WCFInstallService["net.tcp://qserver:3401/mex","Q`",EndpointOverride->MEX]@Info     (* Install service in custom context and show metadata *)

Out[5]= «WCFService[FileService]»
NetTcpBinding: net.tcp://fserver:3400
GetSilverlightPolicy	IO Stream
GetServiceName	        IO String
GetPaths	        String -> IO {String}
GetAll	                {String} -> IO XmlElement

Out[6]= «WCFService[QueryService]»
NetTcpBinding: net.tcp://qserver:3401/
GetSilverlightPolicy	IO Stream
GetServiceName	        IO String
GetMetadata	        String -> IO XmlElement
GetKeys	                GetKeysRequest -> IO GetKeysResponse
Find	                XmlElement -> IO {String}

In[6]:= F`GetServiceName[]            (* Calling remote function via active client                                 *)
FileService                           (* By default each service gets its own object in current context            *)
FileService@Client                    (* WCFService objects expose properties and use .NET/Link objects            *)
(FileService@Client)@GetServiceName[] (* Calling remote function explicitly on the underlying object via .NET/Link *)
FileService⊙Client⊙GerServiceName[]   (* Use another operator with left association to allow member access chains *)

Out[7]= FileServiceLibrary, Version=0.5.0.27888, Culture=neutral, PublicKeyToken=null
Out[8]= «WCFService[FileService]»
Out[9]= «NETObject[FileServiceClient]»
Out[10]= FileServiceLibrary, Version=0.5.0.27888, Culture=neutral, PublicKeyToken=null
Out[11]= FileServiceLibrary, Version=0.5.0.27888, Culture=neutral, PublicKeyToken=null

In[7]:=?F`GetPaths          (* Use Mathematica functions for help *)

Out[12]= ------------------------------------------------------------
        «WCFOperation[FileService@GetPaths : String -> IO {String}]»

Remarks

This package is in active development.

System Requirements

  • Mathematica
  • Windows
  • .NET 3.5 or above (defaults to 4.0)

Used By

Personal tools