如何解决 SUDS 中没有可供请求的操作?

发布于 2024-11-18 09:34:20 字数 2486 浏览 1 评论 0原文

首先,我导入了 SUDS 客户端并进行日志记录,

from suds.client import Client as SudsClient
import logger

logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)

并向我提供了两个 wsdl 文件,即 enterprise.wsdl 和 ProgrammerClientHandler.wsdl.xml。 我使用 enterprise.wsdl 登录:

# Authentication and get more information for set up
enterprise_client = SudsClient(enterprise_url)
response = enterprise_client.service.login(username, "%s%s" % (password,token))

然后我将获取 sessionId 和 serverUrl 以传输到另一个 SUDS 客户端对象,

session_id = response.sessionId
server_url = response.serverUrl

soap_header = enterprise_client.factory.create('SessionHeader')
soap_header.sessionId = session_id

给出的 server_url 将 SUDS 客户端定向到用户,

programmerclienthandler_client = SudsClient(handler_url)
programmerclienthandler_client.set_options(soapheaders=[soap_header])
programmerclienthandler_client.set_options(location=server_url)
programmerclienthandler_client.set_options(port = 'ProgrammerClientHandler')

然后我通过打印programmerclienthandler_client 时

Service ( ProgrammerClientHandlerService ) tns="http://soap.sforce.com/schemas/class/axlea/ProgrammerClientHandler"
Prefixes (1)
  ns0 = "http://soap.sforce.com/schemas/class/axlea/ProgrammerClientHandler"
Ports (1):
  (ProgrammerClientHandler)
     Methods (1):
        getProgrammerClientXML()
     Types (5):
        ID
        LogCategory
        LogCategoryLevel
        LogInfo
        LogType

它显示了我现在需要的通过以下方式调用 getProgrammerClientXML() 函数:

 programmerclienthandler_xml = programmerclienthandler_client.service.getProgrammerClientXML()

现在,当我调用此函数时,我收到错误:

DEBUG:suds.client:http failed:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>No operation available for request {http://soap.sforce.com/schemas/class/axlea/ProgrammerClientHandler}getProgrammerClientXML</faultstring></soapenv:Fault></soapenv:Body></soapenv:Envelope>
Error: ERROR: Server raised fault: 'No operation available for request {http://soap.sforce.com/schemas/class/axlea/ProgrammerClientHandler}getProgrammerClientXML'

我应该做什么才能使其工作? wsdl 文件有问题吗?

first I imported SUDS client and logging

from suds.client import Client as SudsClient
import logger

logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)

I was provided with two wsdl files, an enterprise.wsdl and ProgrammerClientHandler.wsdl.xml.
i used enterprise.wsdl to login by:

# Authentication and get more information for set up
enterprise_client = SudsClient(enterprise_url)
response = enterprise_client.service.login(username, "%s%s" % (password,token))

then i'll get the sessionId and serverUrl to transfer to another SUDS client object

session_id = response.sessionId
server_url = response.serverUrl

soap_header = enterprise_client.factory.create('SessionHeader')
soap_header.sessionId = session_id

then i direct the SUDS client to the user by the server_url that was given

programmerclienthandler_client = SudsClient(handler_url)
programmerclienthandler_client.set_options(soapheaders=[soap_header])
programmerclienthandler_client.set_options(location=server_url)
programmerclienthandler_client.set_options(port = 'ProgrammerClientHandler')

if I print programmerclienthandler_client it shows this

Service ( ProgrammerClientHandlerService ) tns="http://soap.sforce.com/schemas/class/axlea/ProgrammerClientHandler"
Prefixes (1)
  ns0 = "http://soap.sforce.com/schemas/class/axlea/ProgrammerClientHandler"
Ports (1):
  (ProgrammerClientHandler)
     Methods (1):
        getProgrammerClientXML()
     Types (5):
        ID
        LogCategory
        LogCategoryLevel
        LogInfo
        LogType

now i need to call the getProgrammerClientXML() function by:

 programmerclienthandler_xml = programmerclienthandler_client.service.getProgrammerClientXML()

now when I call this I get the error:

DEBUG:suds.client:http failed:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>No operation available for request {http://soap.sforce.com/schemas/class/axlea/ProgrammerClientHandler}getProgrammerClientXML</faultstring></soapenv:Fault></soapenv:Body></soapenv:Envelope>
Error: ERROR: Server raised fault: 'No operation available for request {http://soap.sforce.com/schemas/class/axlea/ProgrammerClientHandler}getProgrammerClientXML'

What should I do to make it work? Is there a problem in the wsdl files?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七七 2024-11-25 09:34:20

登录返回的 serverUrl 用于企业 API,但您没有使用它,您不应该更改 programmerclienthandler_client 存根的端点 URL,它已经正确了。

The serverUrl returned by login is for the enterprise API, but you're not using that, you shouldn't change the endpoint URL of your programmerclienthandler_client stub, its already correct.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文