pysimplesoap/pysimplesoap — pull request #29 by dotnetdan (2014-12-03 21:59:15+00:00)
Title: Feat/faultdetail

I've added client side support for receiving and unmarshaling the detail element of a SOAP Fault, in accordance to the [SOAP 1.1 spec](http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383507). My implementation involved some design decisions that affect the API, so I thought it would be appropriate that others have a chance to review this before it gets merged.

I've tested this and verified it works with a .NET WCF service, that throws a custom FaultContract.

Sample Usage
If a client request to a service results in the following SOAP Fault:
```xml

s:Client
My service encountered an error.

Fatal error!

Georges
Johnny
Robbie

```

```python
try:
client = SoapClient(wsdl="https://company.com/testservice?singleWsdl")
client.Insert(businessObject)
except SoapFault as e:
print e
if(e.detail):
pprint.pprint(e.detail)

'''output:
s:Client: My service encountered an error.
{'MyApplicationFault': {'ErrorCode': u 'Fatal error!',
'AffectedUsers': [{'string': u 'Georges'},
{'string': u 'Johnnie'},
{'string': u 'Robbie'}]
}
}
'''
```

Comments:

1. According to the SOAP 1.1 spec, a SOAP Fault can actually have multiple Detail elements, and each one can contain multiple child elements. I've only added support for a single detail element with a single child. This matches WCF, which only supports for a single Detail element with a single child. I'm pretty sure that Java Metro is also the same in this regard.
2. I did not modify __unicode__ or __str__, because in my experience details can be huge and would make the string unreadable.
3. I noticed that the current SoapFault class only supports SOAP 1.1. In 1.2, the names of the fault properties have changed (e.g. faultcode is now just code).