Hi,
I'm trying to use a WSDL webservices but I'm new to the whole thing. I have used PHP on a few sites but never to call a webservices.
I'm helping other to use one that is avaliable by a company. I got the required login information, the url to the WSDL and I got info about the function. But I can't get the whole thing to work.
The HelloWorld function is just used to check and see if the webservices connection is a success, all it do is to return the string that you give it.
This is the code:
<HTML>
<HEAD>
<TITLE>AFSWS Test</TITLE>
</HEAD>
<BODY>
<?
/*
* $Id: wsdlclient3.php,v 1.4 2007/11/06 14:48:49 snichol Exp $
*
* WSDL client sample.
*
* Service: WSDL
* Payload: rpc/encoded
* Transport: http
* Authentication: none
*/
echo '<h1>PHP koppling till AFSWS WSDL Test</h1><br>';
require_once('../lib/nusoap.php');
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
$client = new nusoap_client('http://testhorizon.gothiagroup.com/AFSServices/AFSService.svc?wsdl', 'wsdl',
$proxyhost, $proxyport, $proxyusername, $proxypassword);
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}
$inTest = array('myValue' => "Hello Exor");
$result = $client->call('HelloWorld', array('myValue' => $inTest));
// Check for a fault
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
// Check for errors
$err = $client->getError();
if ($err) {
// Display the error
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
// Display the result
echo '<h2>Result</h2><pre>';
print_r($result);
echo '</pre>';
}
}
//echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
//echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
//echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
?>
</BODY>
</HTML>
|
But I get an error:
Error
HTTP Error: Unsupported HTTP response status 415 Cannot process the message because the content type 'text/xml; charset=ISO-8859-1' was not the expected type 'text/xml; charset=utf-8'. (soapclient->response has contents of the response)
If I get the webservices to work correctley I can go from there and build the functionallity of the page.
Any help is appreciated.