![]() | |
Example Code |
A very simple user register example in PHP to get you started
This is an example in PHP on how to create a new user, it uses the PHP WSO2 WSF Framework.
<?php // Example uses the Webservice Framework from WSO2 which understands must newer webservice constructs // The WSO2 WSF PHP Framework can be downloaded from http://wso2.com/products/web-services-framework/php/ class User { public $User_Id; public $Name; public $Email; public $Password; } class UserCreateRequest { public $User; } class UserCreateResponse { public $User; } $classmap = array ("User" => "User", "UserCreateRequest" => "UserCreateRequest", "UserCreateResponse" => "UserCreateResponse"); try { $wsdl = "http://webserver/InfosoftUserRegisterService/UserService.svc?wsdl"; $endpoint = "http://webserver/InfosoftUserRegisterService/UserService.svc/basic"; $client = new WSClient(array( "wsdl" => $wsdl, "to" => $endpoint, "classmap" => $classmap)); $proxy = $client->getProxy(); $userToCreate = new User(); $userToCreate->Email = "jane.doe@contoso.com"; $userToCreate->Name = "Jane Doe"; $userToCreate->Password = "JanesSecretPassword"; $request = new UserCreateRequest(); $request->User = $userToCreate; $user = $proxy->UserCreate($request); var_dump($user); } catch (Exception $e) { var_dump($e); } ?>