immortallch Posted April 9, 2013 Share Posted April 9, 2013 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(); ?> Quote Link to comment Share on other sites More sharing options...
ignace Posted April 9, 2013 Share Posted April 9, 2013 Change your function to: function Register($request, $Identifier, $Status)And call it like: $response = $sClient->Register($request, $Identifier, $Status); Quote Link to comment Share on other sites More sharing options...
immortallch Posted April 10, 2013 Author Share Posted April 10, 2013 (edited) I can't do like this - my WSDL file orders me to have one object as input. When i try yours idea, I've got this SOAP fault: Error, cannott find parameter Here is function prototype: RegisterResponse Register(Register $parameters) Edited April 10, 2013 by immortallch Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.