def AsCGI(nsdict={}, typesmodule=None, rpc=False, modules=None):
if os.environ.get('<STR_LIT>') != '<STR_LIT:POST>':<EOL><INDENT>_CGISendFault(Fault(Fault.Client, '<STR_LIT>'))<EOL>return<EOL><DEDENT>ct = os.environ['<STR_LIT>']<EOL>try:<EOL><INDENT>if ct.startswith('<STR_LIT>'):<EOL><INDENT>cid = resolvers.MIMEResolver(ct, sys.stdin)<EOL>xml = cid.GetSOAPPart()<EOL>ps = ParsedSoap(xml, resolver=cid.Resolve)<EOL><DEDENT>else:<EOL><INDENT>length = int(os.environ['<STR_LIT>'])<EOL>ps = ParsedSoap(sys.stdin.read(length))<EOL><DEDENT><DEDENT>except ParseException as e:<EOL><INDENT>_CGISendFault(FaultFromZSIException(e))<EOL>return<EOL><DEDENT>_Dispatch(ps, modules, _CGISendXML, _CGISendFault, nsdict=nsdict,<EOL>typesmodule=typesmodule, rpc=rpc)<EOL>
Dispatch within a CGI script.