ExecuteLocalProcedure REST C# code example

Hello,


I'm writing a small custom app using the REST services for the first time. Everything was going great until I ran into a situation where I needed to call a local procedure. I can't seem to figure out how to pass the correct types into the Post call for the serialization to work.  Does anyone have a code example for calling a local procedure with the REST services? Any help is greatly appreciated!


Thanks in advance, 

Sean

  •  I usually do it something like this!

     

    //Create User Credentials based on user account accessing REST Services

    UserCredentials userCredentials = new UserCredentials(strUsername, strSecurity, strMachine, strPassword);

    String strServer = <Your Server>;

    String strProcedureID = "22";

    //Use the Execute Data Service to get data from the REST Service

    var response = RestClient.At("https://" + strServer + "/TessituraService/Custom/Execute/").For(userCredentials)

     .Post("<LocalProcedureRequest>" +

    "<Parameters>@customer_no=" + strMembershipNo + "</Parameters>" +

    "<ProcedureId>" + strProcedureID + "</ProcedureId>" +

    "</LocalProcedureRequest>");


     //Return the Response Code.  This will determine if the request has been sucessful

    String strResponseCode = response.StatusCode.ToString();

    if (strResponseCode.Equals("OK"))

    {

                    //GetData From the XML and Insert into a Dataset

                    DataSet dsResponse = new DataSet();

                    dsResponse.ReadXml(new XmlTextReader(new StringReader(response.ResponseBody.ToString())));

    }

  • Former Member
    Former Member $organization

    Sean

     

    For the local procedure call to work, you need to:

    1-      Send the parameters in XML format in the body of the request. The expected format is documented in the service page e.g. https://yourservername/TessituraService/Custom/help/operations/ExecuteLocalProcedure

    2-      Add a HTTP header to the request with name “Content-Type” and value “application/xml”

     

    Fernando Margueirat
    Business Analyst
    The National Ballet of Canada
    470 Queens Quay West
    Toronto, Ontario
    M5V 3K4
    P: 416 345 9686 x453
    F: 416 345 8323

    http://national.ballet.ca

     

    From: Tessitura Web Forum [mailto:forums-tessitura-web@tessituranetwork.com] On Behalf Of Sean Pinto
    Sent: Tuesday, August 11, 2015 10:49 AM
    To: Fernando Margueirat <FMargueirat@national.ballet.ca>
    Subject: [Tessitura Web Forum] ExecuteLocalProcedure REST C# code example

     

    Hello,

     

    I'm writing a small custom app using the REST services for the first time. Everything was going great until I ran into a situation where I needed to call a local procedure. I can't seem to figure out how to pass the correct types into the Post call for the serialization to work.  Does anyone have a code example for calling a local procedure with the REST services? Any help is greatly appreciated!

     

    Thanks in advance, 

    Sean




    You were sent this email automatically because you subscribed to the Tessitura Web forum. You may reply to this message to post to the Web forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!

  • Sean,

    Task item 343 is an interceptor plugin written in C# that makes use of the Custom/Execute Rest call.  Does pretty much the same thing as Nick's example when making the call.

    Jon