how to write soapclient function in php? -
i want know how write following soap request in php using soapclient function ?
wsdl : https://test.edentiti.com/registrations-registrations/dynamicformsservice?wsdl
action call :
> <soapenv:envelope > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:dyn="http://dynamicform.services.registrations.edentiti.com/"> > <soapenv:header/> <soapenv:body> > <dyn:registerverification> > <accountid>abcdefghijkl</accountid> > <password>1010101010</password> > <ruleid>default</ruleid> > <name> > <givenname>john</givenname> > <honorific></honorific> > <middlenames></middlenames> > <surname>citizen</surname> > </name> > <email>john@edentiti.com</email> > <currentresidentialaddress> > <country>aus</country> > <postcode>2000</postcode> > <state>nsw</state> > <streetname>address</streetname> > <streetnumber></streetnumber> > <streettype></streettype> > <suburb>city</suburb> > </currentresidentialaddress> > > <generateverificationtoken>false</generateverificationtoken> > </dyn:registerverification> </soapenv:body> </soapenv:envelope>
i want know how write above in following function.
//create client object $soapclient = new soapclient(''); $params = array(...........); $response = $soapclient->.......($params); var_dump($response);
you can call registerverification
method array of data parameter:
$wsdl = 'https://test.edentiti.com/registrations-registrations/dynamicformsservice?wsdl'; $client = new soapclient($wsdl); $registerverificationdata = [ 'accountid' => 'abcdefghijkl', 'password' => '1010101010', 'ruleid' => 'default', 'name' => [ 'givenname' => 'john', 'honorific' => null, 'middlenames' => null, 'surname' => 'citizen', ], 'email' => 'john@edentiti.com', 'currentresidentialaddress' => [ 'country' => 'aus', 'postcode' => '2000', 'state' => 'nsw', 'streetname' => null, 'streetnumber' => null, 'streettype' => null, 'suburb' => 'city', ], 'generateverificationtoken' => false, ]; $response = $client->registerverification($registerverificationdata); var_dump($response);
if soap server requires null
properties defined, can replace null
values soapvar
instances before calling registerverification()
:
array_walk_recursive($registerverificationdata, function (&$value) { if ($value === null) { $value = new soapvar(null, xsd_anytype); } });