一段时间以来,我们一直在与SOAP相关的问题进行斗争.我们有一个基于SOAP的API,可以从许多语言(PHP,Ruby等)中调用.然而,在某些情况下,C#似乎会窒息.
不幸的是,我们不清楚为什么它会死亡.我们不是C#人员,但我们确实找到了一个外部的C#人来查看问题.而且,他们也感到困惑!
可以在这里看到wdsl:http://sandbox.knowledgetree.com/ktwebservice/webservice.php?wsdl (是的,它的大).
从C#开始,会话创建和其他几个调用工作愉快.但是,get_folder_contents调用失败.调用执行,fiddler显示返回的有效XML.但是,C#的返回值为null.
每个Fiddler的请求如下:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<s:get_folder_contents>
<session_id xsi:type="xsd:string">or8llmjj5rm7co9h5p2k762s77</session_id>
<folder_id xsi:type="xsd:int">99</folder_id>
<depth xsi:type="xsd:int">1</depth>
<what xsi:type="xsd:string">DFS</what>
</s:get_folder_contents>
</s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)
(我为小提琴日志添加了空格和换行符).
每个Fiddler的回复(但同样,格式化为clairty)如下:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns4="urn:KnowledgeTree" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<SOAP-ENV:get_folder_contentsResponse>
<item xsi:type="ns4:kt_folder_contents">
<status_code xsi:type="xsd:int">0</status_code>
<message xsi:type="xsd:string"></message>
<folder_id xsi:type="xsd:int">99</folder_id>
<folder_name xsi:type="xsd:string">Nic</folder_name>
<full_path xsi:type="xsd:string">Nic</full_path>
<items xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="ns4:kt_folder_item[0]" xsi:nil="true"/>
</item>
</SOAP-ENV:get_folder_contentsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Run Code Online (Sandbox Code Playgroud)
我们用来测试的(粗)C#应用程序如下:
public partial class Form1 : Form
{
private string _sessionId;
private KnowledgeTreePortClient _webService;
public Form1()
{
InitializeComponent();
_webService = …Run Code Online (Sandbox Code Playgroud)