Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
An example of a request for PL / SQL:
DECLARE
l_Http_Request Utl_Http.Req;
l_Http_Response Utl_Http.Resp;
l_Buffer_Size NUMBER(10) := 512;
l_Line_Size NUMBER(10) := 50;
l_Lines_Count NUMBER(10) := 100;
l_String_Request VARCHAR2(32767);
l_Line VARCHAR2(128);
l_Substring_Msg VARCHAR2(512);
l_Raw_Data RAW(512);
l_Clob_Response CLOB;
l_Host_Name VARCHAR2(128) := 'real';
l_Port VARCHAR2(128) := '4799';
BEGIN
l_String_Request := '<?xml version="1.0"?>
<configuration>
<system.web>
<identity impersonate="true"/>
</system.web>
<appSettings>
<add key="QMSAPIURL" value="http://host:port/QMS/Service"/>
<add key="Taskname" value="TaskName"/>
</appSettings>
<system.serviceModel>
<!-- Added for QMS API -->
<extensions>
<behaviorExtensions>
<add name="serviceKeyBehavior" type="EDXfromWebPage.ServiceSupport.ServiceKeyBehaviorExtensionElement, EDXfromWebPage, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</behaviorExtensions>
</extensions>
<behaviors>
<endpointBehaviors>
<behavior name="ServiceKeyEndpointBehavior">
<serviceKeyBehavior/>
</behavior>
</endpointBehaviors>
</behaviors>
<!-- END Added for QMS API -->
<client>
<endpoint address="http://host:port/QMS/Service" binding="basicHttpBinding" behaviorConfiguration="ServiceKeyEndpointBehavior" bindingConfiguration="BasicHttpBinding_IQMS" contract="QMSBackendService.IQMS" name="BasicHttpBinding_IQMS"/>
<endpoint address="http://host:port/ANY/Service" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IQTService" contract="QMSBackendService.IQTService" behaviorConfiguration="ServiceKeyEndpointBehavior" name="BasicHttpBinding_IQTService"/>
</client>
</system.serviceModel>
</configuration>';
l_Http_Request := Sys.Utl_Http.Begin_Request(Url => 'http://host:port/QMS/Service', Method => 'POST', Http_Version => Sys.Utl_Http.Http_Version_1_1);
Sys.Utl_Http.Set_Header(l_Http_Request, 'User-Agent', 'Mozilla/4.0');
Sys.Utl_Http.Set_Header(l_Http_Request, 'Content-Type', 'text/xml;charset=UTF-8');
Sys.Utl_Http.Set_Header(l_Http_Request, 'Content-Length', Length(l_String_Request));
<<request_Loop>>
FOR i IN 0 .. Ceil(Length(l_String_Request) / l_Buffer_Size) - 1
LOOP
l_Substring_Msg := Substr(l_String_Request, i * l_Buffer_Size + 1, l_Buffer_Size);
BEGIN
l_Raw_Data := Utl_Raw.Cast_To_Raw(l_Substring_Msg);
Utl_Http.Write_Raw(r => l_Http_Request, Data => l_Raw_Data);
EXCEPTION
WHEN No_Data_Found THEN
EXIT Request_Loop;
END;
END LOOP Request_Loop;
l_Http_Response := Sys.Utl_Http.Get_Response(l_Http_Request);
Sys.Dbms_Output.Put_Line('Response> status_code: "' || l_Http_Response.Status_Code || '"');
Sys.Dbms_Output.Put_Line('Response> reason_phrase: "' || l_Http_Response.Reason_Phrase || '"');
Sys.Dbms_Output.Put_Line('Response> http_version: "' || l_Http_Response.Http_Version || '"');
END;
/
Response:
Response> status_code: "401"
Response> reason_phrase: "Unauthorized"
Response> http_version: "HTTP/1.1"
I am trying to cause the EDX task.
Can I connect to the QlikView through QMS API authentication using Basic Authentication?
Hi Ronnie!
Thanks a lot for replying.
But i already read this documentation, but the solution is not found.
Got a job that should be triggered on exteranal event (EDX), see screenshot
Trying to call this task using the API Management Service (see screenshot)
But to reach the API Management Service, i try with using PL/SQL block (see code above)
and every time i get the answer
Response> status_code: "401"
Response> reason_phrase: "Unauthorized"
Response> http_version: "HTTP/1.1"
Error says problem with authentication
Is the user running the code a member of the correct local group(s) on the Server?
-Rob
Hell, Rob
Yes, he is a member of.
Server QlickView is running on Windows Server/
And every time I try using code PL /SQL trigger the problem (on EDX), whenever I stumble Authentication error/
For example:
DECLARE
l_Clob CLOB;
BEGIN
Debug_Pkg.Debug_On;
l_Clob := Ntlm_Http_Pkg.Get_Response_Clob('http://host:4799/QMS/Service', 'Domen\Makarenko', 'Password');
Ntlm_Http_Pkg.End_Request;
Debug_Pkg.Print(Substr(l_Clob, 1, 32000));
END;
This query returns a result
20.07.2016 10:23:32: Persistent connection count: 0
20.07.2016 10:23:32:
20.07.2016 10:23:32: http://host:4799/QMS/Service
20.07.2016 10:23:32: Response Status Code: 200
20.07.2016 10:23:32: #1 Content-Length : 72029
20.07.2016 10:23:32: #2 Content-Type : text/xml; charset=UTF-8
20.07.2016 10:23:32: #3 Server : Microsoft-HTTPAPI/2.0
20.07.2016 10:23:32: #4 Date : Wed, 20 Jul 2016 07:23:32 GMT
20.07.2016 10:23:32: Body length = 72029
20.07.2016 10:23:32: Persistent connection count: 0
20.07.2016 10:23:32: Постоянное число соединений (должно быть равно нулю): 0
20.07.2016 10:23:32: Persistent connection count: 0
20.07.2016 10:23:32: Persistent connection count (should be zero): 0
20.07.2016 10:23:32: Size of CLOB (anything over 4K will be truncated): 32000
20.07.2016 10:23:32: <?xml version="1.0" encoding="utf-8"?>
etc.
Content http://host:4799/QMS/Service
Query returns the following error:
DECLARE
l_Url VARCHAR2(2000) := 'http://host:4799/QMS/Service';
l_Ntlm_Auth_Str VARCHAR2(2000);
l_Xml Xmltype;
l_Clob CLOB;
l_Soap_Env CLOB := '<?xml version="1.0"?>
<configuration>
<system.web>
<identity impersonate="true"/>
</system.web>
<appSettings>
<add key="QMSAPIURL" value="http://host:4799/QMS/Service"/>
<add key="Taskname" value="MyTask.qvw"/>
</appSettings>
<system.serviceModel>
<!-- Added for QMS API -->
<extensions>
<behaviorExtensions>
<add name="serviceKeyBehavior" type="EDXfromWebPage.ServiceSupport.ServiceKeyBehaviorExtensionElement, EDXfromWebPage, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</behaviorExtensions>
</extensions>
<behaviors>
<endpointBehaviors>
<behavior name="ServiceKeyEndpointBehavior">
<serviceKeyBehavior/>
</behavior>
</endpointBehaviors>
</behaviors>
<!-- END Added for QMS API -->
<client>
<endpoint address="http://host:4799/QMS/Service" binding="basicHttpBinding" behaviorConfiguration="ServiceKeyEndpointBehavior" bindingConfiguration="BasicHttpBinding_IQMS" contract="QMSBackendService.IQMS" name="BasicHttpBinding_IQMS"/>
<endpoint address="http://host:4799/ANY/Service" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IQTService" contract="QMSBackendService.IQTService" behaviorConfiguration="ServiceKeyEndpointBehavior" name="BasicHttpBinding_IQTService"/>
</client>
</system.serviceModel>
</configuration>';
BEGIN
Debug_Pkg.Debug_On;
l_Ntlm_Auth_Str := Ntlm_Http_Pkg.Begin_Request(l_Url, 'Domen\Makarenko', 'Password');
Flex_Ws_Api.g_Request_Headers(1).Name := 'Authorization';
Flex_Ws_Api.g_Request_Headers(1).Value := l_Ntlm_Auth_Str;
l_Xml := Flex_Ws_Api.Make_Request(p_Url => l_url, p_Action => 'http://ws.qliktech.com/QMS/11/IQMS/TriggerEDXTask', p_Envelope => l_soap_env);
Ntlm_Http_Pkg.End_Request;
Debug_Pkg.Print(p_Xml => l_Xml); -- XML a response from a web service
END;
20.07.2016 09:53:56: Negotiate Message: NTLM TlRMTVNTUAABAAAAB7IIogcABwAuAAAABgAGACgAAAAFASgKAAAAD0tXQUNIQVNGQUNUT1I=
20.07.2016 09:53:56:
20.07.2016 09:53:56: GET http://host:4799/QMS/Service
20.07.2016 09:53:56: Response Status Code: 200
20.07.2016 09:53:56: #1 Content-Length : 72029
20.07.2016 09:53:56: #2 Content-Type : text/xml; charset=UTF-8
20.07.2016 09:53:56: #3 Server : Microsoft-HTTPAPI/2.0
20.07.2016 09:53:56: #4 Date : Wed, 20 Jul 2016 06:53:57 GMT
20.07.2016 09:53:56: Body length = 72029
20.07.2016 09:53:56: Persistent connection count: 0
status_code/401/http://host:4799/QMS/Service/
reason_phrase/Unauthorized/POST/
http_version/HTTP/1.1//
private_hndl/-2029476794//
"Yes, he is a member of.
Server QlickView is running on Windows Server/"
Perhaps this is just a English translation problem, but the user id must be a member of the local groups "QlikView Management API"
-Rob
Hello, Rob
Thanks for the answer
Sorry for my english/
He is a member of the local group