Http-adapter: Convert html-post to JAVA-post?

Hello everybody,
unfortunately I am not a java programmer. But I am testing the http adapter.
Is it possible to convert the following html-post into JAVA code?
<html><head>
<body>
<form action="http://myserver" method="post">
<p>Interface Namespace<br>
<input name="namespace" value="http://mum.mappings" size="40"></p>
<p>(Sender-) Service:<br>
<input name="service" value="MUMHTTP" size="40"></p>
<p>Interface Name:<br>
<input name="interface" value="MI_Merge_1" size="40"></p>
<p>Text:<br>
<textarea name="Text" rows="5" cols="50"></textarea></p>
<p><input type="submit" value="Send"></p>
</form>
</form>
</body>
</head>
</html>
For me it is important to send the values of the <input> values.
How has the code look like?
Many regards, mario

Hi Mario,
I Have once used this code snippet to send a payload to XI engine. Please change the parameters like XI server URL,
Namespace,senderservice etc..
Please let me know if you need any further help.
Regards,
Ananth
public static void main(String[] args) throws Exception {
     try {
          URL sapURL = null;
          String urlString = "http://"+serverHost+":"+serverPort+"/sap/xi/adapter_plain?namespace="+senderNamespace+"&interface="
+senderInterface+"&service="+senderservice+"&party=&agency=&scheme=&QOS="+QOS+"&sap-user="+sapUser+"&sap-password="+
sapPWD+"&sap-client="+client+"&sap-language=E";
          sapURL= new URL(urlString);
          HttpURLConnection xi = (HttpURLConnection)sapURL.openConnection();
          xi.setRequestMethod("POST");
          xi.setRequestProperty("Content-Type","text/xml");
          xi.setDoOutput(true);
          generateXML(xi.getOutputStream());
          System.out.println(urlString);
          System.out.println("Resp Msg:"+xi.getResponseMessage()+" -- Resp Msg:"+xi.getResponseCode());
          xi= null;
     } catch (Exception e) {
               e.printStackTrace();
public static void generateXML(OutputStream out){
     try {
          PrintWriter prt = new PrintWriter(out,false);
          //Create XML tags
          prt.println("<?xml version= "1.0"?>");
          prt.print("<"+resp_MsgType+" xmlns:ns=""+resp_NameSpace+"">");
          prt.print("<"+xml_tag1+">");
          prt.print(xml_tagValue1);
          prt.print("</"+xml_tag1+">");
          prt.print("<"+xml_tag2+">");
          prt.print(xml_tagValue2);
          prt.print("</"+xml_tag2+">");
          prt.print("</"+resp_MsgType+">");
          prt.flush();
          prt.close();
          out.close();
          prt=null;
          out=null;
          }catch(Exception e){
               e.printStackTrace();

Similar Messages

  • Convert html-post to JAVA-post?

    Hello everybody,
    unfortunately I am not a java programmer.
    Is it possible to convert the following html-post into JAVA code?
    <html><head>
    <body>
      <form action="http://myserver" method="post">
        <p>Interface Namespace<br>
        <input name="namespace" value="http://mum.mappings" size="40"></p>
        <p>(Sender-) Service:<br>
        <input name="service" value="MUMHTTP" size="40"></p>
        <p>Interface Name:<br>
        <input name="interface" value="MI_Merge_1" size="40"></p>
        <p>Text:<br>
        <textarea name="Text" rows="5" cols="50"></textarea></p>
        <p><input type="submit" value="Send"></p>
      </form>
    </form>
    </body>
    </head>
    </html>
    For me it is important to send the values of the <input> values.
    How has the code look like?
    Many regards, mario

    mario,
    this is possible if you use something like HttpClient
    check
    http://jakarta.apache.org/commons/httpclient/
    for more details.
    here are few examples of using httpclient for posting data
    http://jakarta.apache.org/commons/httpclient/methods/post.html
    Rgds,
    Amol

  • HTTP ADAPTER Get or Post XI

    Hi, anyone knows how can i get or post a file with http adapter in XI, in a simple view you can't do it directly in the configuration in the communication channel, but i think it has to be a way to do that, at least Business connector have this hability, and this is an older tool of SAP.
    I hope anyone can help me.
    Regards
    Marco Salazar

    Hi all, thanks, for the answers, but the issue is not about the client, i need to know, how can i put or get a file from url directory, and processing in PI, then deliver to other system.
    Regards.
    Marco

  • Converting html forms to java

    having viewed an earlier post in this forum i managed to create the following code but am having a few problems.
    here are the active parts of the html form on googles search, engine. i am trying to convert this into java form and have so far succeeeded in generating the code shown below, but keep getting the following error
    "IOException; Server returned HTTP response code: 501 for URL: http://www.google.co.uk/search"
    the form:
    <form action=/search name=f>
    <input type=hidden name=hl value=en>
    <input maxlength=2048 size=55 name=q value="" title = "Google Search">
    <input type=submit value="Google Search" name=btnG>
    <input type=submit value="I'm Feeling Lucky" name=btnI>
    </form>
    in the following code baseURL is the domain of the server... in this case http://www.google.co.uk/, method is the method as defined in the form method attirbute, if the attribute is not there, as in this form the default method is called which is GET
                URL url;
                HttpURLConnection urlConn;
                DataOutputStream printout;
                BufferedReader input;
                if(action.startsWith("http")) {
                    url = new URL(action);
                } else if(action.startsWith("/")) {
                    url = new URL(baseURL+action.substring(1,action.length()));
                } else {
                    url = new URL(baseURL+action);
                urlConn = (HttpURLConnection) url.openConnection();
                urlConn.setDoInput(true);
                urlConn.setDoOutput(true);
                urlConn.setUseCaches(false);
                //      set request method
                urlConn.setRequestMethod(method);
                //      set request type
                urlConn.setRequestProperty("Content-Type",
                        "application/x-www-form-urlencoded");
                //       data-value pairs are separated by &
                String content ="hl=en&q="
                // imitate someone searching for "hello" in i feel lucky
                content+="hello&btnI=I'm Feeling Lucky";
                urlConn.setRequestProperty("Content-Length", content.length() + "");
                //       Send POST output.
                printout = new DataOutputStream(urlConn.getOutputStream());
                printout.writeBytes(content);
                printout.flush();
                printout.close();
                //       Get response data.
                input = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
                String str;
                while (null != ((str = input.readLine())))
                    System.out.println(str);
                input.close();
            } catch (MalformedURLException me) {
                System.err.println("MalformedURLException; " + me);
            } catch (IOException ioe) {
                System.err.println("IOException; " + ioe.getMessage());
                ioe.printStackTrace();
            }i also tried self adding in the question mark that appears after the search text bu again get the same error. any ideas what im doing wrong when connecting to the server? thanks in advance for any help

    Just saw this topic on the forum,
    For each web crawlers the web sites maintain a file called Robots.txt which can be assessed by : http://www.google.co.uk/robots.txt
    You would see following on that file :
    User-agent: *
    Allow: /searchhistory/
    Disallow: /search
    Disallow: /groups
    which means that crawlers are not allowed to scrap this site on search, due to which our code wasnt working
    Thanks

  • HTTP adapter as receiver to POST name-value pairs - How to?

    Hi,
    Scenario: HTTP Sender <> XI <> HTTP receiver (Sync throughout; no BPM)
    In this scenario, a HTTP channel is configured to the target URL to post data.
    The message mapping results in a XML. HTTP posts the same XML to the target URL.
    However,the target URL expects data Posted as name-value pairs.
    eg. eid=45678&zip=11011&ename=Tom%20Lee
    How can we configure HTTP adapter channel to post XML data as
    name-value pairs (as in standard HTTP Form Post)?
    Any pointers?
    thanx,
    Pops

    Hi Udo,
    I currently have a solution (simpler than having a BP), but do not expect it to be the right way of doing.
    I am using Java Mapping to convert the XML structure into Name-Value pair. So the output of Mapping is a string like how HTTP post is expected. So the interface mapping having multiple mappings - firstly, the original Message mapping, and then the Java mapping to do the conversion. So, with a small extension, the solution is still kept simple.
    However, I thought the POST requirement to HTTP URLs would be a common requirement, and expected the HTTP adapter doing this conversion. So, I am still looking for a straight solution (without any custom extensions).
    Any one else faced this situation?
    Can't this be handled by HTTP Adapter?
    -- Pops V

  • Content type in HTTP adapter

    Hi experts,
    is content type application/x-www-form-urlencoded is supported in XI reciever HTTP adapter when we post some raw data ( without XML tags)? we are testing the same with fiddler ( Mozilla poster).
    Please advise.
    Thanks

    Hi steve,
    Thanks for the reply, but the solution is not there.
    anyone has configured the same, then please help.
    Thanks.

  • Accessing Java webservice (XML over http) via WCF or HTTP adapter with content-type and authorization HTTP headers with POST method

    Hi Team,
    I need to access Java web service which is simple service and accepts and returns XML over HTTP. No credentials are needed to access the service. We need to pass following two HTTP headers (Content-Type and Authorization) along with XML request message:
    <GetStatus> message is being constructed in the orchestration and URI is constant to access.
    Which adapter shall I use to get the response back? I tried using WCF-WSHttp with Security Mode = Transport, and different options of client credential types but every time, error returned stating:
    System.Net.WebException:
    The HTTP request is unauthorized with client authentication scheme 'Basic'. The
    authentication header received from the server was 'Basic realm='.
    Authentication failed for principal Basic. Message payload is of type:
    String 
    In Fiddler, request looks line following
    POST <https://URL/GetServiceReopnse HTTP/1.1
    Content-Type: application/xml
    Authorization: Basic cmVmU3RhdHN2Y19kgeRfsdfs=
    Host: <Server name>
    <GetStatus XMLNS="http://server.com/.....">
    <OrgId>232323</OrgId>
    <HubId>3232342323</HubId>
    </GetStatus>
    MMK-007

    First, you should not use the HTTP Adapter because it's been deprecated and replaced by WCF.
    Start with the WCF-Custom Adapter and select the customBinding.
    You should start with the textMessageEncoder and httpTransport and go from there.

  • HTTP adapter post prolog question.

    Hi all,
      I have a scenario where I need to send an XML message through the HTTP adapter (no SOAP) to an external service. THE HTTP Service requires a user password as parameters to be passed in order to process the message. Since HTTP adapters is doing only POST I used the prolog in order to pass these parameters (&user=xxx&password=XXXX) but i get a 401 error. In order to test I created a static HTML form with hidden inputs the user and password variable and did a POST (using iexplorer) and it worked!!! Am I doing something wrong?? Isn't the prolog filed in the adapter suppose to do the same ?? i.e. post two variable user, and password??? How does the prolog field worked? Any help will be appreciated.

    Thanks for the reply,
    actually the problem was on the Content-Type. The default text/xml was the problem since the application was expecting a application/www-form-ulencode (or something like this, i don't remeber). Now it works!!!

  • Want to send information in Header dynamically using HTTP adapter using post method

    Hi ,
    I have a requirement to send below information in http Adapter header dynamically using post method. which will be authenticated by third party system.
    Authorization : WSSE realm="SDP", profile="UsernameToken", type="AppKey" X-WSSE : UsernameToken Username="XXXX", PasswordDigest="Qd0QnQn0eaAHpOiuk/0QhV+Bzdc=", Nonce="eUZZZXpSczFycXJCNVhCWU1mS3ZScldOYg==", Created="2013-09-05T02:12:21Z"
    I have followed below link to create UDF
    http://scn.sap.com/thread/3241568
    As if now my third party system is not available while sending request I am getting 504 gateway error. is there any approach I can validate my request is working fine?
    Regards,

    Hi Abhay,
    Correct me if I'm wrong but I think WSSE requires a SOAP Envelope. If that is the case, there are two approaches: the first one is to use SOAP Axis and the second one is just to build SOAP Envelope via Java mapping.
    You also need to test it successfully externally, capture the request and replicate it in XI.
    Hope this helps,
    Mark

  • XI http-adapter; http-post test tool?

    Hi All
    We have following scenario: system A sends data to R/3 through XI, XI's inbound adapter is type http (Syst A -> XI 3.0 -> R/3).
    Now we need to test the XI's inbound http-adpater.
    Does anyone have some experience with a tool that can send xml-document to XI using http-post or HTML code for this?
    Many Thanks,
    Sami

    Hi Sami,
    Make sure you have activated the plain http adapter.
    1.Edit the HTML code below to change the Hostnames (Radio buttons)/Port numbers to suit your needs.
    2.On selection of radio button you will get the hostname and portnumber populated automatically.
    3.supply the values for sender business system, sender interface and sender namespace and QoS.
    4.Copy and paste the XML in the text area.(make sure you delete the detault tab spaces in the text area) or you can select the file from the file system.
    5.Click Send XML button
    <html>
    <head>
    <title>Send XML Data to XI System</title>
    <script language="javascript">
    <!--
    function SendData() {
      var mypath = document.myform.filename.value;
         var myescns = escape(document.myform.mynamespace.value);
         var mycall = 'http://'
         + document.myform.myhost.value  + ':'
         + document.myform.myport.value + '/sap/xi/adapter_plain?bs='
         + document.myform.mysystem.value + '&namespace='
         + myescns + '&interface='
         + document.myform.myinterface.value + '&qos='
         + document.myform.myqos.value;
         var xmlstream;
         if (document.myform.selectXML[0].checked == true) {
              xmlstream = new ActiveXObject("ADODB.Stream");
              xmlstream.Mode = 3;                                                                                      // 1=read  3=read/write
              xmlstream.Open();
              xmlstream.Type = 1;                                                                                      // 1=adTypeBinary  2=adTypeText
              xmlstream.LoadFromFile(mypath);
         else {
              xmlstream = document.myform.xmltext.value;
         var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
         xmlhttp.Open("POST",mycall,false);
         xmlhttp.setRequestHeader("Content-Length",xmlstream.Size);
         xmlhttp.setRequestHeader("Content-Type","text/xml");
         if (document.myform.selectXML[0].checked == true) {
           xmlhttp.send(xmlstream.Read(xmlstream.Size));
         else {
           xmlhttp.send(xmlstream);
         XICall.innerText = mycall;
         XIAnswer.innerHTML = xmlhttp.responseText;
    function getFile() {
      var mypath = document.myform.filename.value;
         var ForReading  = 1;
         objFSO          = new ActiveXObject("Scripting.FileSystemObject");
         objTextFile     = objFSO.OpenTextFile(mypath, ForReading);
         var filearray   = "";
         for(var n=0;!objTextFile.AtEndOfStream;n++) {
              sRead = objTextFile.ReadLine();
              filearray += sRead + "n";
         objTextFile.Close();
         document.myform.xmltext.value = filearray;
    function setDefaults(n) {
         switch(n) {
              default:
                   document.myform.filename.value = "";
                   document.myform.myhost.value = "";
                   document.myform.myport.value = "";
                   document.myform.mysystem.value="";
                   document.myform.mynamespace.value="";
                   document.myform.myinterface.value="";
                   document.myform.myqos.value="EO";
                   break;
    function setHost(n) {
         switch(n) {
              case 1:
                   document.myform.myhost.value = "yourhostname1";
                   document.myform.myport.value = "8080";
                   break;
              case 2:
                   document.myform.myhost.value = "yourhostname2";
                   document.myform.myport.value = "8000";
                   break;
              case 3:
                   document.myform.myhost.value = "yourhostname3";
                   document.myform.myport.value = "8000";
                   break;
              default:
                   document.myform.myhost.value = "";
                   document.myform.myport.value = "";
    function setNamespace(n) {
         switch(n) {
              case 1:
                   document.myform.mynamespace.value = "urn:sap-com:document:sap:rfc:functions";
                   break;
              case 2:
                   document.myform.mynamespace.value = "urn:sap-com:document:sap:idoc:messages";
                   break;
              default:
                   document.myform.mynamespace.value = "";
    //-->
    </script>
    </head>
    <body>
    <form name="myform">
    <p>XI adapter parameters: </p>
    <!--
    <input type="radio" name="selectDefaults" value="" onClick="setDefaults(1)">XR3 Test PO
    <input type="radio" name="selectDefaults" value="" onClick="setDefaults(2)">XR3 Test Vendor
    <input type="radio" name="selectDefaults" value="" onClick="setDefaults(9)" checked>None
    -->
    <p>
    <table border=0>
    <tr><td>hostname:</td><td>
    <input type="text" name="myhost" size=50 maxlength=100
    value=""><br/></td></tr>
    <tr><td></td>
    <td>
    <input type="radio" name="selectHost" value="" onClick="setHost(1)">XI1
    <input type="radio" name="selectHost" value="" onClick="setHost(2)">XI2
    <input type="radio" name="selectHost" value="" onClick="setHost(3)">XD3
    <input type="radio" name="selectHost" value="" onClick="setHost(9)" checked>Other
    </td></tr>
    <tr><td>port:</td><td>
    <input type="text" name="myport" size=50 maxlength=100
    value=""><br/></td></tr>
    <tr><td>sender business system:</td><td>
    <input type="text" name="mysystem" size=50 maxlength=100
    value=""><br/></td></tr>
    <tr><td>sender interface:</td><td>
    <input type="text" name="myinterface" size=50 maxlength=100
    value=""><br/></td></tr>
    <tr><td>sender namespace:</td><td>
    <input type="text" name="mynamespace" size=50 maxlength=100
    value=""></td>
    </tr>
    <tr><td></td>
    <td>
    <input type="radio" name="selectNamespace" value="" onClick="setNamespace(1)">RFC
    <input type="radio" name="selectNamespace" value="" onClick="setNamespace(2)">IDoc
    <input type="radio" name="selectNamespace" value="" onClick="setNamespace(3)" checked>Other
    </td></tr>
    <tr><td>quality of service (EO/BE):</td><td>
    <select name="myqos">
    <option value="BE" selected>Best Effort</option>
    <option value="EO" >Exactly Once</option>
    </select>
    <br/></td></tr></table>
    <p></p>
    <input type="button" value="Send XML File" onclick="return SendData()">
    <p>XML Text:
    <table>
         <tr>
              <td><input type="radio" name="selectXML" value="1">from File</td>
              <td><input type="radio" name="selectXML" value="2" checked>from Text</td>
         </tr>
         <tr valign="top">
              <td>
                   Path to XML file: (e.g. C:temptest.xml)
                   <br><input type="file" name="filename" size=30 maxlength=80 value="" onChange="return getFile()">
              </td>
              <td>
                   Text for XML:
                   <br><textarea name="xmltext" cols="50" rows="20" wrap="off">
                   </textarea>
              </td>
         </tr>
    </table>
    <p>XI call:</p>
    <div id=XICall></div>
    <p>Answer:</p>
    <div id=XIAnswer></div>
    </form>
    </body>
    </html>
    Regards,
    Sridhar
    Message was edited by: Sridhar Rajan Natarajan

  • Convert XML payload to HTML form data in Receiver HTTP Adapter

    Hi,
    I want to make a HTTP request ( Receiver HTTP Adapter ) to a servlet where I need to send the payload in HTML form format ( name=value ). As per the help document:
    A typical HTML form comprises named fields. When transferring a completed form to the server or a CGI program, the data must be transferred in such a way that the CGI script can recognize the fields that make up the form, and which data was entered in which field.
    The plain HTTP adapter constructs this format using a prolog and an epilog
    Has anyone done this before? I looked through all help documents and forums but in vain. I can resort to Java Mapping to do this but I do not want to re-invent the wheel if I can do it easily using HTTP Adapter Configuration. Please help.

    The parameters available in HTTP adapter for message header are:
    HeaderFieldFive     http://sap.com/xi/XI/System/HTTP
    HeaderFieldFour     http://sap.com/xi/XI/System/HTTP
    HeaderFieldOne     http://sap.com/xi/XI/System/HTTP
    HeaderFieldSix     http://sap.com/xi/XI/System/HTTP
    HeaderFieldThree     http://sap.com/xi/XI/System/HTTP
    HeaderFieldTwo     http://sap.com/xi/XI/System/HTTP
    HTTPDest     http://sap.com/xi/XI/System/HTTP
    TargetURL     http://sap.com/xi/XI/System/HTTP
    URLParamFive     http://sap.com/xi/XI/System/HTTP
    URLParamFour     http://sap.com/xi/XI/System/HTTP
    URLParamOne     http://sap.com/xi/XI/System/HTTP
    URLParamSix     http://sap.com/xi/XI/System/HTTP
    URLParamThree     http://sap.com/xi/XI/System/HTTP
    URLParamTwo     http://sap.com/xi/XI/System/HTTP

  • HTTP Post in HTTP adapter

    Hi,
    We are developing one interface in which sender Torex system sends message in "HTTP Post" format.
    In this sender application wants the url in following format.
    http://server:port/sap/xi/adapter_plain?service=<xxx>&namespace=<xxx>&interface=<xxx>&sap-user=<xxx>&sap-password=<xxx>&qos=BE&ProductID=000000000000000216&uid=500014&deviceID=0725&StoreID=0004
    In above "HTTP Post" format data has been sent in url without body of message.
    I know the option in below blog.
    https://weblogs.sdn.sap.com/pub/wlg/13639
    But is there any other solution for this?
    xml payload for above message is as below.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:interface xmlns:ns0="namespace">
       <ProductID>000000000000000216</ProductID>
       <UID/>
       <DeviceID/>
       <StoreID>0004</StoreID>
    </ns0:ExternalStockLocator_Retail_REQ>
    Thanks
    Edited by: darshana-PI on Feb 10, 2012 9:37 PM

    Hello,
    http://server:port/sap/xi/adapter_plain?service=<xxx>&namespace=<xxx>&interface=<xxx>&sap-user=<xxx>&sap-password=<xxx>&qos=BE&ProductID=000000000000000216&uid=500014&deviceID=0725&StoreID=0004
    In above "HTTP Post" format data has been sent in url without body of message.
    Please remember that when creating a sender/receiver using the Plain HTTP Adapter, the following are automatically filled out
    Transport Protocol: HTTP 1.0, Message Protocol: XI Payload in HTTP Body. The transport protocol means that only HTTP 1.0 is supported and that for it to work, an HTTP Body is required.
    Hope this helps,
    Mark

  • How  to config receiver http adapter for HTTP POST without XML tags ??

    Hi All,
    Can you please provide some infornation on How  to config receiver http adapter for HTTP POST (Request) without XML tags ?? Our receiving product doesn't support XML formats.
    Is there any option to bypass server authentication on the XI?
    If anybody has the same experience or know how to please provide inputs.
    Thanx
    Navin

    Hi,
    you can use xsl mapping for this in which u xtract
    the contents only but not the xml tag.
    Ranjit

  • HTML Post method.

    HI Experts,
    Here my scenario is Proxy to HTTP.
    My Receiver system need HTML Post method in place of XML file. Normally PI will send the XML but receiver system is expecting HTML POST method.
    For this i have to do in configuration.
    Receiver is expecting below format.
    <html>
    <head>
    <title>Authorize</title>
    </head>
    <body>
    <form action="https://developer.skipjackic.com/scripts/evolvcc.dll?AuthorizeAPI" method="post" >
         SerialNumber<input type="text" name="serialnumber" value="000014661324"><br />
         DeveloperSerialNumber<input type="text" name="developerserialnumber" value="464787130566"><br />
         Sjname<input type="text" name="sjname" value="TSYS Test"><br />
         street address<input type="text" name="streetaddress" value="2230 Park Ave"/><br />
         city<input type="text" name="city" value="Cincinnati"/><br />
         state<input type="text" name="state"  value="OH"/><br />
         zipcode<input type="text" name="zipcode"  value="45206"/><br />
         credit card account number<input type="text" name="accountnumber" value="4445999922225"/><br />
         CVV2<input type="text" name="CVV2" value=""><br>
         expiration month<input type="text" name="month" value="12"/><br />
         expiration year<input type="text" name="year" value="2012"/><br />
         amount<input type="text" name="transactionamount" value="1.00"/><br />
         order number<input type="text" name="ordernumber" value="123"/><br />
         phone<input type="text" name="shiptophone" value="8883688507"/>
      orderstring<input type="text" name="orderstring" value="Test1Test Item 13.001N||210.001N||310.001N||410.001N||510.001N~||" /><br />
         <br />
         <input type="submit" value="submit" />
    </form>
    </body>
    </html>
    Thank you
    Srinivas

    Hi Srinivas,
    I have the same issue with Form submit using Java HTTP adapter.
    It would be great if you can share your java mapping code or advise what should be the outcome of java mapping?
    Should the result of java mapping be some kind of XML payload or some html code ?
    Many Thanks,
    Kind Regards
    Ravi

  • HTTPS using a Multipart Post

    I have been given a new requirement to send a zipped file(s) to a client using HTTPS using a Multipart Post.
    I have found an example...
    DECLARE
      req   utl_http.req;
      resp  utl_http.resp;
      value VARCHAR2(1024);
    BEGIN
      req := utl_http.begin_request('http://www.psoug.org');
      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;Which obviously returns and displays the HTML content of the URL, however we need to post zipped files in the content. We have been told by someone at Oracle that we can use the UTL_HTTP package to do this but when i search for this all i find is Java.
    Can anyone point me in the right direction as to where to start and any code examples would be a great help, i tried posting this in the SQL / PLSQL forum but with no success..
    Thanks in advance
    Graham.

    Hi:
    This is tricky one and I have to say that there is not a lot around about it.
    The example you have shown is for UTL_HTTP and while you are on the right track, you want HTTPS and that requires, in addition to what you, the use of the Oracle Wallet. The wallet has to be setup on your machine and referenced in your code. Additionally, you need to be quite clear about the data that is being expected by the remote system to which you are sending the POST request.
    Here is a code example that I have tried to explain a bit for you. Obviously my code is doing something quite different from what you require but the methodology will be similar:
    +++++++++++++++++++++++
    create or replace
    PROCEDURE ABS_MSG_API
    (cab IN VARCHAR2,
    booking_ref IN NUMBER)
    AS
    l_cab VARCHAR2(10);
    l_booking_ref NUMBER;
    l_uuid VARCHAR2(50);
    l_answer integer;
    req utl_http.req;
    resp utl_http.resp;
    value clob;
    listing VARCHAR2(400);
    BEGIN
    l_cab := cab;
    l_booking_ref := booking_ref;
    listing := 'https://........<site address>;
    /* next you must identify the location of your wallet */
    utl_http.set_wallet('file:C:\Documents and Settings\administrator\ORACLE\WALLETS','redy2go4it');
    utl_http.set_transfer_timeout(60);
    dbms_output.put_line(listing);
    /* next we start the request. Though a GET here, a POST is the same thing */
    req := utl_http.begin_request(listing,'GET','HTTP/1.1');
    /* in my case a username and password are passed - think of this at your POST parameters */
    utl_http.set_header(req,'Username',xxxx);
    utl_http.set_header(req,'Password',xxxxx);
    utl_http.set_header(req,'Version','99.99.99');
    /* the rest is much like your code already, with some debug capability */
    resp := utl_http.get_response(req);
    DBMS_OUTPUT.PUT_LINE('Request Method....'||req.METHOD);
    DBMS_OUTPUT.PUT_LINE('HTTP Response Status Code: ' || resp.status_code);
    DBMS_OUTPUT.PUT_LINE('HTTP Response Reason Phrase: ' || resp.reason_phrase);
    DBMS_OUTPUT.PUT_LINE('HTTP Response Version: ' || resp.http_version);
    LOOP
    utl_http.read_line(resp, value, TRUE);
    l_answer := instr(value,'uuid',1,1);
    IF l_answer > 0 THEN
    l_uuid := substr(value,l_answer+6,36);
    dbms_output.put_line('The string is.....'||l_uuid);
    END IF;
    IF l_answer > 0 THEN
    send_dt_message(l_uuid,l_cab,l_booking_ref);
    EXIT;
    END IF;
    END LOOP;
    utl_http.end_response(resp);
    EXCEPTION
    WHEN utl_http.end_of_body THEN
    utl_http.end_response(resp);
    l_answer := instr(value,'uuid',1,1);
    dbms_output.put_line('The value is......'||l_answer);
    END ABS_MSG_API;
    When you submit a POST, all of the parameters are passed as part of the header. You must determine exactly the information being expected by the remote system.
    You can find further information is you search for HTTPS on Ask Tom. There is some useful stuff there.
    I use UTL_HTTP for HTTPS requrests all the time. As I said, it is a bit tricky at first, but the key is the Oracle Wallet and then reading the UTL_HTTP documentation that comes on your DB media disc under PLSQL Packaged Procedures.
    I hope this helps.
    Bruce Clark

Maybe you are looking for

  • How to connect iPhone 5 to Netgear router

    After spening several hours on the phone with an Apple rep trying to figure out why my new iPhone 5 would not connect to my Netgear router. I decided to google Netgear router and iPhone. I stumbled on this discussion from defiantmacho dated August 20

  • Printing Problem with AR9

    We've got several machines which use an intranet application. The app is web based and produces some PDFs on the fly which appear in popup IE windows, which in turn displays them in Adobe Reader. On 2 PCs (both running vista ie8 and ar9.2) the print

  • I just got a new Macbook and I put all music on a flash drive from my PC to mac. Some music (seems to be the newer purchases) are grayed out and will not play??

    I have a mid 2012 MacBook Pro. All of my music was on a PC computer. I don't really know how to work with PCs but I am more than familiar with Macs. I have an iPhone with all of the grayed out music on it and they play fine. They play on the PC too.

  • Start up problem

    dear all toshiba user... i have a serious problem with my toshiba laptop model no L300 STN501 for over 1 1/2 years now...the problem come during start up.. when i'm about to start my laptop with ac power only, i noticed that the power supply LED is f

  • Thumbnails 16:9, playback cropped

    When I look at the thumbnails of my films in i-movie they show the full 16:9 image. However when I playback the film I can see that the image has been cropped a little top and bottom. Could anyone shed some light on this?