惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
WordPress大学
WordPress大学
博客园 - 【当耐特】
Engineering at Meta
Engineering at Meta
IT之家
IT之家
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
美团技术团队
S
SegmentFault 最新的问题
The GitHub Blog
The GitHub Blog
Martin Fowler
Martin Fowler
Recorded Future
Recorded Future
H
Help Net Security
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
博客园_首页
A
About on SuperTechFans
MongoDB | Blog
MongoDB | Blog
阮一峰的网络日志
阮一峰的网络日志
V
Visual Studio Blog
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
B
Blog
The Register - Security
The Register - Security
I
InfoQ
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
Last Week in AI
Last Week in AI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
有赞技术团队
有赞技术团队
Stack Overflow Blog
Stack Overflow Blog
Jina AI
Jina AI
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News - Newest:
Hacker News - Newest: "LLM"
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
W
WeLiveSecurity
Latest news
Latest news
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
博客园 - 叶小钗
L
Lohrmann on Cybersecurity
博客园 - Franky
Recent Commits to openclaw:main
Recent Commits to openclaw:main
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

博客园 - thh

svm资料收集 向量空间及其他相关数学结构 难题--autoconf、automake、libtool Linq 中不爽之处 关于UI设计的文章汇总 Window Live Writer LR 剖析器 MVP模式中的P和V关系 Guid、Int、BigInt编号的速度和存储空间的比较 静态构造函数线程安全的几个版本[转载] 区域性 ID 2155 (0x086B)不是受支持的区域性 解决方法 windbg给clr设置断点 python ip和int 互转函数 interface与pojo类之间的关系 关于OpenId Python SOAPpy访问asp.net web service 代码 Type.GetType 获得本Assembly以外的类型 NHibernate 代码生成工具 NHibernate使用笔记
Python SOAPpy 和 .net WebService
thh · 2007-03-23 · via 博客园 - thh

   项目中使用Python 2.2.3,装好了fsconst + SOAPpy后,创建了测试代码

def OpenProxy(url):
    from SOAPpy import WSDL
    proxy 
= WSDL.Proxy(url)
    proxy.soapproxy.config.dumpHeadersIn 
= 1
    proxy.soapproxy.config.dumpHeadersOut 
= 1
    proxy.soapproxy.config.dumpSOAPIn 
= 1
    proxy.soapproxy.config.dumpSOAPOut 
= 1
    proxy.soapproxy.config.debug 
= 9
    
return proxy
    
proxy 
= OpenProxy("http://localhost:1137/Web/Test/Service.asmx?WSDL")
proxy.Test(
345)

    

    写ASP.net服务器,vs中创建一个简单的Test方法:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo 
= WsiProfiles.BasicProfile1_1)]
[SoapDocumentService(Use
=System.Web.Services.Description.SoapBindingUse.Encoded)]
public class Service : System.Web.Services.WebService
{

    
public Service()
    
{
    }


    [WebMethod]
    
public string HelloWorld()
    
{
        
return "Hello World";
    }


    [WebMethod(CacheDuration
=0)]
    
public int Test(int a)
    
{
        
return a + 1;
    }


}


    

[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,问题还真多!