WEB SERVICE IN DJANGO USING SOAP

625 views
Skip to first unread message

sami nathan

unread,
Nov 27, 2010, 1:46:39 AM11/27/10
to django...@googlegroups.com
Thanks for notification I am trying to develop web service using
django with soap interface i checked my code in python to open wsdl
file but its showing error i am sure that wsdl file dosent have any
errors this is my code>>> from SOAPpy import WSDL
>> server=WSDL.Proxy('D/soap/FlyppSms.wsdl')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Python25\Lib\site-packages\SOAPpy\WSDL.py", line 67, in __init__
self.wsdl = reader.loadFromString(str(wsdlsource))
File "D:\Python25\Lib\site-packages\SOAPpy\wstools\WSDLTools.py", line 47, in
loadFromString
return self.loadFromStream(StringIO(data))
File "D:\Python25\Lib\site-packages\SOAPpy\wstools\WSDLTools.py", line 28, in
loadFromStream
document = DOM.loadDocument(stream)
File "D:\Python25\Lib\site-packages\SOAPpy\wstools\Utility.py", line 602, in l
oadDocument
return xml.dom.minidom.parse(data)
File "D:\Python25\Lib\site-packages\_xmlplus\dom\minidom.py", line 1915, in pa
rse
return expatbuilder.parse(file)
File "D:\Python25\Lib\site-packages\_xmlplus\dom\expatbuilder.py", line 930, i
n parse
result = builder.parseFile(file)
File "D:\Python25\Lib\site-packages\_xmlplus\dom\expatbuilder.py", line 207, i
n parseFile
parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 1

Sam Lai

unread,
Nov 27, 2010, 1:53:29 AM11/27/10
to django...@googlegroups.com
How was the WSDL generated? Was it done on a Windows machine? If so,
it writes a Byte Order Mark at the start of Unicode documents by
default. *nix and Python however doesn't expect BOMs, so it chokes.

You need to remove the BOM from your WSDL file.

> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>

sami nathan

unread,
Nov 27, 2010, 2:13:34 AM11/27/10
to django...@googlegroups.com
encoding="UTF-8"?> should i remove this from wsdl file...? and more
over i am trying to use my system as server i am refering dive into
python chapter 12 introspecting wsdl and searching google i cant find
weather its an client side code or server side code but i am in need
of server side code do u find any refrence for me to study server side
code using SOAP or REST sorry if i had asked anything wrong i am
newbee

Sam Lai

unread,
Nov 27, 2010, 2:56:17 AM11/27/10
to django...@googlegroups.com
No, you need that line. It is the first *character* of the file that
you need to remove. It is an *invisible* character. Try opening and
closing it in notepad; it might remove it. Otherwise, can you get your
WSDL generator to not output the BOM?

Or, you could use python to read and rewrite that file without the BOM.

sami nathan

unread,
Nov 27, 2010, 3:09:35 AM11/27/10
to django...@googlegroups.com
After opening and closing also showing me the same result i cant say
not to output the BOM to generator b coz its an another person who
generated and gave to me and asking me to create web service using
just wsdl file and given me open choice of use rather SOAP or REST i
also decided to use REST now will u refer me the tutorial to rest and
also to solve above problem

Sam Lai

unread,
Nov 27, 2010, 3:26:50 AM11/27/10
to django...@googlegroups.com
I don't know much about converting WSDL to SOAP/REST in Django.
Probably easier with SOAP as WSDL and SOAP are often used together.

You need to check if the first character is actually the BOM. Open the
file in a hex editor and see what the first byte is. It might not be.
A quick Google tells me expat should be able to deal with the BOM, so
it might be some other character. In any case, the first character
needs to be the < character. There can't be any visible/invisible
characters preceding it, e.g. a newline.

If the first two bytes are FE FF then it is the BOM.

Reply all
Reply to author
Forward
0 new messages