SOAP request example of SF BSP order number query interface
SOAP requests are sometimes used in the design of some interfaces, such as the interface of SF BSP.
I tried different POST requests, but either couldn’t request anything at all, or received garbled codes, all of which ended in failure.
The core code of the SOAP request for the SF Express interface is shared as follows:
The code is as follows |
|
代码如下 |
|
/**
* 发送soap请求
*/
private function _soap()
{
$client = new SoapClient($this->serviceUrl);
$info = new stdClass();
$info->arg0 = $this->xml;
$param = array($info);
$response = $client->__call(“sfexpressService”,$param);
return $response->return ;
}
/**
* 拼接出请求的xml
*/
public function createXml()
{
$xml = ‘
’.$this->user.’,’.$this->passWord.’
invoice_no.’” />
’;
$this->xml = $xml;
}
|
/**
* Send soap request */
private function _soap()
{
$client = new SoapClient($this->serviceUrl);
$info = new stdClass();
$info->arg0 = $this->xml;
$param = array($info);
$response = $client->__call(“sfexpressService”,$param);
return $response->return ;
}
/**
* Splice out the requested xml*/
public function createXml()
{
$xml = ‘
’.$this->user.’,’.$this->passWord.’
invoice_no.’” />
’;
$this->xml = $xml;
|
Tips:
1.$this->serviceUrl is the BSP request address assigned by SF Express. Note that it is the address of ?wsdl
2.$this->user, $this->passWord are the ID and verification code assigned by SF Express
3. The returned return is an XML String, and you may need simplexml_load_string to parse it.
http://www.bkjia.com/PHPjc/898890.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/898890.htmlTechArticleSF BSP order number query interface SOAP request example. SOAP requests are sometimes used in the design of some interfaces. For example, the interface of SF Express BSP. I tried different POST requests...