Bonjour,

Je m'essaye actuellement aux web services, et j'ai un problème avec le fichier wsdl.

Voici le code lancant le serveur (ressemble beaucoup a celui du tuto)

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import soaplib
 
from soaplib.core import Application
from soaplib.core.service import soap
from soaplib.core.service import DefinitionBase
from soaplib.core.model.primitive import String, Integer
 
from soaplib.core.server import wsgi
from soaplib.core.model.clazz import Array
 
'''
This is a simple HelloWorld example to show the basics of writing
a webservice using soaplib, starting a server, and creating a service
client.
'''
 
class HelloWorldService(DefinitionBase):
    @soap(String, Integer, _returns=Array(String))
    def say_hello(self, name, times):
        '''
        Docstrings for service methods appear as documentation in the wsdl
        <b>what fun</b>
        @param name the name to say hello to
        @param the number of times to say hello
        @return the completed array
        '''
        results = []
        for i in range(0, times):
            results.append('Hello, %s' % name)
        return results
 
    @soap(String,Integer,Integer,_returns=Integer)
    def zoubi(self, names, a, b):
        '''
        Docstrings for service methods appear as documentation in the wsdl
        <b>what fun</b>
        @param name the name to say hello to
        @param the number of times to say hello
        @return the completed array
        '''
        results=(a+b)
        return results
 
 
if __name__=='__main__':
    try:
        from wsgiref.simple_server import make_server
        soap_application = soaplib.core.Application([HelloWorldService], 'tns')
        wsgi_application = wsgi.Application(soap_application)
 
        print "listening to http://0.0.0.0:7989"
        print "wsdl is at: http://127.0.0.1:7989/?wsdl"
 
        server = make_server('localhost', 7989, wsgi_application)
        server.serve_forever()
Et voici le code pour lire le fichier wsdl (avec suds)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
#!/usr/bin/env python
from suds.client import Client
import time
import urllib2
import sys
import urllib
 
url ='http://130.79.10.130/?wsdl
client=Client(url)
print client
Bon jusque la tout va. Le serveur se lance et le fichir wsdl est bien lut.

Maintenant si j'éteins le serveur, que je rajoute une méthode et que je le rallume. Le fichier wsdl est bien modifié, mais uniquement si je l'ouvre manuellement. (en tapant l'adresse dans un navigateur).

Lorsque je relance le code appelant suds, il utilise toujours l'ancien wsdl. Et le seul moyen que j'ai trouvé pour le moment pour qu'il prenne en compte le nouveau c'est de changer de port. (ce que je trouve un peu moche)

Y a t"il un moyen de faire cela plus proprement ?