Jump to content

soap client help


dflow

Recommended Posts

im able to connect to an external webservice by checking the var_dump($client->__getFunctions());

 

im new to the calling process for soap

request:

//request
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetLanguagesList xmlns="http://www.example.com/">
      <request>
        <AffId>int</AffId>
        <Lang>string</Lang>
        <Password>string</Password>
      </request>
    </GetLanguagesList>
  </soap:Body>
</soap:Envelope>

//response
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetLanguagesListResponse xmlns="http://www.example.com/">
      <GetLanguagesListResult>
        <Errors>
          <RSError>
            <Code>string</Code>
            <Message>string</Message>
          </RSError>
          <RSError>
            <Code>string</Code>
            <Message>string</Message>
          </RSError>
        </Errors>
        <Status>Error or OK</Status>
        <Languages>
          <HCLanguage>
            <Code>string</Code>
            <Name>string</Name>
          </HCLanguage>
          <HCLanguage>
            <Code>string</Code>
            <Name>string</Name>
          </HCLanguage>
        </Languages>
      </GetLanguagesListResult>
    </GetLanguagesListResponse>
  </soap:Body>
</soap:Envelope>

//my code:
$ih_soap_ns = 'http://www.example.com';
$ih_soap_user = '135';
$ih_soap_pass = '123432';
$client = new SoapClient("http://www.example.com/WebService2/example.asmx?WSDL");
  	$header = new SoapHeader($ih_soap_ns,'ServiceAuthHeader', array('Partner' => $ih_soap_user,'Password' => $ih_soap_pass), true);
$params = array('AffID' => $ih_soap_user, 'Password' => $ih_soap_pass,'Lang' =>'en','CountryID'=>'12');




$result = $client->GetLanguagesList(array('parameters' => $params),null,$header);
//line 15
foreach($result->GetLanguagesList as $l)
echo $l->HCLanguage; 

 

error:

 

Notice: Undefined property: stdClass::$GetLanguagesList in /Applications/MAMP/htdocs/zend/hs-client.php on line 15

 

Warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/zend/hs-client.php on line 15

Link to comment
https://forums.phpfreaks.com/topic/241813-soap-client-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.