falc410 / pysimplesoap

Automatically exported from code.google.com/p/pysimplesoap
0 stars 0 forks source link

Remove xmlns-tags for child-nodes - simplexml.py #151

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. By using a Webservice, the namespace (xmlns="mynamespace") is set to each 
node. The Webservice is not useable by sending the request in this way. 
2. Connect the WebService link this:
client    = SoapClient(
         wsdl            = WSDL_URL
        ,location        = WSDL_URL
        ,ns              = 'mynamespace'
        ,exceptions      = True
        ,http_headers    = {'Authorization':'Basic %s' %encoded}
        ,trace           = True
        ,soap_server     = 'oracle'
        )
client.mymethod(params={u'key':'value'})

What is the expected output? What do you see instead?
Expected output:

<?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:mynamespace="http://.../" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
        <soapenv:Header/>
        <soapenv:Body>
            <mynamespace:mymethod>
                <params>
                    <key>value</key>
                </params>
            </mynamespace:mymethod>
</soapenv:Body>
</soapenv:Envelope>

Current output:
<?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:mynamespace="http://.../" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
        <soapenv:Header/>
        <soapenv:Body>
            <mynamespace:mymethod>
                <params>
                    <key xmlns="http://.../">value</key>
                </params>
            </mynamespace:mymethod>
</soapenv:Body>
</soapenv:Envelope>

What version of the product are you using? On what operating system?
1.14

Please attach the related WSDL (if any), a small code fragment to reproduce
and provide any additional information below.

Solution that works for me:
    Uncomment Lines 74 and 75 in simplexml.py:
        #if ns:
        #    element.setAttribute("xmlns", ns)

My wish:
    A Parameter in the SoapClient-Connect to disable the xmlns for the nodes.

Original issue reported on code.google.com by karsten....@gmail.com on 23 Jul 2014 at 11:48

GoogleCodeExporter commented 9 years ago
The parameter in the constructor to control the xml response (dialect) is 
soap_server.
Which one you're using?
Sometimes this can be deducted from the WSDL, could you attach it?

Original comment by reingart@gmail.com on 23 Jul 2014 at 8:59

GoogleCodeExporter commented 9 years ago
I use "soap_server = 'Oracle'" as described at the top of the post.
BUT: I mean the OUTPUT, which pysimplesoap generates to send the PostRequest. 
Not the Response from the WebService!

I'm not able to attach the WSDL, becaus ist a customer-Projekt which i can not 
publish - i'm sorry.

Original comment by karsten....@gmail.com on 28 Jul 2014 at 7:20

jorgeoa commented 8 years ago

Same problem here, the library inserts xmlns in child nodes and the server doesn't interpret them well. I'm using version 1.16