Exemplo n.º 1
0
        private ActionResult InternalCallSoapService(SoapServiceRequest request)
        {
            // TODO: Add SSO handling

            SoapResult result = new SoapResult();

            try
            {
                // 2017/03/02 -- Move the code to SoapHelper.
                var uploadResult = SoapHelper.CallSoapService(request, GetCredentials(request.url));

                result.resultBody = GetBodyFromSoapResult(uploadResult);
                result.success    = true;
            }
            catch (WebException ex)
            {
                if (ex.Response == null)
                {
                    result.message = String.Format("The request to the service failed with an error: {0}", ex.Message);
                }
                else
                {
                    var fault = GetSoapFault(ex);
                    result.fault = fault;

                    result.message = !String.IsNullOrWhiteSpace(fault.faultstring)
                        ? String.Format("The service failed with an error: {0}", fault.faultstring)
                        : String.Format("The request failed with status {0}", fault.faultcode);
                }
            }
            catch (Exception ex)
            {
                result.message = String.Format("The request to the service failed with an error: {0}", ex.Message);
            }
            return(new ObjectResult <SoapResult>(result));
        }
Exemplo n.º 2
0
 public ActionResult CallSoapServiceAnon(SoapServiceRequest request)
 {
     return(InternalCallSoapService(request));
 }