Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $wsdl = "https://<your_web_service_url>?wsdl";
- $client = new SoapClient($wsdl, array('trace'=>1)); // The trace param will show you errors stack
- // web service input params
- $request_param = array(
- "param1" => $value1,
- "param2" => $value2,
- "param3" => $value3,
- "param4" => $value4
- );
- try
- {
- $responce_param = $client->webservice_methode_name($request_param);
- //$responce_param = $client->call("webservice_methode_name", $request_param); // Alternative way to call soap method
- }
- catch (Exception $e)
- {
- echo "<h2>Exception Error!</h2>";
- echo $e->getMessage();
- }
- <?php
- require_once('lib/nusoap.php');
- $wsdl = "http://<your_web_service_url>?wsdl";
- $client = new nusoap_client($wsdl, 'wsdl');
- // Input params
- $username = "username";
- $password = "pass";
- // In this demo, we use json data , you can use any other data format for same
- $json = '{"param1":"value1","param2":"value2"}';
- $client->setCredentials($username, $password);
- $error = $client->getError();
- if ($error)
- {
- echo $error; die();
- }
- $action = "webservice_methode_name"; // webservice method name
- $result = array();
- if (isset($action))
- {
- $result['response'] = $client->call($action, $json);
- }
- echo "<h3>Output : </h3>";
- echo $result['response'];
- echo "<h2>Request</h2>";
- echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>";
- echo "<h2>Response</h2>";
- echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement