Skip to content

Help to write a code for web service server #5

Description

@rquezada-sanchez

Hi Daniel, thanks for your authentication extension. Currently I have installed it in version 3.6 of Moodle.

** I have been using the LDAP authentication, however I have had problems to authenticate with the alias of the users, for this reason I am looking for other alternatives.

To use your extension I am developing a webservice which connects to an LDAP server to perform the validation of access with either the user or alias thereof. However, I have some doubts.

This is part of the code for the web service.

$ server-> wsdl-> addComplexType (
    'User',
    'complexType',
    'struct',
    'all',
    '',
    array (
        'auth' => array ('name' => 'auth', 'type' => 'xsd: bool'),
        'username' => array ('name' => 'username', 'type' => 'xsd: string'),
        'firstname' => array ('name' => 'firstname', 'type' => 'xsd: string'),
        'lastname' => array ('name' => 'lastname', 'type' => 'xsd: string'),
        'email' => array ('name' => 'email', 'type' => 'xsd: string'),
        'city' => array ('name' => 'city', 'type' => 'xsd: string'),
        'country' => array ('name' => 'country', 'type' => 'xsd: string'),
        'institution' => array ('name' => 'institution', 'type' => 'xsd: string'),
        'department' => array ('name' => 'department', 'type' => 'xsd: string')
    )
);

$ server-> wsdl-> addComplexType (
    'UserArray',
    'complexType',
    'array',
    '',
    'SOAP-ENC: Array',
    array (),
    array (
        array ('ref' => 'SOAP-ENC: arrayType', 'wsdl: arrayType' => 'tns: User []')
    ),
    'tns: User'
);

// register the class method and the params of the method
$ server-> register ("LDAP_Zimbra.Valida_Auth"
                , array ('username' => 'xsd: string', 'password' => 'xsd: string')
                , array ('return' => 'tns: UserArray')
                , $ namespace
                , false
                , 'rpc'
                , 'encoded'
                , 'User validation.'
                               );

As you can see the function is LDAP_Zimbra.Valida_Auth receives as arguments to username and passwod it responds with an array with the following fields
        'auth'
        'username'
        'firstname'
        'lastname'
        'e-mail'
        'city'
        'country'
        'institution'
        'department'

For more information you can see here the webservice https://cpe.usanpedro.edu.pe/ws/nusoap/auth.php?wsdl

However, I have the following questions in the External webservice authentication form

auth_ws | serverurl -> https://cpe.usanpedro.edu.pe/ws/nusoap/auth2.php?wsdl
auth_ws | default_params ->
auth_ws | auth_function -> LDAP_Zimbra.Valida_Auth
auth_ws | auth_function_username_paramname -> username
auth_ws | auth_function_password_paramname -> password
auth_ws | auth_function_resultClass -> Here is an arrangement or class?
auth_ws | auth_function_resultField -> auth
auth_ws | changepasswordurl ->
auth_ws | removeuser -> Internal Suspend.

For the field auth_function_resultClass according to the copied code what is the function?

Do you have an example of code to guide me?

I enclose my project so that you can give me the necessary support.
nusoap_ldap.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions