soaplib - python - namespace missing in header

260 Views Asked by At

I'm using soaplib (python) to make a webservices server.

I have implemented a method and generated a wsdl so that any soap client can use easily the webservice.

I'm using soapUI to validate my webservice, and soapUI says the response isn't OK.

I found out what was wrong in the XML but can't make soapLib use the correct way...

Here is my PythonClass:

class AgentSoapManager(SimpleWSGISoapApp):
    """ Interface for web services """
    @soapmethod(String, _returns = String)
    def get_streaming_url(self, application_identifier):
        returns "rtsp://192.168.10.224:51081/camera8"

I'm using WSGIServer.

Here is my call (which is OK according to soapUI):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:agen="agent.soap.AgentSoapManager.AgentSoapManager">
   <soapenv:Header/>
       <soapenv:Body>
            <agen:get_streaming_url>
                 <application_identifier>0800275ec350_jaguar_8</application_identifier>
            </agen:get_streaming_url>
       </soapenv:Body>
</soapenv:Envelope>

Here is the wrong response from my webservice

<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Body>
        <get_streaming_urlResponse>
            <get_streaming_urlResult xsi:type="xs:string">
                 rtsp://192.168.10.224:51081/camera8
             </get_streaming_urlResult>
        </get_streaming_urlResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Here is the error :

line-1: Missing part with name [{agent.soap.AgentSoapManager.AgentSoapManager}get_streaming_urlResponse

Here is the response I found and which is OK according to soapUI

<SOAP-ENV:Envelope xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:agen="agent.soap.AgentSoapManager.AgentSoapManager">
    <SOAP-ENV:Body>
        <agen:get_streaming_urlResponse>
            <get_streaming_urlResult>
                rtsp://192.168.10.224:51081/camera8
            </get_streaming_urlResult>
        </agen:get_streaming_urlResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
1

There are 1 best solutions below

0
On BEST ANSWER

I did the job by changing my Soap lib to Spyne. There was not much to change to have it work, and the request/responses are this time directly ok