Michael Sivak Michael Sivak - 1 year ago 92
Python Question

Send request on webservice from URL

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

This is it:

# -*- coding: windows-1250 -*-
from flask import Flask
from flask_spyne import Spyne
from spyne.protocol.soap import Soap11
from spyne.model.primitive import Unicode
from spyne.model.complex import Iterable

app = Flask(__name__)
spyne = Spyne(app)

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

@spyne.srpc(Unicode, Unicode, _returns=Iterable(Unicode))
#some code

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

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

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


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

Answer Source

So, now, I have it.

This is correct way:

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

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


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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download