Example of using soap in PHPPHP uses soap in two ways.
1. Use the wsdl File
Server.
{Public function HelloWorld (){Return "Hello ";}Public function Add ($ a, $ B){Return $ a + $ B;}}$ Server = new SoapServer ('soap. wsdl ', array ('soap _ version' => SOAP_1_2 ));$ Server-> s
. article. article BLL = New Mike. web. article. article (); BLL. mysoapheadervalue = soap; string result = BLL. mytest (); response. write (result );}}}The above code is to call WebService. before calling the code, you must first set the user name and password in the SOAP message header, which must be consistent with those on each server to verify whether the call permission exists before calling the code.
Next, let's take a look at a request example of the sf bsp order number query interface SOAP. This example can help you to use SOAP requests in some interface design, for example, the sf bsp interface. I try different methods of POST requests, either... next, let's take a lo
Example of using soap in php
$ Soap = new SoapServer ($ wsdl, $ array );
2. SoapClient
$ Soap = new SoapClient ($ wsdl, $ array );
3. SoapFault
$ Fault = new SoapFault ($ faultcode, $ faultstring );
Two reference methods: Method 1: Introduce the w
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
Shun Fung BSP Order number query Interface SOAP Request example
In some interfaces the design of a soap-like request is sometimes used, such as the interface of Shun Fung BSP.
I tried different ways of post-request, either completely requested something, or received garbled, all failed.
The core code for SOAP requests
** Run the test class to successfully invoke the server's interface and get the returned data. **/public Staticvoidmain (String[]args) throwsserviceexception,remoteexception{ /*** The result of the operation is:Hs:jax-ws RI 2.2.4-b01:stub for Http://172.18.100.52:456/hello server, goodbye:sjk============= server, hello:sjk=========== =====As can be seen here, the server's interface was successfully accessed, and the data was returned. Description The call WebService succeeded.WebService basic k
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.