0

I have wsdl file and 3rd party api. We want to fetch data from 3rd party and show on my website we have username and password but we are new in soap api. how to connect with authentication in soap api and fetch data from wsdl file.

We are trying to fetch but this error is showing :

Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in /home/examin8/public_html/CI/soap/client.php:42 
Stack trace: 
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'https://119.73....', 'urn://119.73.25...', 1, 0) 
#1 /home/examin8/public_html/CI/soap/client.php(42): SoapClient->__soapCall('RealTimePriceDa...', Array) 
#2 /home/examin8/public_html/CI/soap/sevice.php(11): client->getDetails(Array) #3 {main} thrown in /home/examin8/public_html/CI/soap/client.php on line 42

PHP code :

<?php
class client{
    public function __construct() {
        $param = array("location" => "https://119.73.253.101:9514/emcdsvc/",
            "uri" => "urn://119.73.253.101:9514/emcdsvc/",
            "trace" => 1);
        $this->instance = new SoapClient(NULL,$param);

        $auth_param = new stdClass();
        $auth_param->username = "env_solution";
        $auth_param->password = "Password1";

        $header_param = new SoapVar($auth_param, SOAP_ENC_OBJECT);

        $header = new SoapHeader("soap", "authenticate", $header_param, FALSE);

        $this->instance->__setSoapHeaders(array($header));

        try {
            $date_array = array("date" => date("dd-mm-yyyy"));
            $result = $this->instance->__soapCall("RealTimePriceDataWebService", $date_array);;
            print_r($result);

        } catch (Exception $e) {
            echo $e->getMessage();
        }
    }
}
$client = new client;
Bertrand Martel
  • 42,756
  • 16
  • 135
  • 159
  • paste your code here – Minesh Patel Apr 21 '17 at 11:17
  • check [this](http://stackoverflow.com/questions/30410658/php-soapclient-soapfault-exception-could-not-connect-to-host) – Minesh Patel Apr 21 '17 at 11:20
  • It's not working connection is not established, page is continue loading and after that it show above error. this error is show if I try with try catch method "Could not connect to host" – user7901097 Apr 21 '17 at 14:03
  • check your outgoing connection is on ? ping that address from CMD – Minesh Patel Apr 24 '17 at 05:01
  • Not Working shoaib@shoaib-desktop:~$ ping https://119.73.253.101:9514/emcdsvc/ ping: unknown host https://119.73.253.101:9514/emcdsvc/ shoaib@shoaib-desktop:~$ ping https://119.73.253.101:9514 ping: unknown host https://119.73.253.101:9514 shoaib@shoaib-desktop:~$ ping https://119.73.253.101 ping: unknown host https://119.73.253.101 shoaib@shoaib-desktop:~$ ping https://119.73.253.101 ping: unknown host https://119.73.253.101 shoaib@shoaib-desktop:~$ ping https://119.73.253.101:9514/emcdsvc/ ping: unknown host https://119.73.253.101:9514/emcdsvc/ – user7901097 Apr 24 '17 at 06:55
  • check [this site](http://portquiz.net:1234/). check your Outgoing port is working or not ? – Minesh Patel Apr 24 '17 at 07:12
  • outgoing port is working – user7901097 Apr 26 '17 at 14:35

0 Answers0