下面来看一个关于顺丰BSP订单号查询接口SOAP的请求示例,这个例子能帮助到各位同学,在一些接口的设计中有时用到了SOAP方式的请求,比如顺丰BSP的接口.
我尝试不同方式的POST方式请求,要么完全请求不到东西,要么接收到乱码,均以失败告终,针对顺丰接口的SOAP请求的核心代码分享如下:
/** * 发送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 = '<Request service="RouteService"> <Head>' . $this->user . ',' . $this->passWord . '</Head> <Body> <RouteRequest tracking_type="1″ method_type="1″ tracking_number="' . $this->invoice_no . '" /> </Body> </Request>'; $this->xml = $xml; }
提示:
1.$this->serviceUrl 顺丰分配的BSP请求地址,注意是?wsdl的地址.
2.$this->user,$this->passWord 即是顺丰分配的ID和校验码.
3.返回的return是一个XML的String,你可能需要simplexml_load_string来解析.
教程网址:
欢迎收藏∩_∩但请保留本文链接。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver CS6
Visual web development tools
