Soap Error: "Server was unable to process request" "Object reference not set to an instance of an object"

92,223

Solution 1

Thanks guys for all your help. I solved the problem.

The 'SoapAction' field in the soap request had the wrong URI

I recommend using a HTTP sniffer. The http sniffer will show the SOAP properties.

The "SOAPAction" property should have something like : http://tempuri.org/YourServiceMethodName

Solution 2

The "Object reference" error is the hardest to troubleshoot if you don't know exactly where the error is occurring. Be sure to test for null values, as the most obvious cause for this error is an object not being initialized or a variable having a null value when it's expected to contain an object or a value.

Also, be sure that you're following best practices for error handling. Try to catch the errors at the earliest possible level unless you intentionally intend to let a higher-level error handler catch the error. The fact that you're getting this error means that the error handling is not sufficient.

Finally, I'd strongly recommend including some sort of logging mechanism for your error handlers. Save the errors to the Event Log, or a database, or even email them - anything, so that you can tell exactly where the error is. Do NOT display the error back to the user.

There are several options for this. Asp.Net Health Monitoring works fine in web services as well as standard asp.net sites. There's also ELMAH, or you can write your own code to do this.

If you follow these guidelines, you won't be in a situation where you don't understand how the error is happening. You'll have the information you need to troubleshoot properly, and your apps will be more solid.

Share:
92,223

Related videos on Youtube

Rodniko
Author by

Rodniko

Updated on July 09, 2022

Comments

  • Rodniko
    Rodniko almost 2 years

    When I send a SOAP request to my service in the IIS locally, everything works fine. When I send a SOAP request to the same service that running on IIS on another host, everything works fine.

    But when another programmer sends a SOAP request to my service, he generally gets the right response except one method in the service that returns:

    <soap:Body>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>Server was unable to process request. ---&gt; Object reference not set to an instance of an object.</faultstring>
      <detail />
    </soap:Fault>
    

    I need to understand why he is receiving this error.

    His SOAP request is exactly the same as SOAP Request yet mine works and his does not.

    • F.B. ten Kate
      F.B. ten Kate over 13 years
      So when you capture his soap request and send that exact request (with a soap tool like soapUI) to your development environment it works? Cause it really does sound like there should be differences.
    • Sarwar Erfan
      Sarwar Erfan over 13 years
      The programmer is omitting/putting wrong type of value in at least on e of the parameters in the request. Ask for his code.
  • hossein hashemian
    hossein hashemian over 4 years
    this is your link: 404 - File or directory not found. @Rodniko