Integrations and APIs for Service

Get Involved. Join the Conversation.

Topic

    Peter Dawson
    .NET RightNowSyncServiceAnswered
    Topic posted July 31, 2012 by Peter Dawson 
    804 Views, 9 Comments
    Title:
    .NET RightNowSyncService
    Content:

    Hello,

    I am attempting to create a .NET web service using a WSDL that does not have the RightNowSyncPortClient member variable referenced in all the documentation I can find for Web Services for SOAP but instead has a RightNowSyncService member variable.

    The RightNowSyncService member variable does not have the userName object to set username and password with. My question is how would I go about setting client credentials using RightNowSyncService?

    I have attempted to set the Credential object in the  RightNowSyncService member variable to an instance of the NetworkCredentials class and then used an API operation unsuccessfully with the exception 'The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel'.

    Best Comment

    Chris Omland

    In VS 2010 did you add a web reference or a service reference? You should be adding a service reference.

     

    http://community.rightnow.com/developer/fileexchange/Connect_Web_Services_for_SOAP_May_2012/Content/Getting%20Started/Getting%20Started%20--%20.NET.htm

    Comment

     

    • Chris Omland

      How did you create the client side bindings? 

    • Peter Dawson

      I added the wsdl as a web reference and then attempted to test the result using the following code:

      public class WebServiceFunctions
          {
              public bool Test()
              {
                  rightnow.RightNowSyncService _service = new rightnow.RightNowSyncService();
                  _service.Url = "https://cormay11.rightnowdemo.com/cgi-bin/cormay11.cfg/services/soap";
                  _service.Timeout = 5000;
                  _service.Credentials = new NetworkCredential("username","password");
                  _service.ClientInfoHeaderValue = new rightnow.ClientInfoHeader();
                  _service.ClientInfoHeaderValue.AppID = "Basic Query CSV";
                  string queryString = "SELECT Incident.* FROM Incident";
                  StreamWriter sw = new StreamWriter("WebServiceError.txt", true);
                  try
                  {
                      rightnow.CSVTableSet queryCSV = _service.QueryCSV(queryString, 1, false);
                      foreach(rightnow.CSVTable table in queryCSV.CSVTables) sw.WriteLine(table.Name);
                  }
                  catch(Exception ex)
                  {
                      sw.WriteLine(ex.Message);
                  }
                          
                  sw.Close();

                  return true;
              }
          }

    • Chris Omland

      Are you using VS 2010?

    • Peter Dawson

      I am using VS 2005.

    • Chris Omland

      The adding of a web reference prior to VS 2010 doesn't work. Follow the instructions here:

       

      http://community.rightnow.com/developer/fileexchange/Connect_Web_Services_for_SOAP_May_2010/Content/Getting%20Started/Getting%20Started%20--%20.NET.htm

    • Peter Dawson

      I have now used vs 2010 with the same results.

    • Chris Omland

      In VS 2010 did you add a web reference or a service reference? You should be adding a service reference.

       

      http://community.rightnow.com/developer/fileexchange/Connect_Web_Services_for_SOAP_May_2012/Content/Getting%20Started/Getting%20Started%20--%20.NET.htm

    • Peter Dawson

      Thank you. I was adding a web reference instead of a service reference.

    • James Gilbert

      Is it possible to do this using a Web Reference instead of a Service Reference?

      I'm trying to add the RightNow API to my website and it seems like Add Web Reference is my only option...