public function sample_code_get_jsonAction(Request $request) { // define the SOAP client using the url for the service $client = new soapclient('http://globalmetals.xignite.com/xGlobalMetals.asmx?WSDL'); // create an array of parameters $param = array(); // add authentication info $xignite_header = new SoapHeader('http://www.xignite.com/services/', "Header", array("Username" => "5E7B30B762CD4E0B9F317540D6E44427")); $client->__setSoapHeaders(array($xignite_header)); // call the service, passing the parameters and the name of the operation $result = $client->ListMetals($param); // assess the results if (is_soap_fault($result)) { //echo '<h2>Fault</h2><pre>'; //print_r($result); // echo '</pre>'; } else { // echo '<h2>Result</h2><pre>'; print_r($result); // echo '</pre>'; } // print the SOAP request //echo '<h2>Request</h2><pre>' . htmlspecialchars($client->__getLastRequest(), ENT_QUOTES) . '</pre>'; // print the SOAP request Headers //echo '<h2>Request Headers</h2><pre>' . htmlspecialchars($client->__getLastRequestHeaders(), ENT_QUOTES) . '</pre>'; // print the SOAP response //echo '<h2>Response</h2><pre>' . htmlspecialchars($client->__getLastResponse(), ENT_QUOTES) . '</pre>'; return true; }