So, I’ve tried for DAYS to get this solved. I’ve asked, on stackoverflow as well as several other sources of programmer-to-programmer networks.
Essentially what my issue is, is no matter how I pass arguments to my soap server (all necessary code included below) I get the extremely vague and unhelpful error that “Error cannot find parameter”.
Client code:
$client = new Client_Billing( "http://192.168.1.120/Client_Billing.wsdl", array( 'cache_wsdl' => WSDL_CACHE_NONE, 'trace' => '1') ); //client initialization
// create our user array
$user = new CreateUserType();
$user->__set('account-id', 5);
$user->__set('first-name', "Colby");
$user->__set('last-name',"Meier");
$user->lastname ="Meier";
$user->email = "[email protected]";
$user->passwd = "password";
$user->__set('user-type', 2);
$user->phone = "555-555-1234";
$user->mobile = "555-555-1234";
$user->website = "http://www.notarealwebsite.com";
$createUser = array();
$createUser['session-id'] = "testSession";
$createUser['user'] = $user;
try {
$test = $client->__soapCall('CreateUser', $createUser);
} catch(SoapFault $ex) { //Request failed, print out why
echo "<pre>Error:\n\t".$ex->getMessage()."\n";
print_r($ex->getTrace()) ."</pre>";
}
Relevant Server code:
class Client_Billing extends SoapClient {
public function __construct($wsdl="http://192.168.1.120/Client_Billing.wsdl", $options=array()) {
foreach(self::$classmap as $wsdlClassName => $phpClassName) {
if(!isset($options['classmap'][$wsdlClassName])) {
$options['classmap'][$wsdlClassName] = $phpClassName;
}
}
parent::__construct($wsdl, $options);
}
public function _checkArguments($arguments, $validParameters) {
print_r($arguments);
$variables = "";
foreach ($arguments as $arg) {
$type = gettype($arg);
if ($type == "object") {
$type = get_class($arg);
}
$variables .= "(".$type.")";
}
if (!in_array($variables, $validParameters)) {
throw new Exception("Invalid parameter types: ".str_replace(")(", ", ", $variables));
}
return true;
public function CreateUser($mixed = null) {
$validParameters = array(
"(CreateUser)",
);
$args = func_get_args();
$this->_checkArguments($args, $validParameters);
return $this->__soapCall("CreateUser", $args);
}
And finally, the relevant WSDL types:
<complexType name="CreateUserType"><!-- ns__CreateUserType -->
<sequence>
<element name="account-id" type="xsd:int" minOccurs="1" maxOccurs="1"/><!-- ns__CreateUserType::account_id -->
<element name="first-name" type="xsd:string" minOccurs="1" maxOccurs="1"/><!-- ns__CreateUserType::first_name -->
<element name="last-name" type="xsd:string" minOccurs="1" maxOccurs="1"/><!-- ns__CreateUserType::last_name -->
<element name="email" type="xsd:string" minOccurs="1" maxOccurs="1"/><!-- ns__CreateUserType::email -->
<element name="passwd" type="xsd:string" minOccurs="1" maxOccurs="1"/><!-- ns__CreateUserType::passwd -->
<element name="user-type" type="xsd:int" minOccurs="1" maxOccurs="1"/><!-- ns__CreateUserType::user_type -->
<element name="phone" type="xsd:string" minOccurs="1" maxOccurs="1"/><!-- ns__CreateUserType::phone -->
<element name="mobile" type="xsd:string" minOccurs="1" maxOccurs="1"/><!-- ns__CreateUserType::mobile -->
<element name="website" type="xsd:string" minOccurs="1" maxOccurs="1"/><!-- ns__CreateUserType::website -->
</sequence>
</complexType>
<operation name="CreateUser">
<SOAP:operation soapAction=""/>
<input>
<SOAP:body parts="parameters" use="literal"/>
</input>
<output>
<SOAP:body parts="parameters" use="literal"/>
</output>
</operation>
<operation name="CreateUser">
<documentation>Service definition of function ns__CreateUser</documentation>
<input message="tns:CreateUser"/>
<output message="tns:CreateUserResult"/>
</operation>
I’ve been racking my brain trying to get this solved so any input is GREATLY appreciated. Unfortunately I realize it’s probably something stupid-simple, but for the life of me, I cannot figure it out.