看板 PHP 關於我們 聯絡資訊
原po使用一簡易webservice,只需要丟入一xml資料,假設網址為 https://xxx.xxx.xxx/WebService.asmx?op=setData 使用postman直接將整串 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> 中間略... </soap:Body> </soap:Envelope> 參數以raw的方式傳出去,可以正常執行. 但若使用SoapClient $url = "https://xxx.xxx.xxx/WebService.asmx?WSDL"; $xml = "<soap::Envelope.....中間略...."; $client = new SoapClient($url); $result = $client->SetData($xml); 或是使用SimpleXMLElement $xmlr = new SimpleXMLElement($xml); $parameter = new stdClass(); $parameter->xml = $xmlr->asXML(); $result = $client->SetData($xmlr); 都會回傳以下error message Message: System.Web.Services.Protocols.SoapException: 伺服器無法處理要求。 ---> System.NullReferenceException: 並未將物件參考設定為物件的執行個體 若要將整個xml字串當作raw data送出要怎麼寫呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.163.24.230 ※ 文章網址: https://www.ptt.cc/bbs/PHP/M.1502442128.A.07D.html
mirae: google php curl post raw data 08/14 09:55