Hi Nick, I am getting the same error message for one of my web service calls. I too have two parameters to pass in the url. However it is not as complex as yours, my parameters are static string values.
Were you able to find the root cause of this issue? Any pointers to solve this issue will be appreciated. Thanks, Charls On Tuesday, July 9, 2013 at 11:45:10 AM UTC+5:30, Ninja Li wrote: > > Hi, > > I am trying to call a web service within my company by using PL/SQL > script. I was required to pass two parameters to the web service: a job > name and a long XML string of sales data. > > The following is the PL/SQL script I created which attempt to use post > data to the web service. > > /**************************************************/ > > DECLARE > req utl_http.req; > resp utl_http.resp; > value VARCHAR2(1024); > > p_in_job_name VARCHAR2(20) := 'job_name'; > p_in_sales_data VARCHAR2(4000) := > '<US_SALES><US_NORTHEST><INVOICE_DATE>07/22/2013</INVOICE_DATE>.....</US_NORTHEST></US_SALES>'; > > > > v_url VARCHAR2(4000) := 'http://myurl/MyService.asmx?' > || > 'jobName=' > || > p_in_job_name > || > '\&salesData=' > || p_in_sales_data; > > BEGIN > req := utl_http.begin_request(v_url); > > utl_http.set_header(req,'User-Agent','Mozilla/4.0'); > > resp := utl_http.get_response(req); > LOOP > utl_http.read_line(resp, value, TRUE); > > dbms_output.put_line(value); > END LOOP; > utl_http.end_response(resp); > EXCEPTION > WHEN utl_http.end_of_body > THEN > utl_http.end_response(resp); > END; > / > > /**************************************************/ > > Where I run it in Oracle 11g v2, I received the following error message: > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"" > http://www.w3.org/TR/html4/strict.dtd"> > <HTML><HEAD><TITLE>Bad Request</TITLE> > <META HTTP-EQUIV="Content-Type" Content="text/html; > charset=us-ascii"></HEAD> > <BODY><h2>Bad Request</h2> > <hr><p>HTTP Error 400. The request is badly formed.</p> > </BODY></HTML> > > I know the same kind of script works on another web service in the company > that don't have XML string as input parameters. The web service to be > called also works as well. > > I suspect that XML tag brackets may be creating problems as input > parameter. I was told that to post XML data using a named form parameter, I > might need to encode XML before it is assigned to the parameter. > > I tried to google about encoding XML but couldn't find much information. > > Any idea about passing XML as parameter or other insight are truly > appreciated. > > Nick > -- -- You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to oracle-plsql-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en --- You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To unsubscribe from this group and stop receiving emails from it, send an email to oracle-plsql+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.