1 Reply Latest reply: Feb 1, 2013 12:07 PM by 988139 RSS

    Custom Authentication Scheme Authenticate Parameters Help

    988139
      Hello, Im trying to do a custom authentication scheme through a webservice, here is my function, everything works but even if I put the right credentials it fails to login, If I hard code the credentials to the envelope it works fine but if I try to pass them as parameters it fails, I think the only problem is that it is not getting the values of the parameters (username, password) I don´t know why in every blog I have read this is the way they do it here is my function code

      FUNCTION authenticate(p_username IN VARCHAR2,p_password IN VARCHAR2)
      RETURN BOOLEAN
      IS
      l_envelope CLOB;
      l_xml XMLTYPE;
      l_result VARCHAR2(10);
      l_pass VARCHAR2(10);
      BEGIN
      l_pass := 'true';
      l_envelope := '<?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
      <ValidateUser xmlns="http://tempuri.org/">
      <sUsername>'||p_username||'</sUsername>
      <sLastName>'||p_password||'</sLastName>
      </ValidateUser>
      </soap:Body>
      </soap:Envelope>';

      l_xml := apex_web_service.make_request(
      p_url => 'http://172.17.5.46/Test/Service1.asmx',
      p_action => 'http://tempuri.org/ValidateUser',
      p_envelope => l_envelope
      );

      l_result := apex_web_service.parse_xml(
      p_xml => l_xml,
      p_xpath => '//ValidateUserResponse/ValidateUserResult/text()',
      p_ns => ' xmlns="http://tempuri.org/"' );

      IF l_result = l_pass THEN
      RETURN true;
      ELSE
      RETURN false;
      END IF;
      END authenticate;

      If i replace p_username and p_password with hardcoded valid credentials everything works fine, but I need to pass the values as the function parameters.

      Please Help

      Thanks in advance.