I wrote a WCF Soap Service in C#, that accepting XML and parse it to get the value of the fields. I need to call this service in PHP. But the code that I tried in PHP doesn't pass the XML and when I debug in my service dto.xml is empty.
This is how to call it:
$wsdl = "http://localhost:525845/cust.svc?wsdl";
$soap_client = new SoapClient($wsdl);
$Process = "LOAD";
$client->soap_defencoding = 'UTF-8';
$xml = new SimpleXMLElement("<Credit></Credit>");
$xml->addChild('LoanApp', $LoanApp);
$xml->addChild('Routing', $Routing);
$xml->addChild('Processing', $Processing);
$xml->addChild('Process', $Process);
$param = array(
'dto' => $xml
);
$result1 = $soap_client->Process_Load($param);
print_r($result1);
this is my method is the service that I am calling:
public string Process_Load(Model.TransferData dto)
{
XmlDocument parsed_xml = new XmlDocument();
string _byteOrderMarkUtf8 = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble());
if (dto.xml.StartsWith(_byteOrderMarkUtf8))
{
dto.xml = dto.xml.Remove(0, _byteOrderMarkUtf8.Length);
}
parsed_xml.LoadXml(dto.xml);
XmlNodeList xnList = parsed_xml.SelectNodes("/IEZ/Credit/LoanApp/Routing/Processing/Process");
if (xnList != null)
Process = xnList.Item(0).InnerText;
and this is sample of XML I am passing to the service from PHP:
<IEZ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Credit>
<LoanApp>
<Routing Transaction="LoanApp">
<Processing>
<Process Type="Trans-type">LOAD</Process>
</Processing>
</Routing>
</LoanApp>
I struggled with PHP's SoapClient for a long time. Eventually I ended up using Curl: