SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    219
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript WSDL parsing

    Hi All,

    I'm in the process of writing a WSDL parser but have an issue because of the differences between FF and IE's XML Dom implementation and the fact that IE is not namespace aware.

    Given a WSDL that contains the following:

    HTML Code:
    <binding name="StockQuoteBinding" type="tns:StockQuotePortType">
    		<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
    		<operation name="getQuote">
    			<soap:operation
    				soapAction="urn:xmethods-delayed-quotes#getQuote" />
    			<input>
    				<soap:body use="encoded"
    					namespace="urn:xmethods-delayed-quotes"
    					encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
    			</input>
    			<output>
    				<soap:body use="encoded"
    					namespace="urn:xmethods-delayed-quotes"
    					encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
    			</output>
    		</operation>
    	</binding>
    Using the following code:

    PHP Code:
    var bindings doc.getElementsByTagName('binding'); 
    FF returns 2 elements
    IE returns 1 element

    For the soap binding, IE would prefer me to use:

    PHP Code:
    var bindings doc.getElementsByTagName('soap:binding'); 
    Now, I thought I could probably work around this by identifying the namespaces used in the wsdl....

    Eg:

    PHP Code:
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
        
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        
    xmlns="http://schemas.xmlsoap.org/wsdl/"
        
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
        
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
    This will probably work, except I was just playing with Google's WSDL (http://api.google.com/GoogleSearch.wsdl) and they don't define the namespaces that they use (xsd, soap and wsdl) - isn't this crazy???

    Has anyone done something similar?

    Am I barking up the wrong tree?

    Should I try a different approach to parsing a wsdl?

    Thanks in advance for any help or advice anyone can give.

    Dan

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have a look at this page, the third discussion post talks about a custom function for ie and its non-support of getElementsByTagNameNS

    http://www.mnot.net/blog/2006/10/19/declarative_ajax

  3. #3
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    219
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Jim,

    That's the sort of thing I was considering - wouldn't help with the Google or Amazon wsdl's though as they strangely don't declare their namespaces.

    Dan


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •