我有一个观察者事件,它会在客户详细信息更新时随时捕获它们。此时,它将该信息发布到var日志。
我想让它发布到一个SOAP API的网址。
在这一点上,我试图被指出如何做的正确方向,我相信我需要将信息写入到与API匹配的XML中。我只有6个字段需要填写,所以我不认为它会很难。
$fon = $billingaddress->getTelephone();
$street1 = $billingaddress->getStreet(1);
$street2 = $billingaddress->getStreet(2);
$city = $billingaddress->getCity();
$region = $billingaddress->getRegion();
$postcode = $billingaddress->getPostcode();
电话号码与客户号码相同
有人能帮我写XML的代码吗?
发布于 2018-02-09 21:11:23
此块将放入body标记中,如示例HERE中所示。
<?php
$request = '<UpdateCustomer xmlns="http://www.dpro.com/DPAPIServices">'.
'<aRequest>'.
// '<Username>'..'</Username>'.
// '<Password>'..'</Password>'.
'<CustomerNumber>'.$billingaddress->getTelephone();.'</CustomerNumber>'.
'<CustomerName>'.$billingAddress->getFirstname().' '.$billingAddress->getLastname().'</CustomerName>'.
'<CustomerAddress1>'.$billingaddress->getStreet(1).'</CustomerAddress1>'.
'<CustomerAddress2>'.$billingaddress->getStreet(2).'</CustomerAddress2>'.
'<CustomerCity>'.$billingaddress->getCity().'</CustomerCity>'.
'<CustomerState>'.$billingaddress->getRegion().'</CustomerState>'.
'<CustomerZip>'.$billingaddress->getPostcode().'</CustomerZip>'.
'</aRequest>'.
'</UpdateCustomer>';
?>
发布于 2018-02-13 09:56:34
在使用已经存在的SOAP API时,不应该需要编写任何XML。使用内置的SoapClient
。
如果你需要帮助,可以看看这个问题的答案:How to make a PHP SOAP call using the SoapClient class
https://stackoverflow.com/questions/48710456
复制相似问题