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)); }
public ActionResult CallSoapServiceAnon(SoapServiceRequest request) { return(InternalCallSoapService(request)); }