我这里有一个 wsdl 文件:"obscured" 我想知道如何从该文件中获取 SOAP header ?这对我来说看起来很神秘,所以如果有人能给我指出一个教程,那就太好了。我只想要这是我需要传递到 NSURLConnection 的 soap 字符串,我可以使用 NSXMLParser 进行解析。
例如这里的教程:http://www.icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/展示了如何做到这一点,但没有展示如何从 wsdl 文件中获取 SOAP 消息。
谢谢!
最佳答案
从 http://www.soapui.org/ 下载 SOAPUI 应用程序(适用于 MAC 和 PC) .我将该 WSDL 提供给 SOAP UI,我看到了 GetAdvertisers、GetPlans、GetPlansByAdvertiser、GetReportPostBuy、HelloWorld、Login。您希望获得哪一个 SOAP 请求。 SOAP UI 为您构造示例请求。一探究竟。如果您遇到困难,现在我将所有这些请求发布在这里:
获取广告商:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mss="http://MSS">
<soapenv:Header/>
<soapenv:Body>
<mss:GetAdvertisers>
<mss:userID>?</mss:userID>
</mss:GetAdvertisers>
</soapenv:Body>
</soapenv:Envelope>
获取计划:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mss="http://MSS">
<soapenv:Header/>
<soapenv:Body>
<mss:GetPlans>
<mss:userID>?</mss:userID>
</mss:GetPlans>
</soapenv:Body>
</soapenv:Envelope>
GetPlansByAdvertiser:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mss="http://MSS">
<soapenv:Header/>
<soapenv:Body>
<mss:GetPlansByAdvertiser>
<mss:UserID>?</mss:UserID>
<!--Optional:-->
<mss:Advertiser>?</mss:Advertiser>
</mss:GetPlansByAdvertiser>
</soapenv:Body>
</soapenv:Envelope>
GetReportPostBuy:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mss="http://MSS">
<soapenv:Header/>
<soapenv:Body>
<mss:GetReportPostBuy>
<mss:UserID>?</mss:UserID>
<mss:PlanID>?</mss:PlanID>
<mss:CompanyID>?</mss:CompanyID>
<!--Optional:-->
<mss:CompanyName>?</mss:CompanyName>
<mss:AdvertiserID>?</mss:AdvertiserID>
<!--Optional:-->
<mss:AdvertiserName>?</mss:AdvertiserName>
<mss:PubdateFrom>?</mss:PubdateFrom>
<mss:PubdateTo>?</mss:PubdateTo>
</mss:GetReportPostBuy>
</soapenv:Body>
</soapenv:Envelope>
登录:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mss="http://MSS">
<soapenv:Header/>
<soapenv:Body>
<mss:Login>
<!--Optional:-->
<mss:username>?</mss:username>
<!--Optional:-->
<mss:password>?</mss:password>
</mss:Login>
</soapenv:Body>
</soapenv:Envelope>
关于objective-c - WSDL 文件和 SOAP header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7236723/