[XML-SIG] [PATCH] wsdllib.py
Uche Ogbuji
uche.ogbuji@fourthought.com
Tue, 18 Mar 2003 13:33:35 -0700
> On Monday 03 March 2003 12:35 am, Uche Ogbuji wrote:
>
> > Is there any chance you could put together a patch to update wsdllib.py
>
> Patch enclosed below (output of diff -u -b). Please review and comment.
I just got thinsg organized again on the wsdl4py project and tried reviewing
this patch more closely, but it appears to have been munged. For example
there's the hunk:
> @@ -50,9 +68,25 @@
> g_faultExpression = xpath.Compile('w:fault')
> g_portsExpression = xpath.Compile('w:port')
>
> -def ReadFromStream(stream):
> - """Read in a WSDL message from a steam object"""
> +class WsdlException(Exception):
> + def __init__(self, msg):
> + self.msg = msg
> + def __str__(self):
> + return self.msg
> +
> +
> +def ReadFromStream(stream, uri='file://' + os.getcwd() + os.sep + 'foo'):
> + """Read in a WSDL message from a steam object
> +
> + 4Suite 0.12 requires a URI when parsing xml data, as it is required to
> + resolve XIncludes and entities. It is also required for some XSLT (for
> + example xsl:include and xsl:import) and RDF."""
> +
> ws = Wsdl()
> + if DOMLETTE_UNIFICATION:
> + dom = Ft.Xml.Domlette.NonvalidatingReader.parseStream(stream, uri)
> + ws.fromDom(dom)
> + else:
> reader = pDomlette.PyExpatReader()
^^^^^ broken indentation
> dom = reader.fromStream(stream)
> ws.fromDom(dom)
> @@ -68,10 +102,17 @@
> def ReadFromUri(uri):
> """Read in a WSDL message from a URI"""
> st = urllib.urlopen(uri)
> - ws = ReadFromStream(st)
> + ws = ReadFromStream(st, uri)
> st.close()
> return ws
>
> +def getAttributeNSWrapper(node, namespaceprefix, attribute):
> + """Newer stuff uses xml.dom.EMPTY_NAMESPACE (None) instead of ''."""
> +
> + if not namespaceprefix and DOMLETTE_UNIFICATION:
> + return node.getAttributeNS(xml.dom.EMPTY_NAMESPACE, attribute)
> + else:
> + return node.getAttributeNS(namespaceprefix, attribute)
>
> class Wsdl:
> """This class represents the entire WSDL definition. It can be created
> from one of the above
Which, of course, results in broken Python.
Could you double-check this patch and re-send as an attachment? OK to send
just to me.
Thanks.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://4Suite.org http://fourthought.com
Universal Business Language (UBL) - http://www-106.ibm.com/developerworks/xml/l
ibrary/x-think16.html
EXSLT by example - http://www-106.ibm.com/developerworks/library/x-exslt.html
The worry about program wizards - http://www.adtmag.com/article.asp?id=7238
Use rdf:about and rdf:ID effectively in RDF/XML - http://www-106.ibm.com/develo
perworks/xml/library/x-tiprdfai.html
Keep context straight in XSLT - http://www-106.ibm.com/developerworks/xml/libra
ry/x-tipcurrent.html
Python Generators + DOM - http://www.xml.com/pub/a/2003/01/08/py-xml.html
Using SAX for Proper XML Output - http://www.xml.com/pub/a/2003/03/12/py-xml.ht
ml
SAX filters for flexible processing - http://www-106.ibm.com/developerworks/xml
/library/x-tipsaxflex.html