Viewed   610 times

Sometimes fail to call the web service.

This problem happens all the time.

What could be the problem?

Error:
    SoapFault exception: [HTTP] Could not connect to host in 
    0 [internal function]: SoapClient->__doRequest('<?xml version="...', http://.', '', 1, 0)

 Answers

5

The problem was solved.The problem is the cache

ini_set('soap.wsdl_cache_enabled',0);
ini_set('soap.wsdl_cache_ttl',0);
Monday, December 5, 2022
3

in you php.ini make sure you have uncommented the line with

extension=php_openssl.dll
Friday, November 11, 2022
4

Have you tried SoapClient which is already built into PHP?

There is one tutorial: PHP - Soap Client calling .NET Web service

Here is another one, even though it was created for zend developers it should work fine.

Monday, September 5, 2022
 
1

Don't run the XML through SOAPVar, and take advantage of the WSDL option of your web service if you can:

<?php

$client = new SOAPClient(
    'http://webserviceurl.asmx?WSDL',
    array(
        'location' => 'http://webserviceurl.asmx',
        'trace' => 1,
        'style' => SOAP_RPC,
        'use' => SOAP_ENCODED,
    )
);

$request = '<item xmlns="rmsItem">
      <columns>
        <column>description</column>
        <column>department</column>
        <column>brand</column>
        <column>lastsold</column>
        <column>lastupdated</column>
        <column>quantityonhand</column>
        <column>weight</column>
      </columns>
      <filters>
        <filter>
          <filterColumn>quantityonhand</filterColumn>
          <operator>greaterthan</operator>
          <filterValue>20</filterValue>
        </filter>
        <filter>
          <filterColumn>lastsold</filterColumn>
          <operator>greaterthan</operator>
          <filterValue>01-01-2005</filterValue>
        </filter>
      </filters>
      <sortColumns>
        <sortColumn>
          <sortColumnName>lastsold</sortColumnName>
          <sortType>ascending</sortType>
        </sortColumn>
        <sortColumn>
          <sortColumnName>quantityonhand</sortColumnName>
          <sortType>descending</sortType>
        </sortColumn>
      </sortColumns>
    </item>';

$result = array();

$params = array("infoRequestXml" => $request);

try {
    $result = $client->__soapCall('getAllInfo', array("parameters"=>$params));
} catch (SoapFault $e) {
    echo "SOAP Fault: ".$e->getMessage()."<br />n";
}

echo "<pre>";
echo htmlspecialchars($client->__getLastRequestHeaders())."n";
echo htmlspecialchars($client->__getLastRequest())."n";
echo "Response:n".htmlspecialchars($client->__getLastResponseHeaders())."n";
echo htmlspecialchars($client->__getLastResponse())."n";
echo "</pre>"; 

var_dump($result);

?>
Monday, November 28, 2022
 
4

never mind i just remove the /catalog from every line that it's in from the wsdl file, everything works fine now thanx anyway.

Tuesday, October 4, 2022
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share