Example of a SOAP request for the sf bsp order number query interface

Source: Internet
Author: User

Example of a SOAP request for the sf bsp order number query interface

Some interfaces sometimes use SOAP requests, such as the interfaces of sf bsp.

I tried different methods of POST requests, either completely failing to request anything or receiving garbled characters, all ended in failure.

The core code of the SOAP request for the SF interface is as follows:

The Code is as follows:  

/**
* Send a 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;
}

/**
* Concatenate the requested xml
*/
Public function createXml ()
{
$ Xml = '<Request service = "RouteService" lang = "zh-CN">
<Head> '. $ this-> user.', '. $ this-> passWord.' </Head>
<Body>
<RouteRequest tracking_type = "1" method_type = "1" tracking_number = "'. $ this-> invoice_no.'"/>
</Body>
</Request> ';
$ This-> xml = $ xml;
}

Tip:
1. $ this-> serviceUrl: the BSP request address allocated by SF. What are your notes? Wsdl address
2. $ this-> user, $ this-> passWord is the ID and verification code assigned by SF.
3. The returned return value is an XML String. You may need simplexml_load_string for parsing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.