Michael Sivak
Michael Sivak

Reputation: 27

Send request on webservice from URL

I have SOAP webservice written in python with Spyne module..

This is it:

class Function(spyne.Service):
    __service_url_path__ = '/soap';
    __in_protocol__ = Soap11(validator='lxml');
    __out_protocol__ = Soap11();

    @spyne.srpc(Unicode, _returns=Iterable(Unicode))
    def Function(A):
        #some code

if __name__ == '__main__':
    app.run(host = '127.0.0.1');

And I need to send request on that server from URL. It should look like this:

IP:port/soap/function?A=1

But when I try it, this appears:

You must issue a POST request with the Content-Type header properly set

But I don´t know what it is.. How it should be properly? Can someone help with it?

Should I just change that URL, or server code too?

Thank you very much

Upvotes: 0

Views: 825

Answers (1)

Michael Sivak
Michael Sivak

Reputation: 27

So, now, I have it.

This is correct way:

class Function(spyne.Service):
    __service_url_path__ = '/soap';
    __in_protocol__ = HttpRpc(validator='soft'); #this is it 
    __out_protocol__ = Soap11();

Now, I can call web service from URL like this:

IP:port/soap/function?A=1

So, this is it.. I hope that it will help someone sometimes :)

Upvotes: 1

Related Questions