Hi,
I can send SoapVar from my client to my server and from my server to my client - it works ok. The SOAP requests and responses seem to be ok. Everything is ok, until i try make it more "dynamic". How can I access to "Identifier" and "Status" ? Below is the code for client and server.
Thanks for your time!
<?php
header('Content-type: application/xml');
try{
$sClient = new SoapClient('mywsdl.wsdl', array('trace'=>1));
$Identifier = "123456";
$Status = "Hey, how are you today?";
$part_request = array();
$part_request[] = new SoapVar($Identifier,XSD_STRING,NULL,NULL,"Identifier");
$part_request[] = new SoapVar($Status,XSD_STRING,NULL,NULL,"Status");
$request = new SoapVar($part_request, SOAP_ENC_OBJECT, NULL, NULL,"RegisterRequest");
$response = $sClient->Register($request);
print_r ($sClient->__getLastRequest());
print_r ($sClient->__getLastResponse());
} catch(SoapFault $e){
var_dump($e);
}
?>
<?php
//ini_set("soap.wsdl_cache_enabled","0");
$server = new SoapServer("wsdl.wsdl");
function Register($request)
{
/* How to access to "Identifier and Status?"
$request->Identifier or $request->RegisterRequest->Identifier dont work ;/ */
/* BELOW THIS EVERYTHING WORKS, but it's static */
$ResponseId = "1234";
$Status = "Fine";
$part_response = array();
$part_response[] = new SoapVar($ResponseId,XSD_STRING,NULL,NULL,"ResponseId");
$part_response[] = new SoapVar($Status,XSD_STRING,NULL,NULL,"Status");
$response = new SoapVar($part_response,SOAP_ENC_OBJECT,NULL,NULL,"RegistrationResponse");
return $response;
}
$server->AddFunction("Register");
$server->handle();
?>