4 Replies Latest reply on Apr 16, 2014 5:47 AM by ArtieTheOneManParty

    Getting 500 Internal Server error when calling createUrlwidget

    ArtieTheOneManParty

      We are using API version 9. I currently have an ASP.net/C# application that sends documents to echosign, and that works fine. I'm trying to create a new web application that creates a widget, so the user can be presented with the document to sign. I am calling the createUrlwidget method, but getting an internal server error, and I don't know why.

       

      Here's my code  (the url I use to call the service is https://secure.echosign.com/services/EchoSignDocumentService9)

       

      The error occurs below on the line:

       

                  using (StreamWriter sw = new StreamWriter(req.GetRequestStream()))

                  {

                      sw.Write(message);

                  }

       

       

      try

                  {

                      XmlDocument xRequest = BuildEchosignWidgetRequest(byteMyFile);  //build soap envelope

                      XmlDocument xResponse = SendRequest("createUrlWidget", xRequest);

                      XmlNodeList xSuccess = xResponse.GetElementsByTagName("success");

                      if (xSuccess[0].InnerText == "true")

                      {

                          XmlNodeList xUrl = xResponse.GetElementsByTagName("url");

                          string strURL = xUrl[0].InnerText; //the response xml

                          Response.Redirect(strURL); //launch the widget

                      }

                      else  //we got an error

                      {

                          XmlNodeList xError = xResponse.GetElementsByTagName("errorMessage");

                          string strErrorMessage = xError[0].InnerText;

                          throw new Exception("Unable to create Echosign Widget;" + strErrorMessage);

                      }

                  }

       

                  catch (Exception ex)

                  {

                      lblErrorMessage.Text = "Error: Unable to send document for signature(s).\n" + ex.Message;

                  }

       

      private XmlDocument SendRequest(string operation, XmlDocument xRequest)

              {

                  XmlDocument functionReturnValue = default(XmlDocument);

                  functionReturnValue = null;

                  string message = xRequest.OuterXml; //soap envelope

       

                  WebRequest req = HttpWebRequest.Create(System.Configuration.ConfigurationManager.AppSettings[QueryStringCo nstants.EchoSignWebServiceURL]);

                  req.ContentLength = message.Length;

                  req.ContentType = "text/xml; charset=UTF-8";

                  req.Headers.Add("SOAPAction", "\"\"");

                  req.Method = "POST";

                  req.Proxy = null;

                  req.Timeout = 1000 * 60;

       

                  //this is where the web service call is finally made

                  using (StreamWriter sw = new StreamWriter(req.GetRequestStream()))

                  {

                      sw.Write(message);

                  }

       

                  WebResponse resp = req.GetResponse();

                  using (StreamReader sr = new StreamReader(resp.GetResponseStream()))

                  {

                      XmlDocument xResponse = new XmlDocument();

                      xResponse.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + sr.ReadToEnd());

                      functionReturnValue = xResponse;

                  }

                  return functionReturnValue;

              }

        • 1. Re: Getting 500 Internal Server error when calling createUrlwidget
          SimonATS Adobe Employee

          Hey Artie,

           

          First question why version 9 of the API seeing version 17 is the current version?

           

          Second if you log in as the API key user via www.echosign.com and click the Account tab and go to the API section, you can see   a list of API call requests. Does you code generate a request log at all?

           

          And for reference the method is described here:

          https://corporate.echosign.com/public/docs/EchoSignDocumentService17#createUrlWidget

          • 2. Re: Getting 500 Internal Server error when calling createUrlwidget
            ArtieTheOneManParty Level 1

            when we wrote our initial echosign application, version 9 was current. the person that wrote it is gone, and we don't have much expertise with web services, so when we updated it, we kept using version 9. Our existing application sends the document to echosign with email addresses of the required signers, and they are notified by email, and this all works fine.

             

            We are now trying to present the document to the end user directly using the widget, so I kept using the same version of the api. I don't know what is involved (if anything) in upgrading to the newest version. Do I just need to change the call from https://secure.echosign.com/services/EchoSignDocumentService9 to https://secure.echosign.com/services/EchoSignDocumentService17  , and then make sure that I create the SOAP request according to the documentation (in case the methods have changed)?

             

            As far as your question about "generating a request log", I'm not sure what this means.

             

            Thanks in advance for your help.

            • 3. Re: Getting 500 Internal Server error when calling createUrlwidget
              SimonATS Adobe Employee

              Hi Artie,

               

              Some expertise with webservice and coding is required to get things working with the API.

              version 9 can still be used if you like, i was curious why you'd not use version 17. To use version 17 of the API you would indeed just update the version number in the link.

               

              The version number is an aside i don't think it will solve any issues you have.

               

              When calling a method in our API, in this case createURLwidget, you need to provide an API key. (DO NOT share this key here it's a secret key.)

               

              This API key is linked to an user within your EchOSign account login as this user via www.echosign.com and click the account tab. here go to the API section and examine the logs.

               

              if no log is generated it means your application is not contacting our server and the error will be somewhere on your setup. Also the EchOsign webservice does not give the error 500 internal server error eitehr.

              • 4. Re: Getting 500 Internal Server error when calling createUrlwidget
                ArtieTheOneManParty Level 1

                Simon,

                 

                Unfortunately, we don't have much expertise with web services. At the same time, we do have an existing application that is sending documents to Echosign via the web service, so I am familiar with the API key, etc. I have updated this application to use version 17. I am now getting the error on this line:

                 

                     WebResponse resp = req.GetResponse(); 

                 

                I did not know about the API log though. I just looked at it, and the error that is showing up there is:

                    

                     Fault: java.lang.NullPointerException(see documentation)

                 

                I have no idea what this means, and the "see documentation" link only brings me to the API Methods page. On the log, it lets me see the request and the response. the response is:

                 

                <soap:Fault>

                     <faultcode>soap:Server</faultcode>

                     <faultstring>Fault: java.lang.NullPointerException</faultstring>

                </soap:Fault>

                 

                Artie