[Twisted-web] Namespace in 200 OK response from SOAP server?
Ignacio Mas Ivars
nacho at kth.se
Thu Nov 9 02:20:22 CST 2006
Hi all,
I am having a problem with a SOAP server, because the answer I am
sending does not include the namespace that comes with the request.
This is the full interaction of my server using a test python client:
POST /SOAP HTTP/1.0
Host: 127.0.0.1
User-Agent: Twisted PageGetter
Content-Length: 734
SOAPAction: get_media_URL
content-type: text/xml
connection: close
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:get_media_URL xmlns:ns1="urn:ms" SOAP-ENC:root="1">
<v1 xsi:type="xsd:string">MyContent</ns1:get_media_URL>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
HTTP/1.0 200 OK
Date: Wed, 08 Nov 2006 16:12:50 GMT
Content-length: 550
Content-type: text/xml; charset="UTF-8"
Server: TwistedWeb/2.4.0
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<get_media_URLResponse SOAP-ENC:root="1">
<Result xsi:type="xsd:string">Result</Result>
</get_media_URLResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The problem is that the real SOAP client that sends the request is
expecting an answer that contains the namespace as well, so that the
answer should be:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:get_media_URLResponse xmlns:ns1="urn:ms" SOAP-ENC:root="1">
<Result xsi:type="xsd:string">Result</Result>
</ns1:get_media_URLResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The code of my server is as simple as:
def getQuote():
return "Result"
class SOAPListener(soap.SOAPPublisher):
def __init__(self):
print "SM controller started"
def soap_get_media_URL(self, message):
print "Got: ", message
return getQuote()
def main():
from twisted.internet import reactor
root = resource.Resource()
root.putChild('SOAP', SOAPListener())
reactor.listenTCP(8080, server.Site(root))
reactor.run()
if __name__ == '__main__':
main()
Now, how can I force the server to answer back with the proper
namespace? The client refuses to understand the message back
otherwise... Any help will be greatly appreciated!
Thanks,
/Nacho
---
,,,
(o o)
--ooO--(_)---Ooo-----------
Why get your news from seasoned professionals when you can get
half-witted rumors from random strangers [on the Internet]?-Joel
Achenbach
--oo0--------0oo-----------
More information about the Twisted-web
mailing list