Joined: 18 Mar 2010 |
Posts: 1 |
|
|
|
Posted: Thu Mar 18, 2010 3:26 am |
|
|
|
|
|
I have a problem with NuSoap. My problem is that i can`t connect to a function which is defined on a WSDL. The WSDL is and the code to connect with SOAP is...
<?php
// Pull in the NuSOAP code
require_once('lib/nusoap.php');
// Create the client instance
error_reporting(0);
$client = new soapclient('http://www.b-kin.com/bcim/Account/AccountService.asmx?WSDL', true);
// Check for an error
$err = $client->getError();
if ($err) {
// Display the error
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
// At this point, you know the call that follows will fail
}
$proxy= $client->getProxy();
//EL USer y el pass no los pongo
$header = '<UserCredentials><userName></userName><passWord></passWord></UserCredentials>';
$client->setHeaders($header);
$parametros=array('SearchAccounts.searchRequest.Search.CriteriaCollection.SearchCriteria[0].Attribute' => 'Name','SearchAccounts.searchRequest.Search.CriteriaCollection.SearchCriteria[0].CompareOperator' => 'Contains','SearchAccounts.searchRequest.Search.CriteriaCollection.SearchCriteria[0].Value' => 'c','SearchAccounts.searchRequest.Search.SortDirection' => 'ASC','SearchAccounts.searchRequest.Search.Context' => 'All','SearchAccounts.searchRequest.Search.IsForAllUsers' => 'false','SearchAccounts.searchRequest.PageSize' => '0','SearchAccounts.searchRequest.SortField' => 'Name','SearchAccounts.searchRequest.SortOrder' => 'ASC','SearchAccounts.searchRequest.Columns' => 'Name,Email,AccountId','SearchAccounts.searchRequest.CurrentPageIndex' => 0);
$result = $client->call('SearchAccounts',$parametros);
// 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>';
}
}
// Display the request and response
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
// Display the debug messages
echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
?> |
What fails??
Array
(
[faultcode] => soap:Server
[faultstring] => Server was unable to process request. ---> Object reference not set to an instance of an object.
[detail] =>
)
|
Thanks!!!And sorry about my english...
|
|