Skip to content

Commit 85bed2c

Browse files
author
Jamie Kirkpatrick
committed
Initial commit of the new WSDL parsing scripts and associated examples.
1 parent 7901fe4 commit 85bed2c

8 files changed

+1029
-243
lines changed

examples/classserializer_client.py

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#
2+
# soaplib - Copyright (C) 2009 Aaron Bickell, Jamie Kirkpatrick
3+
#
4+
# This library is free software; you can redistribute it and/or
5+
# modify it under the terms of the GNU Lesser General Public
6+
# License as published by the Free Software Foundation; either
7+
# version 2.1 of the License, or (at your option) any later version.
8+
#
9+
# This library is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
# Lesser General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU Lesser General Public
15+
# License along with this library; if not, write to the Free Software
16+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
17+
#
18+
19+
'''
20+
This example shows how to parse wsdl created by the classserializer.py
21+
server and use the dynamically generated objects as a client
22+
'''
23+
24+
from soaplib.parsers.wsdlparse import WSDLParser
25+
import lxml.etree as et
26+
import urllib2 as ulib
27+
from soaplib.client import make_service_client
28+
29+
wp = WSDLParser.from_url('http://localhost:7789/wsdl')
30+
UserManager = wp.services['UserManager']
31+
User = wp.ctypes['{UserManager.UserManager}User']
32+
user = User()
33+
user.username = 'john_smith'
34+
user.firstname = 'john'
35+
user.surname = 'smith'
36+
client = make_service_client('http://localhost:7789/', UserManager())
37+
userid = client.add_user(user)
38+
print "adding user - id: %s" % userid
39+
users = client.list_users()
40+
for u in users:
41+
print u.username
42+
43+

examples/client_helloworld_attach.py

+17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
#!/usr/bin/env python
2+
#
3+
# soaplib - Copyright (C) 2009 Aaron Bickell, Jamie Kirkpatrick
4+
#
5+
# This library is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU Lesser General Public
7+
# License as published by the Free Software Foundation; either
8+
# version 2.1 of the License, or (at your option) any later version.
9+
#
10+
# This library is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public
16+
# License along with this library; if not, write to the Free Software
17+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18+
#
219

320
from soaplib.client import make_service_client
421
from soaplib.serializers.binary import Attachment

examples/helloworld_attach.py

+17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
#!/usr/bin/env python
2+
#
3+
# soaplib - Copyright (C) 2009 Aaron Bickell, Jamie Kirkpatrick
4+
#
5+
# This library is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU Lesser General Public
7+
# License as published by the Free Software Foundation; either
8+
# version 2.1 of the License, or (at your option) any later version.
9+
#
10+
# This library is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public
16+
# License along with this library; if not, write to the Free Software
17+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18+
#
219

320
from soaplib.service import soapmethod
421
from soaplib.serializers.primitive import String, Integer, Array

setup.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
'lxml>=2.2.1',
4141
],
4242
test_suite='tests.test_suite',
43-
entry_points="""
44-
""",
43+
entry_points={
44+
'console_scripts': [
45+
'xsd2py = soaplib.parsers.typeparse:run',
46+
'wsdl2py = soaplib.parsers.wsdlparse:run'
47+
]
48+
},
4549
)

soaplib/ext/wsdl2py.py

-241
This file was deleted.

soaplib/parsers/__init__.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# soaplib - Copyright (C) 2009 Aaron Bickell, Jamie Kirkpatrick
3+
#
4+
# This library is free software; you can redistribute it and/or
5+
# modify it under the terms of the GNU Lesser General Public
6+
# License as published by the Free Software Foundation; either
7+
# version 2.1 of the License, or (at your option) any later version.
8+
#
9+
# This library is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
# Lesser General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU Lesser General Public
15+
# License along with this library; if not, write to the Free Software
16+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
17+
#
18+
19+
pass

0 commit comments

Comments
 (0)