次の REST Web サービスがあります。
<WebInvoke(Method:="GET", BodyStyle:=WebMessageBodyStyle.WrappedRequest,
RequestFormat:=WebMessageFormat.Json, ResponseFormat:=WebMessageFormat.Json, UriTemplate:="/GetConfigValue")>
Function GetConfigValue(ByVal ConfigSection As String) As Stream Implements IMediaManagerService.GetConfigValue
WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8"
Dim client As New System.Net.Mail.SmtpClient
Dim host As String = client.Host
Dim port As String = client.Port.ToString()
'Return host
Return New MemoryStream(Encoding.UTF8.GetBytes(host))
End Function
PL/SQL では、このサービスを使用します。
FUNCTION GetWebConfig (p_AppUrl VARCHAR2, p_ConfigSection VARCHAR2)
RETURN VARCHAR2
AS
l_param_list VARCHAR2 (512);
l_http_request UTL_HTTP.req;
l_http_response UTL_HTTP.resp;
l_response_text VARCHAR2 (32767);
BEGIN
-- service's input parameters
l_param_list := 'ConfigSection=HOSTSMTP';
-- preparing Request...
l_http_request :=
UTL_HTTP.begin_request (
'http://localhost/services/myservices.svc/GetConfigValue',
'GET',
'HTTP/1.1');
-- ...set header's attributes
UTL_HTTP.set_header (l_http_request,
'Content-Type',
'application/json; charset=utf-8');
UTL_HTTP.set_header (l_http_request,
'Content-Length',
LENGTH (l_param_list));
-- ...set input parameters
UTL_HTTP.write_text (l_http_request, l_param_list);
-- get Response and obtain received value
l_http_response := UTL_HTTP.get_response (l_http_request);
UTL_HTTP.read_text (l_http_response, l_response_text);
DBMS_OUTPUT.put_line (l_response_text);
-- finalizing
UTL_HTTP.end_response (l_http_response);
EXCEPTION
WHEN UTL_HTTP.end_of_body
THEN
UTL_HTTP.end_response (l_http_response);
END;
しかし、何らかの理由で応答が 404 / Not Foundを返す
リンクを実行しました: http:// localhost /services/myservices.svc/GetConfigValue FIDDLER で、それは完全に機能しますが、それを消費するか、pl/sql から呼び出すと、見つかりませんでした。