simple example for custom wsdl autogeneration

Asked by romankrv on 2011-07-25

Please give some simple example for custom wsdl autogeneration.


Question information

English Edit question
ladon Edit question
jsgaarde Edit question
Solved by:
Last query:
Last reply:

This question was reopened

jsgaarde (jakob-simon-gaarde) said : #1


Can you tell me what you meen by custom wsdl?

romankrv (romankrv) said : #2

for example:
I want to hav in wsdl
 <portType name="myname.
   <service name=
     <operation name="RequestFeature>



romankrv (romankrv) said : #3

That is:
exist code (ladon code) which generation wsdl" as
class SOAPServiceDescriptor(ServiceDescriptor):

 xsd_type_map = type_to_xsd
 _content_type = 'text/xml'

 def generate(self,servicename,servicenumber,typemanager,methodlist,service_url,encoding): ......

and I want to set "servicename" from generate meth

can simple example for that


jsgaarde (jakob-simon-gaarde) said : #4

Ladon follows the wsdl 1.1 specification completely as far as I know:

The servicename comes from the name of your serviceclass. Why do you want Ladon to use another name than the one you gave it while implementing your serviceclass?

/ Jakob Simon-Gaarde

romankrv (romankrv) said : #5

Hi Jakob.
I want to continue discuss about create wsdl file:
Can you explain how to create custom wsdl on demaind (auto generation) via ladon ?
Maybe you have some simple example for that.

(custom wsdl --> it is like or like

jsgaarde (jakob-simon-gaarde) said : #6

What changes should the custom wsdl make?

romankrv (romankrv) said : #7

For example i want to set
soapAction = "myURI"

your lib not have in

def generate(self,servicename,servicenumber,typemanager,methodlist,service_url,encoding):

that definition.

that have only soapAction tag with NULL definition

 for m in methodlist:


so that parametr not configurable but i don't want override that function

Can you made more flexible for that?


jsgaarde (jakob-simon-gaarde) said : #8


See that was more specific. You have to remember that this is a community project. It's better you tell me exactly if there is a problem so I can fix it for everyone rather that you make your own custom fix that noone else benefits from - that's the way open source works :-)

And in this case you found something that might even be a bug, so please report it as a bug instead of a question.

About the possibility to make custom wsdl, all you have to do is:
1. copy the ladon/interfaces/ module to ie. ladon/interfaces/
2. edit ladon/interfaces/ and in the bottom change the classname SOAPInterface to MYSOAPInterface and make the static method _interface_name() return "mysoap"
3. edit ladon/interfaces/ add "import ladon.interfaces.mysoap" in the bottom of the file

When you have done that you have two identical interfaces soap and mysoap, changing generate() method in will not affect the soap interface.

The best and most open sourcely thing to do is ofcourse fix/enhance the soap interface on your local system and commit a bug fix, that way you will be credited as a contributer - sounds nice ;-)

Best Regards
Jakob Simon-Gaarde

romankrv (romankrv) said : #9

ok. thanks for instruction.
I done like that but i get error when I start ladon-server

error is:

  File "/home/krv/VIRTUALENVS/LADON/lib/python2.6/site-packages/ladon/interfaces/", line 5, in <module>
    from ladon.interfaces import mysoap # added here
  File "/home/krv/VIRTUALENVS/LADON/lib/python2.6/site-packages/ladon/interfaces/", line 4, in <module>
    from ladon.interfaces import expose
ImportError: cannot import name expose


What is problem?


jsgaarde (jakob-simon-gaarde) said : #10

Please pastebin
 Den 02/08/2011 14.16 skrev "romankrv" <<email address hidden>
> Question #165951 on ladon changed:
> Status: Answered => Open
> romankrv is still having a problem:
> ok. thanks for instruction.
> I done like that but i get error when I start ladon-server
> error is:
> """
> File
line 5, in <module>
> from ladon.interfaces import mysoap # added here
> File
line 4, in <module>
> from ladon.interfaces import expose
> ImportError: cannot import name expose
> """
> What is problem?
> Thanks
> --
> You received this question notification because you are an answer
> contact for ladon.

jsgaarde (jakob-simon-gaarde) said : #12

Look at my 1. 2. 3. steps again especially step 3 which says: "at the bottom of the file"

Best regards
Jakob Simon-Gaarde

jsgaarde (jakob-simon-gaarde) said : #13

BTW - you don't have to remove the "soap" interface. "soap" and "mysoap" can happily coexist without a problem :-)

romankrv (romankrv) said : #14

Ok. It work(import not crash) but i not see that my def generate in is work only work from



romankrv (romankrv) said : #15

in debuging i go to soap not mysoap

romankrv (romankrv) said : #16

right like this in

import ladon.interfaces.mysoap
import ladon.interfaces.soap

or right:

import ladon.interfaces.soap
import ladon.interfaces.mysoap


jsgaarde (jakob-simon-gaarde) said : #17

The new interface you made is called mysoap so you have to use that. I just tried it, it works perfectly:

ladon/interfaces/ :

jsgaarde (jakob-simon-gaarde) said : #18

You should see a small difference in the wsdl that is created:


romankrv (romankrv) said : #19

I copy paste your to
and it not show me "his_is_mysoap"

what can problem maybe for that?

romankrv (romankrv) said : #20

if I even delete content in it work. work from

please help me about that

jsgaarde (jakob-simon-gaarde) said : #21

what is the url to your wsdl?

jsgaarde (jakob-simon-gaarde) said : #22

Have you gone to your web service's webpage with a browser?
1. Open your browser and go to: http://localhost:8000 (if you are running on port 8000)
2. Select the service
3. Find the interface "mysoap" press the description link

Best Regards
Jakob Simon-Gaarde

romankrv (romankrv) said : #23

exactly !

romankrv (romankrv) said : #24

I want to continue issue:
when I try use code for :

from suds.client import Client;
url = ''
client1 = Client(url)

i get error:


In [20]: client1 = Client(url)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (279, 0))

Exception Traceback (most recent call last)
/home/krv/PROJECTS/hv/<ipython-input-20-c45093bf5023> in <module>()
----> 1 client1 = Client(url)

/home/krv/VIRTUALENVS/LADON/lib/python2.6/site-packages/suds/client.pyc in __init__(self, url, **kwargs)
    110 self.set_options(**kwargs)
    111 reader = DefinitionsReader(options, Definitions)
--> 112 self.wsdl =
    113 plugins = PluginContainer(options.plugins)
    114 plugins.init.initialized(wsdl=self.wsdl)

/home/krv/VIRTUALENVS/LADON/lib/python2.6/site-packages/suds/reader.pyc in open(self, url)
    150 d = cache.get(id)
    151 if d is None:
--> 152 d = self.fn(url, self.options)
    153 cache.put(id, d)
    154 else:

/home/krv/VIRTUALENVS/LADON/lib/python2.6/site-packages/suds/wsdl.pyc in __init__(self, url, options)
    156 pmd.wrappers['schema'] = repr
    157 self.open_imports()
--> 158 self.resolve()
    159 self.build_schema()
    160 self.set_wrapped()

/home/krv/VIRTUALENVS/LADON/lib/python2.6/site-packages/suds/wsdl.pyc in resolve(self)
    205 """ Tell all children to resolve themselves """
    206 for c in self.children:
--> 207 c.resolve(self)
    209 def build_schema(self):

/home/krv/VIRTUALENVS/LADON/lib/python2.6/site-packages/suds/wsdl.pyc in resolve(self, definitions)
    492 qref = qualify(op.input, self.root, definitions.tns)
    493 msg = definitions.messages.get(qref)
--> 494 if msg is None:
    495 raise Exception("msg '%s', not-found" % op.input)
    496 else:

Exception: msg 'tns:RequestInterview', not-found


If i turn on to default (in ladon) it is no errors.
Because in it is only copy/paste code from with changed name class MYSOAPInterface and
 def _interface_name():
  return 'mysoap'

Can you reproduce that or what is error and why?


romankrv (romankrv) said : #25

one needs to reloads ipython shell