Hi,
Need your advice and help.
Problem DescriptionWe have a requirement of invoking a web-service for uploading data in tax authority website.
We have been provided a WSDL url which contains the data about the web-service we need to invoke. We have uploaded the WSDL in the SoapUI tool and on submitting request to a specific endpoint URL and providing the XML string in the editor, we are getting the expected response.
However, we are not getting any response(NULL response) when the same is being attempted from PLSQL using UTL_HTTP.
For setting the header attributes using UTL_HTTP.set_header we are referring to the Raw tab in the SoapUI editor and the available WSDL. Following is how we are currently doing this in PLSQL code.
PLSQL
UTL_HTTP.SET_WALLET('*******************************************************',
'password');
l_http_request := UTL_HTTP.begin_request(url => 'https://www.url.xx/wlpl/XXII-PQRS/mn/sh/XxiPqrsVEF1SOAP',
method => 'POST',
http_version => 'HTTP/1.1');
-- UTL_HTTP.SET_HEADER(l_http_request, 'Accept-Encoding', 'gzip,deflate');
UTL_HTTP.set_header(l_http_request, 'Content-Type', 'text/xml;charset=UTF-8');
UTL_HTTP.set_header(l_http_request, 'SOAPAction', '""');
UTL_HTTP.set_header(l_http_request, 'Content-Length', LENGTH(l_string_request));
UTL_HTTP.SET_HEADER(l_http_request, 'Host', 'www.url.xx');
UTL_HTTP.set_header(l_http_request, 'Connection', 'Keep-Alive');
UTL_HTTP.set_header(l_http_request, 'User-Agent', 'Apache-HttpClient/4.1.1 (java 1.5)');
SoapUI Raw TabPOST
https://www.url.xx/wlpl/XXII-PQRS/mn/sh/XxiPqrsVEF1SOAP HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
Content-Length: 7841
Host: www.url.xx
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Please note that the SOAPAction header has been left without any value(only double quotes within single quotes) as it is so in the RAW tab of the SoapUI tool and also in the WSDL content. Excerpts from the WSDL file regarding the part with SOAPAction also provided below for your reference.
WSDL<wsdl:operation name="OperationName">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
Can you please help me out?
Thanks & Regards,
Debamrita
All I see is you setting headers.
You havent actually *posted* anything ?
You need to write the data (and then look for a response) - some sample code below
declare
l_request utl_http.req;
l_response utl_http.resp;
l_target varchar2(4000) := 'http://myurl.com';
l_data varchar2(4000);
l_post_data varchar2(4000) := '<xml>mydata</xml>';
begin
l_request := utl_http.begin_request(l_target, 'POST',' HTTP/1.1');
utl_http.set_header(l_request, 'user-agent', 'mozilla/4.0');
utl_http.set_header(l_request, 'content-type', 'application/json');
utl_http.set_header(l_request, 'Content-Length', length(content));
-- do the post
utl_http.write_text(l_request, l_post_data);
l_response := utl_http.get_response(l_request);
-- get the response back
begin
loop
utl_http.read_line(l_response, l_data);
dbms_output.put_line(l_data);
end loop;
utl_http.end_response(l_response);
exception
when utl_http.end_of_body
then
utl_http.end_response(l_response);
end;
end;