Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SoapException Server was unable to process request on ASMX webservice in MVC site

I'm getting an exception when trying to access an .asmx webservice within a MVC site. I've tried numerous things like updating the web reference within the console application and building another quick app to test, but can't get passed this issue. If I pull the URL out of the svc variable, I can browse to it directly.

Exception Details

System.Web.Services.Protocols.SoapException occurred Message=Server was unable to process request. ---> Value cannot be null. Parameter name: uriString
Source=System.Web.Services Actor="" Lang="" Node="" Role=""
StackTrace: at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at ClarityIntegration.SendTrackerDataToClarity() in [REDACTED].Reference.cs:line 78 at [REDACTED].Program.Main(String[] args) in [REDACTED].Program.cs:line 33
InnerException:

CONSOLE APP CODE

var svc = new TrackerClarityService.ClarityIntegration()
    {
        Url = url,
        Credentials =
            new System.Net.NetworkCredential("user", "pass", "domain")
    };
svc.SendTrackerDataToClarity();
svc.Dispose(); 

Issue Resolved

The exception was coming out of the Web Service itself. There were some global variables not being initialized directly through the .asmx call that were being initialized by the application itself.

Some simple checks on variables within the Web Service and setting what needs to be set have fixed up the issue.

like image 949
RSolberg Avatar asked Mar 09 '11 18:03

RSolberg


2 Answers

Issue Resolved

The exception was coming out of the Web Service itself. There were some global variables not being initialized directly through the .asmx call that were being initialized by the application itself.

Some simple checks on variables within the Web Service and setting what needs to be set have fixed up the issue.

like image 168
RSolberg Avatar answered Oct 04 '22 19:10

RSolberg


If using basic auth, this has solved my issues in the past:

NetworkCredential nc = new NetworkCredential();
nc.Domain = "domain"
nc.UserName = "user"
nc.Password = "pwd"

Uri uri = new Uri(svc.Url);
ICredentials credentials = nc.GetCredential(uri, "Basic");
svc.Credentials = credentials;
like image 33
rick schott Avatar answered Oct 04 '22 18:10

rick schott