So I have a PHP Soap service that is running nusoap and I am writing custom responses.
The php client works perfectly but C# client keeps returning this:
Object reference not set to an instance of an object.
Any ideas on how to troubleshoot this problem?
I’ve tried initializing every variable with with test data, but I keep getting the same error.
Thanks for your input.
I am using this method.
http://my.execpc.com/~gopalan/dotnet/webservices/webservice_csharp_client.html
This is the error I receive ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException:
Object reference not set to an instance of an object
at gt.MainClass.Main (System.String[] args) [0x0005a] in //Projects/gt/Main.cs:27
line 27 (gt is the wsdl object)
gt.Transact(trans) which I am passing a transaction object and it should return a transaction response,but it appears to not be parsing the response.
[System.Web.Services.Protocols.SoapDocumentMethodAttribute(“http://CANNOT TELL YOUt”, RequestNamespace=”CANNOT TELL YOU”, ResponseNamespace=”CANNOT TELL YOU”,
This is the method being called and this is a piece of code from the partial class.
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, Use=System.Web.Services.Description.SoapBindingUse.Literal)]
[return: System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public TransactResponse Transact([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] TransactRequest request) {
object[] results = this.Invoke(“Transact”, new object[] {
request});
return ((TransactResponse)(results[0]));
}
This error was due to xml formatting of the response.
So in this scenario I was taking a wsdl generated by C# ASP.NET and running that wsdl with nusoap on a php5 apache server. (This was do to a client’s request to re implement an existing service so they didn’t have to change their code.)
So for example if you have
It needs to be formatted like this for .net to parse the xml correctly.
So it looks like the response data needs to be encapsulated by a Result tag which is the concatenation of the function name with the string “Result”. So in the example above the function being called is the “Some” function.
I am not a xml or soap expert and I am not sure exactly why this is. I know it has to do with the xmlns:a=’some url’ tag.
if anyone could explain it better that would be great.