1 | #!/usr/local/bin/python |
---|
2 | |
---|
3 | from fedd_client import * |
---|
4 | |
---|
5 | from ZSI.TC import QName, String, URI, AnyElement, UNBOUNDED, Any |
---|
6 | from ZSI.wstools.Namespaces import SOAP |
---|
7 | from ZSI.fault import FaultType |
---|
8 | |
---|
9 | |
---|
10 | # This is a bit of minimal trickery to integrate detail parsing of SOAP faults. |
---|
11 | # ZSI expects detail fields to parse to a class with an "any" attribute. This |
---|
12 | # little class has such an attribute pointed at itself, so when |
---|
13 | # ZSI.fault.FaultFromMessage extracts that field, it places this object into |
---|
14 | # the new Fault object. One can also get around this using an extra XML field |
---|
15 | # in the message, parsing the wrapper to the any attribute and then actial body |
---|
16 | # to the class in the any attribute, but this does not perturb the WSDL. |
---|
17 | class detail_faultType: |
---|
18 | def __init__(self): |
---|
19 | self.FeddFaultBody = None |
---|
20 | self.any = self |
---|
21 | def get_element_FeddFaultBody(self): |
---|
22 | return self.FeddFaultBody |
---|
23 | |
---|
24 | # Override ZSI.fault.FaultType.typecode - give a parser that speaks our |
---|
25 | # language. |
---|
26 | FaultType.typecode = \ |
---|
27 | Struct(FaultType, |
---|
28 | [QName(pname='faultcode'), |
---|
29 | String(pname='faultstring'), |
---|
30 | URI(pname=(SOAP.ENV,'faultactor'), minOccurs=0), |
---|
31 | Struct(pname='detail', aname='detail', |
---|
32 | ofwhat=[ns0.faultType_Def((ns0.faultType_Def.schema, "FeddFaultBody"))], |
---|
33 | pyclass=detail_faultType, minOccurs=0), |
---|
34 | ], |
---|
35 | pname=(SOAP.ENV,'Fault'), |
---|
36 | inline=True, |
---|
37 | hasextras=0, |
---|
38 | ) |
---|
39 | |
---|