source: fedd/federation/parse_detail.py @ 187a8f9

Last change on this file since 187a8f9 was 8445caf, checked in by Ted Faber <faber@…>, 14 years ago

Missed a couple try blocks that must go.

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