手動拼接 SOAP XML 時,命名空間、節點結構、編碼不符合標準,導致伺服端反序列化失敗,參數讀為 null。
<cnono>17</cnono> // 缺少命名空間、父節點結構不完整
POST /StockTest/Service1.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
SOAPAction: "https://tempuri.org/MethodName"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="https://www.w3.org/2001/XMLSchema"
xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<MethodName xmlns="https://tempuri.org/">
<paramName>value</paramName>
</MethodName>
</soap:Body>
</soap:Envelope>
AFNetworking + SOAPEngine、Alamofire + XML 解析)自動生成/解析 SOAP。targetNamespace、參數順序、類型映射。traceEnabled="true")對比正確/錯誤請求原始封包。