This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
developers:integration:wsa [2018/06/27 14:30] tjotov |
— (current) | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Using ADUCID web service “WSA” ====== | ||
| - | See | ||
| - | * [[developers: | ||
| - | * [[integration-api: | ||
| - | * | ||
| - | For detailed methods / classes / types description see [[http:// | ||
| - | |||
| - | WSA is meant for all platforms like PHP, C# **except** Java (Java is also possible but we provide a full module so WSDL import is redundant). | ||
| - | |||
| - | Web service is a standalone “application” which must be deployed on same server as AIM. Its default address is like this: | ||
| - | |||
| - | < | ||
| - | https:// | ||
| - | </ | ||
| - | |||
| - | There you will see WSA Interface homepage where you can download WSDL file to generate client. | ||
| - | |||
| - | < | ||
| - | https:// | ||
| - | </ | ||
| - | |||
| - | |||
| - | ====== C# Example ====== | ||
| - | |||
| - | === Import WSDL into your project in Visual Studio. === | ||
| - | |||
| - | Create an instance of **AducidApiJsonServiceClient**. | ||
| - | |||
| - | === Create a start operation Url === | ||
| - | This page starts authentication request. | ||
| - | |||
| - | <code csharp> | ||
| - | var aducid = new AducidApiJsonServiceClient(); | ||
| - | string host = " | ||
| - | string query = context.Request.QueryString.ToString(); | ||
| - | var queryParsed = HttpUtility.ParseQueryString(query); | ||
| - | var generateQr = queryParsed[" | ||
| - | var arg = new OperationArgument(); | ||
| - | //return URL for iOS | ||
| - | arg.peigReturnName = host + "/ | ||
| - | //QR code picture size | ||
| - | arg.qrCodePictureHeight = 300; | ||
| - | arg.qrCodePictureWidth = 300; | ||
| - | //tab helper If - if more authentication are in web browser in more tabs this help ti identify them - has to be unique | ||
| - | arg.id = " | ||
| - | arg.generateQrCodePicture = generateQr == " | ||
| - | |||
| - | //JSON response from WSA | ||
| - | var response = aducid.startAuthenticationSession(JsonConvert.SerializeObject(arg)); | ||
| - | //parse and store authId | ||
| - | dynamic responseObj = JsonConvert.DeserializeObject(response); | ||
| - | //store authId in your session | ||
| - | context.Session[" | ||
| - | context.Response.ContentType = " | ||
| - | //send response | ||
| - | context.Response.Write(response); | ||
| - | </ | ||
| - | |||
| - | OperationArgument is a simple object | ||
| - | <code csharp> | ||
| - | public class OperationArgument | ||
| - | { | ||
| - | public String peigReturnName { get; set; } | ||
| - | public int qrCodePictureHeight { get; set; } | ||
| - | public int qrCodePictureWidth { get; set; } | ||
| - | public String id { get; set; } | ||
| - | public Boolean generateQrCodePicture { get; set; } | ||
| - | } | ||
| - | </ | ||
| - | === Create WSA proxy === | ||
| - | Just simple " | ||
| - | <code csharp> | ||
| - | var aducid = new AducidApiJsonServiceClient(); | ||
| - | string host = " | ||
| - | var response = aducid.getStatus((string)context.Session[" | ||
| - | context.Response.ContentType = " | ||
| - | context.Response.Write(response); | ||
| - | </ | ||
| - | |||
| - | === Create check Url === | ||
| - | On the result page we evaluate the authentication | ||
| - | There are two basic results – authentication is OK or an error is thrown: | ||
| - | |||
| - | <code csharp> | ||
| - | var aducid = new AducidApiJsonServiceClient(); | ||
| - | //read authId from you session | ||
| - | string authId = (string)context.Session[" | ||
| - | var aducidResult = aducid.getResult(authId, | ||
| - | //parse json | ||
| - | dynamic aducidResultObj = JsonConvert.DeserializeObject(aducidResult); | ||
| - | //User primary key i.e. UDI | ||
| - | var udi = aducidResultObj.data.userDatabaseIndex; | ||
| - | //key to further ADUCID operetions on user object (with authId) | ||
| - | string authKey2 = aducidResultObj.data.authKey2; | ||
| - | //prepare response | ||
| - | var response = aducid.endAuthenticationSession(authId, | ||
| - | context.Response.ContentType = " | ||
| - | //OK do something with your session | ||
| - | //... | ||
| - | //send response | ||
| - | context.Response.Write(response); | ||
| - | </ | ||
| - | |||
| - | |||
| - | === Prepare a web page === | ||
| - | This page should contain [[integration-api: | ||
| - | Provide start, check and proxy Url. | ||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | Override what should be done after authentication / operation: | ||
| - | | ||
| - | if (result.status == " | ||
| - | alert(" | ||
| - | // | ||
| - | } | ||
| - | else { | ||
| - | alert(" | ||
| - | } | ||
| - | } | ||
| - | |||
| - | And create some HTML eleemts: | ||
| - | |||
| - | <code html> | ||
| - | < | ||
| - | <div class=" | ||
| - | <div class=" | ||
| - | |||
| - | <div class=" | ||
| - | <div class=" | ||
| - | <div id=" | ||
| - | </ | ||
| - | </ | ||
| - | <div class=" | ||
| - | <img id=" | ||
| - | </ | ||
| - | |||
| - | <div class=" | ||
| - | <div id=" | ||
| - | <div id=" | ||
| - | </ | ||
| - | |||
| - | <div id=" | ||
| - | < | ||
| - | <a class=' | ||
| - | <br /> | ||
| - | <div class=' | ||
| - | </ | ||
| - | </ | ||
| - | </ | ||
| - | </ | ||