#!/usr/opt/cs # Description: Client script in C# (mono) running the RNAmmer Web Service # Author: Karunakar Bayyapu # Email: karun@cbs.dtu.dk # Version: 1.2 ws1 # Date: 2012-04-23 //### for installation and usage notes please see below //### client code starts here using System; using System.Xml; public class clientCSharp { public static void Main(string[] args) { try { //runService --You need to change the sequences and ids as per your requirement. //organism and method are optional as per wsdl document runServiceResponseQueueentry obj2; sequence[] ss=new sequence[6]; sequence obj3=new sequence(); obj3.id="IPI:IPI00000006.1"; obj3.seq=""MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAG QEEYSAMRDQYMRTGEGFLCVFAINNTKSFEDIHQYREQIKRVKDSDDVPMVLVGNKCDL AARTVESRQAQDLARSYGIPYIETSAKTRQGVEDAFYTLVREIRQHKLRKLNPPDESGPG CMSCKCVLS""; ss[0]=obj3; sequence obj4=new sequence(); obj4.id="IPI:IPI00000005.1"; obj4.seq=""MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAG QEEYSAMRDQYMRTGEGFLCVFAINNSKSFADINLYREQIKRVKDSDDVPMVLVGNKCDL PTRTVDTKQAHELAKSYGIPFIETSAKTRQGVEDAFYTLVREIRQYRMKKLNSSDDGTQG CMGLPCVVM""; ss[1]=obj4; runServiceParameters obj1 = new runServiceParameters(); obj1.sequencedata = ss; WSRNAmmer_1_2_ws1 obj=new WSRNAmmer_1_2_ws1(); obj2 =obj.runService(obj1); Console.Write(obj2); //pollQueue --jobid needs to be changed as which you got from runService pollQueueResponse pollObj; pollQueueJob job = new pollQueueJob(); string id="D81A87A0-4030-11E1-AF58-C0FF935B49F0"; job.jobid = id; WSRNAmmer_1_2_ws1 obj = new WSRNAmmer_1_2_ws1(); pollQueue job1 = new pollQueue(); job1.job=job; pollObj=obj.pollQueue(job1); Console.Write(pollObj); //fetchResults --jobid needs to be changed as which you got from runService anndata ann; fetchResultJob job = new fetchResultJob(); string id="4EBA8F9A-727C-11E1-A913-B5DEB25BD92E"; job.jobid = id; WSRNAmmer_1_2_ws1 obj = new WSRNAmmer_1_2_ws1(); ann=obj.fetchResult(job); Console.Write(ann); } catch(Exception ex) { Console.WriteLine("{0} Exception caught.", ex); } } } //### client code ends here //######################################################################################### //############################# ############################# //############################# DOCUMENTATION ############################# //############################# ############################# //######################################################################################### // Introduction: // C# is the primary programming language of the .NET framework. In this documentation // we look at how to use the CBS Webservices with C# in the Mono development environment. // Installation: // Required/Tested Version: Monodevelop v2.8 and JIT compiler v 2.0.1 // Select your platform and download Monodevelop environment from // http://www.go-mono.com/mono-downloads/download.html and install it. // Create Service Stubs--Mono: // From the service WSDL (e.g. http://www.cbs.dtu.dk/ws/RNAmmer/RNAmmer_1_2_ws1.wsdl ) // generate stub classes using the wsdl tool: // >wsdl http://www.cbs.dtu.dk/ws/RNAmmer/RNAmmer_1_2_ws1.wsdl // Use Service: // Then in the program create an instance of the service object: // WSRNAmmer_1_2_ws1 obj = new WSRNAmmer_1_2_ws1(); // This object provides methods corresponding to those defined in the WSDL so to call // the runService method of the WSRNAmmer_1_2_ws1 service we can use: // Obj2 = obj.runService(obj1); // The runService method returns a SOAP envelop as string containing the requested entry, // which can be output with: // Console.Write(obj2); // Access Web sevices: // Ths RNAmmer service code access to see one method results at once. If you would like to // see runService method results then you would need to comment the rest of the methods code // and for rest also same. In the runService you need to submit required fileds like one id // and corresponding sequence or more ids and their corresponding sequences as a input(STDIN) // data to convert FASTA format to get the results. // For input data/FASTA format see example: // http://www.cbs.dtu.dk/ws/RNAmmer/examples/example) // After getting jobid from runService then you would need to submit jobid in the pollQueue // to know the status of the job. After knowing the status of the job from pollQueue then // you need to submit jobid in the fetchResult to see complete final results. // It means you can only see final results in the fetchResult since RNAmmer is implemented // in asynchronous way // Compile Program: // Once the program is writing or copying/pasting/saving completed into your local editor, it needs // to be compiled. This is slightly different depending on the chosen environment. Assuming // the program is in a file called client.cs: // Microsoft .NET SDK // csc client.cs WSRNAmmer_1_2_ws1.cs // Mono-Linux // gmcs client.cs WSRNAmmer_1_2_ws1.cs -r:System.Web.Services // Run the Program: // The resulting .exe file can be run as follows: MS Windows, assuming the // .NET runtime is installed: // client.exe // Non-Windows Mono environments: // mono client.exe // Note: some non-Windows environments (e.g. Linux) can be configured to support direct // execution of .NET programs, allowing the use of the Windows style method. .cs file with input data // Results: // In the results you can see individual method output.