There is weird bug in .NET that requires from SOAP Fault data to have explicit order of properties.
Problem occurs when you get nusoap fault response from PHP read your .NET application. You get strange exception:
Server returned an invalid SOAP Fault. Please see InnerException for more details
Inner exception reveals more details:
Element ‘faultstring’ with namespace name ” was not found. Line 6, position 126
Solution for this quite easy: you need to reorder properties in nusoap_fault::serialize() method with this order:
1. faultcode
2. faultstring
3. faultactor
4. faultdetail
So the new serialize() method for nusoap_fault class should looks like this:
After pulling me hair for few hours I came up to this.
Thanks Pawel, would be nice if someone actually puts this in HEAD.
Also, using var $soap_defencoding = 'ISO-8859-1' as default breaks .NET clients when nusoap_fault is returned, IMHO there is no reason not to use utf-8 as default.
Last edit: ShaX 2013-11-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
There is weird bug in .NET that requires from SOAP Fault data to have explicit order of properties.
Problem occurs when you get nusoap fault response from PHP read your .NET application. You get strange exception:
Inner exception reveals more details:
This problem is quite well described here:
http://www.dirty-motherfucker.org/blog/2010/04/27/passing-soap-faults-from-nusoap-to-c/
Solution for this quite easy: you need to reorder properties in nusoap_fault::serialize() method with this order:
1. faultcode
2. faultstring
3. faultactor
4. faultdetail
So the new serialize() method for nusoap_fault class should looks like this:
Could anyone please put this into HEAD revision? It will not affect existing code, just make .NET clients working with nusoap.
Best regards,
Paweł Grądziel
Paweł is completely right:
According to soap envelope schema (http://schemas.xmlsoap.org/soap/envelope/) Fault is defined as sequence:
It means all Fault elements has to be placed in xml in correct order:
- faultcode
- faultstring
- faultactor
- detail
Xml generated with nusoap is incorrect according to schema.
After pulling me hair for few hours I came up to this.
Thanks Pawel, would be nice if someone actually puts this in HEAD.
Also, using var $soap_defencoding = 'ISO-8859-1' as default breaks .NET clients when nusoap_fault is returned, IMHO there is no reason not to use utf-8 as default.
Last edit: ShaX 2013-11-08