我希望使用Microsoft CRM Web服務,我想這樣的代碼:連接到Dynamics CRM中使用Python肥皂水
wsdl_url = 'http://crm-test:5555/CRMDeveleopment/XRMServices/2011/Organization.svc?wsdl'
username = 'user'
password = 'pass'
from suds.transport.https import WindowsHttpAuthenticated
from suds.client import Client
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
logging.getLogger('suds.transport').setLevel(logging.DEBUG)
ntlmTransport = WindowsHttpAuthenticated(username=username, password=password)
metadata_client = Client(wsdl_url, transport=ntlmTransport, cache=None)
,我得到這個錯誤:
Traceback (most recent call last):
File "crm.py", line 15, in <module>
metadata_client = Client(wsdl_url, transport=ntlmTransport)
File "/usr/lib/python2.7/site-packages/suds/client.py", line 112, in __init__
self.wsdl = reader.open(url)
File "/usr/lib/python2.7/site-packages/suds/reader.py", line 152, in open
d = self.fn(url, self.options)
File "/usr/lib/python2.7/site-packages/suds/wsdl.py", line 157, in __init__
self.open_imports()
File "/usr/lib/python2.7/site-packages/suds/wsdl.py", line 202, in open_imports
imp.load(self)
File "/usr/lib/python2.7/site-packages/suds/wsdl.py", line 314, in load
d = Definitions(url, options)
File "/usr/lib/python2.7/site-packages/suds/wsdl.py", line 159, in __init__
self.build_schema()
File "/usr/lib/python2.7/site-packages/suds/wsdl.py", line 220, in build_schema
self.schema = container.load(self.options)
File "/usr/lib/python2.7/site-packages/suds/xsd/schema.py", line 95, in load
child.dereference()
File "/usr/lib/python2.7/site-packages/suds/xsd/schema.py", line 323, in dereference
midx, deps = x.dependencies()
File "/usr/lib/python2.7/site-packages/suds/xsd/sxbasic.py", line 469, in dependencies
raise TypeNotFound(self.ref)
suds.TypeNotFound: Type not found: '(ManagedPropertyAttributeRequiredLevel, http://schemas.microsoft.com/xrm/2011/Contracts,)'
輸出組織
from suds import WebFault
from suds.client import *
from suds.transport.https import WindowsHttpAuthenticated
user = r'domain.net\username'
password = "password"
url = "http://crm-test:5555/XRMServices/2011/Organization.svc?wsdl"
ntlm = WindowsHttpAuthenticated(username = user, password = password)
client = Client(url, transport=ntlm)
print client
錯誤:
$ python organization.py
DEBUG:suds.transport.http:opening (http://crm-test.kavatelecom.net:5555/XRMServices/2011/Organization.svc?wsdl)
DEBUG:suds.transport.http:opening (http://crm-test.kavatelecom.net:5555/XRMServices/2011/Organization.svc?wsdl=wsdl0)
Traceback (most recent call last):
File "organization.py", line 15, in <module>
client = Client(url, transport=ntlm)
File "/usr/lib/python2.7/site-packages/suds/client.py", line 112, in __init__
self.wsdl = reader.open(url)
File "/usr/lib/python2.7/site-packages/suds/reader.py", line 152, in open
d = self.fn(url, self.options)
File "/usr/lib/python2.7/site-packages/suds/wsdl.py", line 157, in __init__
self.open_imports()
File "/usr/lib/python2.7/site-packages/suds/wsdl.py", line 202, in open_imports
imp.load(self)
File "/usr/lib/python2.7/site-packages/suds/wsdl.py", line 314, in load
d = Definitions(url, options)
File "/usr/lib/python2.7/site-packages/suds/wsdl.py", line 159, in __init__
self.build_schema()
File "/usr/lib/python2.7/site-packages/suds/wsdl.py", line 220, in build_schema
self.schema = container.load(self.options)
File "/usr/lib/python2.7/site-packages/suds/xsd/schema.py", line 95, in load
child.dereference()
File "/usr/lib/python2.7/site-packages/suds/xsd/schema.py", line 323, in dereference
midx, deps = x.dependencies()
File "/usr/lib/python2.7/site-packages/suds/xsd/sxbasic.py", line 469, in dependencies
raise TypeNotFound(self.ref)
suds.TypeNotFound: Type not found: '(ManagedPropertyAttributeRequiredLevel, http://schemas.microsoft.com/xrm/2011/Contracts,)'
你認爲你可以跟進這篇文章嗎?切換到SOAP 1.1是否解決了您的問題? –
你的意思是我必須使用舊版本的泡沫? – nim4n
您可以發佈從http輸出:// CRM測試:5555/CRMDeveleopment/XRMServices/2011/Organization.svc WSDL –