项目中使用Python 2.2.3,装好了fsconst + SOAPpy后,创建了测试代码
Python SOAPpy 和 .net WebServicedef OpenProxy(url):
Python SOAPpy 和 .net WebService    from SOAPpy import WSDL
Python SOAPpy 和 .net WebService    proxy 
= WSDL.Proxy(url)
Python SOAPpy 和 .net WebService    proxy.soapproxy.config.dumpHeadersIn 
= 1
Python SOAPpy 和 .net WebService    proxy.soapproxy.config.dumpHeadersOut 
= 1
Python SOAPpy 和 .net WebService    proxy.soapproxy.config.dumpSOAPIn 
= 1
Python SOAPpy 和 .net WebService    proxy.soapproxy.config.dumpSOAPOut 
= 1
Python SOAPpy 和 .net WebService    proxy.soapproxy.config.debug 
= 9
Python SOAPpy 和 .net WebService    
return proxy
Python SOAPpy 和 .net WebService    
Python SOAPpy 和 .net WebServiceproxy 
= OpenProxy("http://localhost:1137/Web/Test/Service.asmx?WSDL")
Python SOAPpy 和 .net WebServiceproxy.Test(
345)
    
    写ASP.net服务器,vs中创建一个简单的Test方法:
   
Python SOAPpy 和 .net WebService[WebService(Namespace = "http://tempuri.org/")]
Python SOAPpy 和 .net WebService[WebServiceBinding(ConformsTo 
= WsiProfiles.BasicProfile1_1)]
Python SOAPpy 和 .net WebService[SoapDocumentService(Use
=System.Web.Services.Description.SoapBindingUse.Encoded)]
Python SOAPpy 和 .net WebService
public class Service : System.Web.Services.WebService

     Python SOAPpy 和 .net WebService[SoapDocumentService(Use=System.Web.Services.Description.SoapBindingUse.Encoded)]是出现问题的地方:
   在未添加之前,Test 返回的结果总是 1 ,a 的值未设置。python 的传递的参数未正确解析。看了python调试信息,把 proxy.Test(123)改成了proxy.Test(a=123),重新调用,xml请求的字段对了,但是 .net服务返回还是0。
   在http://mail.python.org/pipermail/xml-sig/2004-November/010733.html看到一些信息,按照上面的说明,加了[SoapDocumentService(Use=System.Web.Services.Description.SoapBindingUse.Encoded)],结果正确了,却不懂为什么。
   第一天是用SOAP,问题还真多!

相关文章:

  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2022-02-14
  • 2022-03-09
  • 2022-12-23
  • 2021-09-21
猜你喜欢
  • 2022-12-23
  • 2021-07-19
  • 2022-12-23
  • 2022-12-23
  • 2021-09-05
  • 2021-07-03
  • 2021-11-03
相关资源
相似解决方案