I'm using SOPApy to make a client for SOAP. Following code rises error.
import SOAPpy
wsdlFile = 'https://10.10.10.10/services/fwif?wsdl'
proxy = SOAPpy.WSDL.Proxy(wsdlFile)
Traceback (most recent call last):
File "run.py", line 28, in <module>
proxy = SOAPpy.WSDL.Proxy(wsdlFile)
File "/home/dinn/miniconda/envs/soaptest/lib/python2.7/site-packages/SOAPpy/WSDL.py", line 83, in __init__
self.wsdl = reader.loadFromString(str(wsdlsource))
File "/home/dinn/miniconda/envs/soaptest/lib/python2.7/site-packages/wstools/WSDLTools.py", line 49, in loadFromString
return self.loadFromStream(StringIO(data))
File "/home/dinn/miniconda/envs/soaptest/lib/python2.7/site-packages/wstools/WSDLTools.py", line 28, in loadFromStream
document = DOM.loadDocument(stream)
File "/home/dinn/miniconda/envs/soaptest/lib/python2.7/site-packages/wstools/Utility.py", line 645, in loadDocument
return xml.dom.minidom.parse(data)
File "/home/dinn/miniconda/envs/soaptest/lib/python2.7/xml/dom/minidom.py", line 1918, in parse
return expatbuilder.parse(file)
File "/home/dinn/miniconda/envs/soaptest/lib/python2.7/xml/dom/expatbuilder.py", line 928, in parse
result = builder.parseFile(file)
File "/home/dinn/miniconda/envs/soaptest/lib/python2.7/xml/dom/expatbuilder.py", line 207, in parseFile
parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 6
On stackoverflow I found a similar problem When I consume wsdl using python, I get an xml.parsers.expat.ExpatError but don't understand how to apply it for SOAPpy.
Related
I'm trying to read the following PDF https://assets.website-files.com/5deac75ecad2173c2ccccbc7/5df2560fba2fb0526f0ed55f_stellar-consensus-protocol.pdf
with pdfminer.six. I get the following error.
Traceback (most recent call last):
File "/Users/silas/Projects/virtualenvs/nlp/lib/python3.8/site-packages/pdfminer/high_level.py", line 146, in extract_text
for page in PDFPage.get_pages(
File "/Users/silas/Projects/virtualenvs/nlp/lib/python3.8/site-packages/pdfminer/pdfpage.py", line 147, in get_pages
doc = PDFDocument(parser, password=password, caching=caching)
File "/Users/silas/Projects/virtualenvs/nlp/lib/python3.8/site-packages/pdfminer/pdfdocument.py", line 695, in __init__
self.read_xref_from(parser, pos, self.xrefs)
File "/Users/silas/Projects/virtualenvs/nlp/lib/python3.8/site-packages/pdfminer/pdfdocument.py", line 968, in read_xref_from
xref.load(parser)
File "/Users/silas/Projects/virtualenvs/nlp/lib/python3.8/site-packages/pdfminer/pdfdocument.py", line 250, in load
self.data = stream.get_data()
File "/Users/silas/Projects/virtualenvs/nlp/lib/python3.8/site-packages/pdfminer/pdftypes.py", line 357, in get_data
self.decode()
File "/Users/silas/Projects/virtualenvs/nlp/lib/python3.8/site-packages/pdfminer/pdftypes.py", line 350, in decode
raise PDFNotImplementedError(error_msg)
pdfminer.pdftypes.PDFNotImplementedError: Unsupported predictor: 2
Is there any workaround? Is there some documentation about predictors in PDFs? Can I modify the PDF to be able to read it? I can't seem to make it work.
I have the following python program on Python 2.7 that uses python WDSL library.
>>> from SOAPpy import WSDL
>>> wsdlFile = 'my_wsdl_file_path'
>>> server = WSDL.Proxy(wsdlFile)
And I get below error;
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.7/SOAPpy/WSDL.py", line 62, in __init__
self.wsdl = reader.loadFromStream(stream, wsdlsource)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/WSDLTools.py", line 34, in loadFromStream
wsdl.load(document)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/WSDLTools.py", line 260, in load
schema = reader.loadFromNode(WSDLToolsAdapter(self), item)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 80, in loadFromNode
schema.load(reader)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 1088, in load
self.addImportSchema(tp.getSchema())
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 1205, in getSchema
self._schema = reader.loadFromURL(url)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 114, in loadFromURL
schema.load(reader)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 1120, in load
tp.fromDom(node)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 1764, in fromDom
self.setAttributes(node)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 627, in setAttributes
self.__checkAttributes()
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 681, in __checkAttributes
%(self.getItemTrace(), a, self.attributes[a])
SOAPpy.wstools.XMLSchema.SchemaError: <schema targetNamespace="http://tempuri.org/DataSetGW4.xsd"><element name="DataSetGW4">, unknown attribute(urn:schemas-microsoft-com:xml-msdata,{u'IsDataSet': u'true', u'UseCurrentLocale': u'true'})
what could be the reason?
My experience with SOAPpy is that it is not as complete nor tolerant as Suds. Maybe you should try parsing your WSDL file with suds instead.
import suds.client as client
session = client.Client('file:///absolute/path/to/yourwsdl')
I am trying to retrieve all facebook posts by a user after a post id. When I do it, I get an unknown error.
my code:
from facebook import *
token = facebook.get_app_access_token('3291XXXXXXXXXXXXX','c498e60cb1eXXXXXXXXXXXXX')
graph = GraphAPI(token)
g = graph.get('travelguard/posts?limit=5&since=68827688457_10151569356908458')
>>> Traceback (most recent call last):
File "<pyshell#40>", line 1, in <module>
graph.get('travelguard/posts?limit=5&since=68827688457_10151569356908458')
File "C:\Documents and Settings\visolank\Desktop\Python\programs\facepy\graph_api.py", line 42, in get
retry=retry
File "C:\Documents and Settings\visolank\Desktop\Python\programs\facepy\graph_api.py", line 251, in _query
return self._query(method, path, data, page, retry - 1)
File "C:\Documents and Settings\visolank\Desktop\Python\programs\facepy\graph_api.py", line 251, in _query
return self._query(method, path, data, page, retry - 1)
File "C:\Documents and Settings\visolank\Desktop\Python\programs\facepy\graph_api.py", line 251, in _query
return self._query(method, path, data, page, retry - 1)
File "C:\Documents and Settings\visolank\Desktop\Python\programs\facepy\graph_api.py", line 248, in _query
return load(method, url, data)[0]
File "C:\Documents and Settings\visolank\Desktop\Python\programs\facepy\graph_api.py", line 210, in load
result = self._parse(response.content)
File "C:\Documents and Settings\visolank\Desktop\Python\programs\facepy\graph_api.py", line 290, in _parse
error.get('code', None)
OAuthError: [1] An unknown error has occurred.
Facebook's API doesn't have the best error messages. "An unknown error has occurred." means you don't have permissions to access what you're trying to access.
I Use the following code to use a soap webservice written in PHP
#!/usr/local/bin/python
import logging
logging.basicConfig(levee = logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
logging.getLogger('suds.wsdl').setLevel(logging.DEBUG)
import urllib2
from suds.client import Client
from suds.sax.element import Element
url = 'a sopa webservice url'
client = Client(url)
It comes out the following error:
Traceback (most recent call last):
File "./auth.py", line 13, in <module>
client = Client(url)
File "build/bdist.linux-x86_64/egg/suds/client.py", line 112, in __init__
File "build/bdist.linux-x86_64/egg/suds/reader.py", line 152, in open
File "build/bdist.linux-x86_64/egg/suds/wsdl.py", line 136, in __init__
File "build/bdist.linux-x86_64/egg/suds/reader.py", line 79, in open
File "build/bdist.linux-x86_64/egg/suds/reader.py", line 101, in download
File "build/bdist.linux-x86_64/egg/suds/sax/parser.py", line 136, in parse
File "/usr/local/lib/python2.7/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/local/lib/python2.7/xml/sax/xmlreader.py", line 125, in parse
self.close()
File "/usr/local/lib/python2.7/xml/sax/expatreader.py", line 220, in close
self.feed("", isFinal = 1)
File "/usr/local/lib/python2.7/xml/sax/expatreader.py", line 214, in feed
self._err_handler.fatalError(exc)
File "/usr/local/lib/python2.7/xml/sax/handler.py", line 38, in fatalError
raise exception
xml.sax._exceptions.SAXParseException: <unknown>:1:0: no element found
I'm new to suds and sopa webservice,I don't know what the error means, can someone can give me some advices
You'll need this line to debug that:
logging.getLogger('suds.transport').setLevel(logging.DEBUG)
Sample output:
DEBUG:suds.transport.http:received:
CODE: 200
HEADERS: {'content-length': '16', ..., 'connection': 'close', 'x-sharepointhealthscore': '0', 'cache-control': 'private, max-age=0', 'date': 'Tue, 25 Mar 2014 11:24:51 GMT', 'www-authenticate': 'NTLM'}
MESSAGE:
401 UNAUTHORIZED
DEBUG:suds.client:HTTP succeeded:
401 UNAUTHORIZED
ERROR:suds.client:<suds.sax.document.Document instance at 0x02C21AF8>
Traceback (most recent call last):
File "ExpiryMonitor.py", line 99, in <module>
if __name__ == '__main__': main()
File "ExpiryMonitor.py", line 66, in main
items = c_lists.service.GetListItems(LIST_ID, VIEW_ID)
File "build\bdist.win32\egg\suds\client.py", line 521, in __call__
File "build\bdist.win32\egg\suds\client.py", line 581, in invoke
File "build\bdist.win32\egg\suds\client.py", line 621, in send
File "build\bdist.win32\egg\suds\client.py", line 661, in process_reply
File "build\bdist.win32\egg\suds\client.py", line 832, in _parse
File "build\bdist.win32\egg\suds\sax\parser.py", line 133, in parse
File "C:\python27\lib\xml\sax\expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "C:\python27\lib\xml\sax\xmlreader.py", line 123, in parse
self.feed(buffer)
File "C:\python27\lib\xml\sax\expatreader.py", line 211, in feed
self._err_handler.fatalError(exc)
File "C:\python27\lib\xml\sax\handler.py", line 38, in fatalError
raise exception
xml.sax._exceptions.SAXParseException: <unknown>:1:0: syntax error
Apparently even the maintained suds-jurko fork doesn't throw an error when using a login with insufficient rights.
Typically, this means the server is returning data, but it is not valid XML. It's likely a server problem.
when i do the following code:
family_members =db(db.member.id == membership_id).select
(db.member.name,db.member.id)
family_members.colnames = ('Name','Membership ID')
It cause the following error...
Traceback (most recent call last):
File "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/
restricted.py", line 184, in restricted
File "/home/abeer/Desktop/resources/web2py/New_version/web2py_src/
web2py/applications/init/views/default/updateMember.html", line 142,
in <module>
File "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/
globals.py", line 112, in write
File "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/
html.py", line 103, in xmlescape
File "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/
sql.py", line 3326, in xml
File "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/
sqlhtml.py", line 980, in __init__
File "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/
sql.py", line 621, in __getattr__
KeyError: '_extra'
P.S. : when i commented the line (family_members.colnames = ('Name','Membership ID')), it works fine, but I don't understand why.
Do not use colnames. That attribute is internal to web2py. Use db.table.field.label='..' or SQLTABLE(rows, headers={...}) depending on what you need.