How to use method POST to send XML using utl_http?

Hi,
I am trying to work out how to use the POST method to mimic submitting data from a HTML form, using utl_http.
I cannot use SOAP for this as the people I am sending the data to are just expecting an XML document to be sent to a standard CGI script running on their web server.
There is a lot of documentation on how to submit data using the POST method (using Utl_Http.Write_Text etc), but I cannot find anything that tells me how to submit form variables.
The examples on OTN say this:
"Alternatively use method => 'POST' and Utl_Http.Write_Text to
build an arbitrarily long message"
but don't tell me how to actually place the data into the required input parameters of the CGI program I am hitting.
I need to hit a URL such as
www.asite.com/cgiprogram
and pass in a parameter, eg
in_param="test+data"
I am currently doing this as a GET, which works, but the XML document I am passing in could potentially be bigger than the GET method will allow.
Any help would be greatly appreciated.
Thanks,
Leon.

Please try the PL/SQl forum

Similar Messages

  • How to send XML using UTL_HTTP

    I am trying to workout how to send XML data to a webserver using UTL_HTTP but am not getting any reply
    I need to submit the following XML document to a server "http://api.fastsms.co.uk/api/xmlapi.php"  Their instructions are "The XML Document should be posted unencoded, with a UTF-8 character set as parameter 'xml'"
    If I submit the following XML on their test form
    <?xml version="1.0"?>
    <apirequest version="1">
    <user>
      <username>**USER**</username>
      <password>**PASSWORD**</password>
    </user>
    <application>
      <name>Example Application</name>
      <version>1.0</version>
    </application>
    <inboundcheck lastid="10711399"/>
    </apirequest>
    I get an XML response back with the messages in my inbox. 
    This is the code I am trying to use to accomplish the same from PL/SQL : I know a response is coming back as there is header information - just no content.  What am I doing wrong ?
      l_xml VARCHAR2(5000);
      req utl_http.req;
      resp utl_http.resp;
      header_name VARCHAR2(256); -- Response header name
      header_value VARCHAR2(1024); -- Response header value
      response_text VARCHAR2(4000); -- Response body
      l_url VARCHAR2(100);
    BEGIN
      l_xml := 'xml=<?xml version="1.0"?>';
      l_xml := '<apirequest version="1">';
      l_xml := '<user>';
      l_xml := '<username>**USER**</username>';
      l_xml := '<password>**PASSWORD**</password>';
      l_xml := '</user>';
      l_xml := '<application>';
      l_xml := '<name>Example Application</name>';
      l_xml := '<version>1.0</version>';
      l_xml := '</application>';
      l_xml := '<inboundcheck lastid="10711399"/>';
      l_xml := '</apirequest>';
      -- Open HTTP connection
      l_url := 'http://api.fastsms.co.uk/api/xmlapi.php';
      req := utl_http.begin_request(l_url,'POST',utl_http.HTTP_VERSION_1_1);
      -- Set headers for type and length
      utl_http.set_header(req,'Content-Type','application/x-www-form-urlencoded');
      utl_http.set_header(req,'Content-Length',to_char(length(l_xml)));
      -- Write parameter
      utl_http.write_text(req,l_xml);
      -- Read response file
      resp := utl_http.get_response(req);
      -- Print out the response headers
      FOR i IN 1 .. utl_http.get_header_count(resp) LOOP
        utl_http.get_header(resp,i,header_name,header_value);
        logging_pkg.info(header_name || ': ' || header_value);
      END LOOP;
      -- Print out the response body
      BEGIN
        LOOP
          utl_http.read_text(resp,response_text);
          logging_pkg.info(response_text);
        END LOOP;
      EXCEPTION
        WHEN utl_http.end_of_body THEN
          logging_pkg.info('End of body');
      END;
      -- close http connection
      utl_http.end_response(resp);
      EXCEPTION
        WHEN utl_http.end_of_body THEN
          utl_http.end_response(resp);
    END;
    Cheers,
    Brent

    Hi Billy
    Yikes - how embarassing !  Thanks for pointing out my beginners mistake there.  I've fixed my code - and also implemented the substitutions of parameters like you suggested - I like that approach.
    Unfortunately the end result is no better - the line
    utl_http.read_text(resp,response_text);
    Still returns nothing back
    The headers that are coming back are
    Date: Thu, 04 Jul 2013 08:31:56 GMT
    Server: Apache/2.2.16 (Ubuntu)
    X-Powered-By: PHP/5.3.3-1ubuntu9.3
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Vary: Accept-Encoding
    Content-Length: 0
    Content-Type: text/html; charset=UTF-8
    Connection: close
    I guess I will need to try chasing it with the fastsms vendor so see if they can check my incoming request and see if there are any glaring problems. I know the xml is correct as I am now logging the xml string just before I send it and when I take that string and put it in their test form it works perfectly - something else in the puzzle is missing. I've had no experience using utl_http before - perhaps it's no possible to read the xml repsonse using this ?
    Anyway, thanks for your help Billy.
    ps - How do you paste your code into your message to get that formatting ?
    Cheers,
    Brent

  • How to use Yahoo Mail to send email using email links on webpages

    When I'm on a webpage that has a link to send an email, I cut and paste the the email address (which is the link) and paste it into my Yahoo Mail address bar. However, some webpages don't show the email address as a link. Instead, the link might be "write me" or "send mail", so I can't cut and paste an address.
    If I click on an email link, a window pops up that says "Welcome to Mail" and it states that the assistant will guide me through the steps to configure my email account. To get started, this assistant requires a password that I don't possess.
    So I'm stuck not being able to access an email application that I don't want to use in the first place.
    Is there a way to set up my computer so that I could click an email link on a webpage and have Yahoo Mail pop up?
    If not, is there at least a way to send an email using an email link that doesn't show the email address, without using (what I assume to be) the Apple mail Application? If it is necessary, how do I recover the password for the mail assistant? I'm not aware of ever having used or set up a password before.
    THANK YOU

    If you don't want Mail to open, don't click on the app.  If it's opening at login, right click its Dock icon>Option>de-select Open at Login.

  • How to add DTD syntax line into XML using java code

    Hi,
    I am building xml file with java, usiing document.createElement()
    and document.appendChild(element),
    like that
    now i need to add dtd file path and synatx in the top of the xml file,
    how can i do it through java code
    any body could help me
    i appreciate your help.
    thanks
    Durga

    Hi Suneetha,
    Thanks for your reply..
    Now i am getting docType in xml file but not in the format of what i want
    please look at my code
    i need
    <!DOCTYPE myRootElement SYSTEM "myXMLDTD.dtd" >
    but i am getting
    <!DOCTYPE myRootElement PUBLIC "" "myXMLDTD.dtd">
    There is change i need to get the SYSTEM in place of PUBLIC and i need to get rid of "" code between dtd and PUBLIC
    for this i am doing in my code as
    DocumentType theDocType = new DocumentImpl().createDocumentType ("SYSTEM","","myXMLDTD.dtd");
    Document theDoc = new DocumentImpl(theDocType);
    i dn't know what is the wrong ? i dn't know what are the parameters at what place to pass if you know any thing just let me know
    thanks in advance
    and i apperciate you help.
    Durga

  • Cannot send message using server icloud, cannot send message using server icloud

    Whenever I try to send a message from my iCloud mail id using Lions mail client I get the following
    The server “p08-smtp.mail.me.com” cannot be contacted on the default ports.
    Select a different outgoing mail server from the list below or click Try Later to leave the message in your Outbox until it can be sent.
    I saw an articale suggesting trying to change the SMTP server to SMTP.MAIL.ME.COM but when I try that I get address rejected
    Sending mail through the web interface seems to work OK
    Any ideas?

    I did some looking around and think I've got the right answer. if I use networktool to do a lookup of p08-smtp.mail.me.com it returns address not found.
    It looks like p01-smtp to p04-smtp are defined but the others aren't.
    I created a new smtp server and called it icloud2 and used the address p04-smtp.mail.me.com with the usual settings of USE SSL and AUthentication = Password (and gave it my iCLoud login details).
    Associating that SMTP server with my iCloud account in mail.app lets me send perfectly.
    I assume this is just apple not having everything not set up and replicated to DNS servers yet so I'm checking to see if p08 exists every couple of days and I'm move my iCLoud account to the normal SMTP server when I start getting nslookup responses.

  • My iMac receives files using airdrop but cannot send files using airdrop

    i have a macbook pro and imac both 2011 and using latest software. i can send files from macbook pre to imac no problem but cannot send files from imac to macbook pro using airdrop. also i have the same problem sending files between my samsung galaxy and imac. can send files to imac from samsung but cannot send from imac to samsung. obviously a setting on imac is the cause of both problems.... any help would be appreciated

    Are these photos? Then you will find them in the photos app. Pages documents? You will find them in Pages, etc.

  • How to send xml file from local folder to azure storage

    Hi,
    My plan is i have xml files which are under folders in my local.
    I want to use mobile service to send xml files to azure storage,
    how shall i do that, either by c# or mobile service.
    If internet stop, I will use my mobile service to transfer all xml files to azure storage and run web job to do to update azure
    sql by xml file.
    please advice.
    Superman

    Hi,
    You could refer the following link for assistance with uploading image files to Azure Blob Storage using Mobile Services:
    http://azure.microsoft.com/en-us/documentation/articles/mobile-services-windows-phone-upload-data-blob-storage/
    And for image files you could refer the following link:
    http://stackoverflow.com/questions/25977406/upload-a-text-file-with-azure-mobile-services
    Regards,
    Malar.

  • Sending XML with URLLoader

    I am at a loss.
    I am trying to send XML using a URLLoader
    when the request is sent via navigateToUrl i get the Post
    data
    but when using a Loader nothing.
    Any help is appreciated.

    Thanks for the replt ntsiii,
    Heres the urlloader code
    public function urltest(){
    var request:URLRequest = new URLRequest("
    http://localhost/mroi/testurl.php");
    var variables:* = <test>test</test>;
    request.method = URLRequestMethod.POST;
    request.contentType = "text/xml";
    request.data = <test>test</test>;
    var loader:URLLoader = new URLLoader();
    //loader.dataFormat = URLLoaderDataFormat.VARIABLES;
    //navigateToURL(request);
    loader.load(request);
    As I mentioned in my earlier post I receive the data when
    using the navigateToURL method but recieve nothing when using the
    URLLoader
    Any help is appreciated. I am at wits end

  • ME_PROCESS_PO_CUST: Method "POST"

    Hi all,
    I'm trying to update the 'EKPO', and I will use the BADI 'ME_PROCESS_PO_CUST'.
    When you click the 'SAVE' of purchase order, I want to update the 'EKPO-LGORT'. and I will try to use method 'POST'.But the method 'POST' has only 'IM_HEADER'.
    Now I don't know how to upate the EKPO-LGORT using method 'IM_HEADER' in 'POST'.
    Can someone help me!!
    By Soma

    Hai Tomoyuki,
    The PROCESS_ITEM method has only IMPORTING parameter, meaning that you cannot change the values in the IM_ITEM parameter.
    Use ls_mepoitem = im_item->get_data( ).
    and chage your item date. Please read the documentation you can change only some set of data at item level.
    Then use im_item->set_data( ).
    Also You can refer these links...
    ME_PROCESS_PO_CUST: Method "POST"
    Implementing BADI's ME_PROCESS_PO_CUST
    BADI ME_PROCESS_PO_CUST - FIELDSELECTION_ITEM
    Regards,
    Srikanth.

  • How to select email account for sending notifications

    I have three calendars (for example, C1, C2, C3). My Mail application has 3 email accounts (A1, A2, A3).
    How can I make the calendar send notifications using a selected email account?
    For example, I want all calendar email notifications to be sent using account A2.
    I'll appreciate your help.

    sd0084,
    If I change, all my emails would go out the selected account.
    Correct.
    I routinely use that method, which means that I must select a different account in the "New Message" window "From:" field when I choose to send mail from a different account.
    ;~)

  • How to test whether XI is sending file or not?

    Hi all!
    My scenario is like this:File(File sender Adapter)->XI->(HTTP receiver adapter)J2EE appl.
    I placed the xml file in D:\somedir on my PC. It is picking up the file, after picking it should post the same xml file to my j2ee appl. My servlet receives the xml file and display it on browser. But nothing is displayed. How to test whether XI is sending XML file to J2EE appl or not? All helpful answers are highly appreciated.
    Thanks!

    Hi
    In the file adapter i set processing mode as delete, it is picking up well from my d:\somedir.
    I got success flag in SXMB_MONI and successful status in RWB->message monitoring?
    Why my servlet is not able to display?
    All helpful answers are rewarded.
    public class DisplayRes extends HttpServlet {
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
                        doPost(request,response);
         public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
         BufferedReader brin =new BufferedReader(new InputStreamReader(request.getInputStream()));
         String inputLine;
         StringBuffer sBuf = new StringBuffer();
         while ((inputLine = brin.readLine()) != null)
             sBuf.append(inputLine);
             brin.close();
             PrintWriter out = response.getWriter();
             response.setContentType("text/xml");
             //out.setContentType("text/xml");
             //out.println(sBuf.toString());
             out.write(sBuf.toString());
             out.flush();
    Thanks

  • Merge LiveCycle Form with XML using JAVA

    Hello.
    I am trying to find out how to merge non-interactive form with XML (using JAVA) so the users can see the final output form with the data filled in.
    What are my choices..?
    So far, I have created the interactive forms as template using LiveCycle 8 and wrote ASP.NET code to extract data and store it in SQL database when the user fill out and submit the form.
    It works great but another agency wants to access the form as well.
    They told us that they will create the XML themselves from the database, so they just need to combine the form with XML to display it (non-interactive form).
    They want to use JAVA but I am not sure how to do that...
    Any suggestion?

    Assuming that you start with XML in an org.w3c.dom.Document that stores the XML data. Before you can merge it into a form, you have to convert it to a com.adobe.idp.Document object. TO convert a org.w3c.dom.Document to a com.adobe.idp.Document object -- use the following Java code:
    private Document convertDataSource(org.w3c.dom.Document myDOM)
    byte[] mybytes = null;
    try
    //Create a Java Transformer object
    TransformerFactory transFact = TransformerFactory.newInstance();
    Transformer transForm = transFact.newTransformer();
    //Create a Java ByteArrayOutputStream object
    ByteArrayOutputStream myOutStream = new ByteArrayOutputStream();
    //Create a Java Source object
    javax.xml.transform.dom.DOMSource myInput = new DOMSource(myDOM);
    //Create a Java Result object
    javax.xml.transform.stream.StreamResult myOutput = new StreamResult(myOutStream);
    //Populate the Java ByteArrayOutputStream object
    transForm.transform(myInput,myOutput);
    // Get the size of the ByteArrayOutputStream buffer
    int myByteSize = myOutStream.size();
    //Allocate myByteSize to the byte array
    mybytes = new byte[myByteSize];
    //Copy the content to the byte array
    mybytes = myOutStream.toByteArray();
    catch (Exception e) {
    System.out.println("The following exception occurred: "+e.getMessage());
    //Create a com.adobe.idp.Document object and copy the
    //contents of the byte array
    Document myDocument = new Document(mybytes);
    return myDocument;
    THen you can merge myDocument into the Form using renderPDFFOrm:
    FormsResult formOut = formsClient.renderPDFForm(
    formName, //formQuery
    myDocument, //inDataDoc
    pdfFormRenderSpec, //PDFFormRenderSpec
    uriValues, //urlSpec
    fileAttachments //attachments
    Hope this helps!

  • Sending texts using the mac to iphone address book

    Is there anything out there yet that allows you to use a widget to send texts using the mac OS out via the iphone and your network carrier. This would be great when you use the iphone in a dock to save removing it to text etc

    No - in the U.S. you can use iChat to send SMS from a Mac separate from the iPhone.

  • How to send te XML data using HTTPS post call & receiving response in ML

    ur present design does the HTTP post for XML data using PL/SQL stored procedure call to a Java program embedded in Oracle database as Oracle Java Stored procedure. The limitation with this is that we are able to do HTTP post; but with HTTPS post; we are not able to achieve because of certificates are not installed on Oracle database.
    we fiond that the certificates need to be installed on Oracle apps server; not on database server. As we have to go ultimately with HTTPS post in Production environment; we are planning to shift this part of program(sending XML through HTTPS post call & receiving response in middle layer-Apps server in this case).
    how i can do this plz give some solution

    If you can make the source app to an HTTP Post to the Oracle XML DB repository, and POST contains a schema based XML document you can use a trigger on the default table to validate the XML that is posted. The return message would need to be managed using a database trigger. You could raise an HTTP error which the source App would trap....

  • How to send XML file to https server using POST

    Hi, I am having an requirement, that I have to connect to https server and I have to pass an input XML file as a response server will give me output XML file.
    The certificate validation part is over, I am using FileInputStream to read the XML file and attaching this to connection.getOutputStream(); but server is throwing me DTD does n't match.
    Can any body tell me how to send XML file, I have to use any DOM parser to send the XML file, suggest me and give me sample code.
    Thanks,

    Can anybody give me the solution

Maybe you are looking for

  • Signature Tool is not working with version 11.2.3

    It appears that the signature pen does not work.  It even looks like it is not lit up.  This is just a test form created in Adobe Acrobat X Pro.  The signature does not work in other forms that worked with the prior version of Adobe reader for iOS. 

  • Problem while importing a web service model.

    Hi I am building a simple send email application using a web service. While creating a new model i am using following options. step 1 - Select "Import Adaptive web service model" step 2 - Select Wsdl Source 2.1 - Local file system or URL Step 3 - No

  • NULL partition key in RANGE partition

    All, This is regarding partitioning a table using RANGE partition method. But the partition key contains null. How do I handle this situation? This is because there is no DEFAULT partition in RANGE partition though its present in LIST partition. Will

  • Can't find file location.

    I recently transferred my iTunes to my laptop via the backup discs, which I thought worked well. When I tried to play some songs, iTunes told me that they couldn't be played because the original file couldn't be found. I first thought it was because

  • PowerBook G4 Start-up problem

    Start-up problem --- 1. When I recently ran OnyX, I was told to run the Apple's Disk Utility from the Start-up Disk. 2. However, before doing this, I ran the Disk Utility from the hard drive, but the program would not complete the "Repair" function.