Active
Project:
SOAP Server
Version:
6.x-1.2-beta1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Oct 2010 at 04:09 UTC
Updated:
15 Oct 2010 at 05:06 UTC
In some of my Web Service methods I need to report server errors using services_error() calls.
This calls soap_server_server_error($message) which returns a NuSOAP nusoap_fault() object
which, if you call serialize() on it, results in a perfect XML representation of the SOAP-ENV:Fault
Unfortunately this fault object is not handled well by soap_call_wrapper(). It tries to map the object into an array. and then map the array to XML and send this to the client as a legitimate SOAP result. Sadly this ends even less well because the generated XML is invalid.
<SOAP-ENV:Envelope>
<SOAP-ENV:Body>
<return xsi:type="SOAP-ENC:Array">
<item><title/><value/></item>
...
<item>
<title xsi:type="xsd:string">typemap</title>
<value><http://www.w3.org/2001/XMLSchema> <----- What the hell?
<string xsi:type="xsd:string">string</string>
<boolean xsi:type="xsd:string">boolean</boolean>
<float xsi:type="xsd:string">double</float>
<double xsi:type="xsd:string">double</double>
<decimal xsi:type="xsd:string">double</decimal>
<duration xsi:type="xsd:string"></duration>
<dateTime xsi:type="xsd:string">string</dateTime>
...
At the moment I can't see how to break out of soap_call_wrapper() and avoid the resultant array wrapping.
Comments
Comment #1
doobs commentedSorry, that was easier than I expected. Just modify soap_call_wrapper() as below:
But now my ZSI python client complains that the SOAPFault is wrong:
Comment #2
doobs commentedI found a way forward that ZSI seems to be happy with. I had to add QName to the nusoap_base class in nusoap.php (and/or class.nusoap_base.php) - this was a one line change.
Then soap_server_server_error() needed a bit of a rewrite to convince soap_fault() to serialize both the faultcode and the detail (which caused additional ZSI problems) in an acceptible manner for ZSI.
Now the response looks like this: