Alongfish 2019-03-27 16:31 采纳率: 0%
浏览 716

python3.7 suds用CA证书访问webservice(server端CFX框架)报错

1、错误:Python3.7 用suds库ca证书,访问webservice的客户端,报‘suds.client:http failed‘,Server raised fault: 'A required header representing a Message Addressing Property is not present'"
2、调用service的方法后就报错
client = Client(url,transport=mytransport) 正常
print(client)可以看到webservice列表
当调用client.service.QueryByOwnerAndDateRequest()时出错,调试信息如下:

D:\JetBrains\Project\jing\venv\Scripts\python.exe D:/JetBrains/Project/jing/testwebservice.py
DEBUG:suds.transport.http:opening (http://172.16.21.190:9160/ws/RealestateQuery?WSDL)
DEBUG:suds.client:sending to (http://172.16.21.190:9160/ws/RealestateQuery?WSDL)
message:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://shghtd.com/regquery/types" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <ns1:Body>
      <ns0:QueryByOwnerAndDateRequest>
         <ns0:cardType>110001</ns0:cardType>
         <ns0:cardNo>620102197106285338</ns0:cardNo>
         <ns0:ownerName></ns0:ownerName>
         <ns0:date>2019-03-25</ns0:date>
      </ns0:QueryByOwnerAndDateRequest>
   </ns1:Body>
</SOAP-ENV:Envelope>
DEBUG:suds.client:headers = {'Content-Type': 'text/xml; charset=utf-8', 'SOAPAction': '"http://shghtd.com/ws/RealestateQuery/queryHouseByOwnerAndDate"'}
DEBUG:suds.transport.http:sending:
URL:http://172.16.21.190:9160/ws/RealestateQuery?WSDL
HEADERS: {'Content-Type': 'text/xml; charset=utf-8', 'SOAPAction': '"http://shghtd.com/ws/RealestateQuery/queryHouseByOwnerAndDate"', 'Content-type': 'text/xml; charset=utf-8', 'Soapaction': '"http://shghtd.com/ws/RealestateQuery/queryHouseByOwnerAndDate"'}
MESSAGE:
b'<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://shghtd.com/regquery/types" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><ns1:Body><ns0:QueryByOwnerAndDateRequest><ns0:cardType>110001</ns0:cardType><ns0:cardNo>620102197106285338</ns0:cardNo><ns0:ownerName></ns0:ownerName><ns0:date>2019-03-25</ns0:date></ns0:QueryByOwnerAndDateRequest></ns1:Body></SOAP-ENV:Envelope>'
ERROR:suds.client:<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://shghtd.com/regquery/types" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <ns1:Body>
      <ns0:QueryByOwnerAndDateRequest>
         <ns0:cardType>110001</ns0:cardType>
         <ns0:cardNo>620102197106285338</ns0:cardNo>
         <ns0:ownerName></ns0:ownerName>
         <ns0:date>2019-03-25</ns0:date>
      </ns0:QueryByOwnerAndDateRequest>
   </ns1:Body>
</SOAP-ENV:Envelope>
DEBUG:suds.client:http failed:
b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode xmlns:ns1="http://www.w3.org/2005/08/addressing">ns1:MessageAddressingHeaderRequired</faultcode><faultstring>A required header representing a Message Addressing Property is not present</faultstring></soap:Fault></soap:Body></soap:Envelope>'
Traceback (most recent call last):
  File "D:\JetBrains\Project\jing\venv\lib\site-packages\suds\transport\http.py", line 78, in send
    fp = self.u2open(u2request)
  File "D:/JetBrains/Project/jing/testwebservice.py", line 69, in u2open
    return url.open(u2request, timeout=tm)
  File "D:\Python\Python37\lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "D:\Python\Python37\lib\urllib\request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "D:\Python\Python37\lib\urllib\request.py", line 569, in error
    return self._call_chain(*args)
  File "D:\Python\Python37\lib\urllib\request.py", line 503, in _call_chain
    result = func(*args)
  File "D:\Python\Python37\lib\urllib\request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\JetBrains\Project\jing\venv\lib\site-packages\suds\client.py", line 652, in send
    reply = transport.send(request)
  File "D:\JetBrains\Project\jing\venv\lib\site-packages\suds\transport\http.py", line 86, in send
    raise TransportError(e.msg, e.code, e.fp)
suds.transport.TransportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:/JetBrains/Project/jing/testwebservice.py", line 119, in <module>
    result = mzjweb(cardtype=ctype, cardno=cno, rightdate='2019-03-25')
  File "D:/JetBrains/Project/jing/testwebservice.py", line 111, in mzjweb
    ws = websev.queryHouseByOwnerAndDate(cardType=cardtype, cardNo=cardno, ownerName='', date=rightdate)
  File "D:\JetBrains\Project\jing\venv\lib\site-packages\suds\client.py", line 559, in __call__
    return client.invoke(args, kwargs)
  File "D:\JetBrains\Project\jing\venv\lib\site-packages\suds\client.py", line 618, in invoke
    result = self.send(soapenv)
  File "D:\JetBrains\Project\jing\venv\lib\site-packages\suds\client.py", line 664, in send
    result = self.failed(binding, e)
  File "D:\JetBrains\Project\jing\venv\lib\site-packages\suds\client.py", line 720, in failed
    r, p = binding.get_fault(reply)
  File "D:\JetBrains\Project\jing\venv\lib\site-packages\suds\bindings\binding.py", line 267, in get_fault
    raise WebFault(p, faultroot)
suds.WebFault: b"Server raised fault: 'A required header representing a Message Addressing Property is not present'"

Process finished with exit code 1

  • 写回答

1条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2022-09-09 17:34
    关注
    不知道你这个问题是否已经解决, 如果还没有解决的话:

    如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 以帮助更多的人 ^-^
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?