HTTP POST Request with XML file in

Hi @ all,
I would like to send an HTTP Request with an XML File in the body to an SAP System
I have the target URL and the a XML File.
Now the question is. Is it possible to use something like the HTTP_POST FuBa to send an url post request with an xml file?
If yes can anybody give me a hint?
I have a php script which exactly do this coding. But to integrate it all in one system it is necessary to transform it into ABAP and call it there.
// compose url and request and call send function
function test($productID, $categoryID) {
     // create url
     $PIhost = "XXX.wdf.sap.corp";
     $PIport = "50080";
     $PIurl = "/sap/xi/adapter_plain";
     $PIurl .= "?sap-client=800";
     $PIurl .= "&service=XXX";
     $PIurl .= "&namespace=XXX";
     $PIurl .= "&interface=Frontend_Interface";
     $PIurl .= "&qos=EO";
     $PIurl .= "&sap-user=XXX";
     $PIurl .= "&sap-password=XXX";
     // create xml
     $request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
     $request .="<n1:FrontendInbound_MessageType xmlns:n1=\"http://crmpiebay.com\">\n";
     $request .= "\t<FrontendInbound>\n";
     $request .= "\t\t<ProductName/>\n";
     $request .= "\t\t<ProductCategory>".$categoryID."</ProductCategory>\n";
     $request .= "\t\t<ProductID>".$productID."</ProductID>\n";
     $request .= "\t\t<MessageID/>\n";
     $request .= "\t</FrontendInbound>\n";
     $request .= "</n1:FrontendInbound_MessageType>";
     // send http request
     postToHost($PIhost, $PIport, $PIurl, $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"]."/".$_SERVER["PHP_SELF"], $request);
// send post request to PI server
function postToHost($host, $port, $path, $referer, $data_to_send) {
  $fp = fsockopen($host, $port);
  if($fp) {
       $res="";
       fputs($fp, "POST $path HTTP/1.1\r\n");
       fputs($fp, "Host: $host\r\n");
       fputs($fp, "Referer: $referer\r\n");
       fputs($fp, "Content-type: text/plain\r\n");
       fputs($fp, "Content-length: ". strlen($data_to_send) ."\r\n");
       fputs($fp, "Connection: close\r\n\r\n");
       fputs($fp, $data_to_send);
       while(!feof($fp)) {
           $res .= fgets($fp, 128);
       fclose($fp);
       return $res;
Would be great if anybody could give me a hint how to solve such a HTTP Post request with XML body data.
Thanks in advance.
Chris
Edited by: Christian Kuehne on Feb 26, 2009 4:32 PM

hi friend could you please share your solution regarding this query if u got it already?

Similar Messages

  • POST http(s) request with xml content in Power Query

    I have a POST http request which works good in HttpRequester (Firefox plugin). I know that it is possible to call POST request in Power Query but cannot find working solution. Here is the original request:
    POST https://svcs.ebay.com/FeedbackService
    X-EBAY-SOA-OPERATION-NAME: createDSRSummaryByPeriod
    X-EBAY-SOA-SERVICE-VERSION: 1.0.0
    X-EBAY-SOA-SERVICE-NAME: FeedbackService
    X-EBAY-SOA-APP-NAME: ***
    X-EBAY-SOA-SITEID: 0
    X-EBAY-SOA-SECURITY-TOKEN: ***
    Content-Type: text/xml
    <?xml version="1.0" encoding="UTF-8"?>
    <createDSRSummaryByPeriodRequest xmlns="http://www.ebay.com/marketplace/services">
    <dateRange>
    <dateFrom>2013-12-01T00:00:00.000Z</dateFrom>
    <dateTo>2013-12-31T23:59:59.999Z</dateTo>
    </dateRange>
    <dateRangeEventType>ListingDate</dateRangeEventType>
    </createDSRSummaryByPeriodRequest>
    Power Query WebContent() function is capable to handle headers and xml content, however, there is no any documentation about its syntax.
    In Power Query I use this request:
    = Xml.Tables(Web.Contents(“https://svcs.ebay.com/FeedbackService”,
    [Headers =[" X-EBAY-SOA-OPERATION-NAME"= "createDSRSummaryByPeriod",
    "X-EBAY-SOA-SERVICE-VERSION="1.0.0",
    "X-EBAY-SOA-SERVICE-NAME"="FeedbackService",
    "X-EBAY-SOA-APP-NAME"="***","X-EBAY-SOA-SITEID"="0",
    "X-EBAY-SOA-SECURITY-TOKEN"="***"],
    Content=["<?xml version="1.0" encoding="UTF-8"?>
    <createDSRSummaryByPeriodRequest xmlns="http://www.ebay.com/marketplace/services">
    <dateRange>
    <dateFrom>2013-12-01T00:00:00.000Z</dateFrom>
    <dateTo>2013-12-31T23:59:59.999Z</dateTo>
    </dateRange>
    <dateRangeEventType>ListingDate</dateRangeEventType>
    </createDSRSummaryByPeriodRequest>"]]))
    However, it returns "Expression.SyntaxError: Invalid identifier." Maybe anyone has at least examples of analogous working syntax?

    Task is solved. First of all I updated PowerQuery since previous version does not support Headers option for Web.Contents function. Here is a correct syntax:
    =Xml.Document(Web.Contents("https://api.ebay.com/ws/api.dll",[Headers=[#"X-EBAY-API-COMPATIBILITY-LEVEL"= "871",#"X-EBAY-API-SITEID"="0",#"X-EBAY-API-CALL-NAME"="GetMyeBaySelling",#"CONTENT-TYPE"="text/xml"], Content=Text.ToBinary("<?xml version="&Character.FromNumber(34)&"1.0"&Character.FromNumber(34)&" encoding="&Character.FromNumber(34)&"utf-8"&Character.FromNumber(34)&"?>
    <GetMyeBaySellingRequest xmlns="&Character.FromNumber(34)&"urn:ebay:apis:eBLBaseComponents"&Character.FromNumber(34)&">
    <RequesterCredentials><eBayAuthToken>***</eBayAuthToken></RequesterCredentials><SoldList><DurationInDays>60</DurationInDays><Pagination><EntriesPerPage>100</EntriesPerPage><PageNumber>1</PageNumber></Pagination></SoldList></GetMyeBaySellingRequest>")]))

  • Is it possible for ODi to do a "https post" of an xml file?

    Hi,
    We would like to use ODI to read from a VIEW and within ODI transform to a target using an XSD to generate an XML file and then do a HTTPS POST. Would be grateful for any pointers.
    we also ran into issues while transforming using a target xsd. Listed below:
    Use Case Context: In an ODI interface, Data from a database view is mapped to a target XSD schema. A package is then created, wherein, in the first step, this interface is executed. Then, in the second and final step, data transferred to the target XSD schema is saved as an XML file using OdiSqlUnload function.
    Problems faced in the above mentioned use case:
    When the data from the target XSD schema is saved as an XML file using OdiSqlUnload function, the XML does not match the XSD, which was initially imported into ODI.
    Regards
    Shema

    Ask them!  Product Feedback
    This is a user to user forum.  We are all end users like yourself.  Know one here knows what Apple is going to do.

  • How to insert document into xmltype column through an http post request with perl

    Oracle 11.2.0.3
    Windows server 2008r2
    Apache tomcat 7.0
    Oracle APEX 4.2.1
    Oracle APEX Listener 2.0
    I would like to insert a XML document into the database through an APEX restful web service. The POST into the web service in done with PERL. The following code will insert an empty record in a table with column of XMLType type.
    Perl Code
    use strict;
    use warnings;
    use LWP::UserAgent;
    use HTTP:Headers;
    my $headers = HTTP::Headers->new();
    my $url = "http://host:port:apex/<application_workspace>/<restfull service module>/<uri template>/
    my $sendthis = ('<?xml version="1.0" enconding="utf-8"?>
    <students>
    <row>
           <name>Mark</name>
          <age>30</age>
    </row>
    <./students>';)
    $headers -> header('Content-Type' => 'text/xml; charset=utf-8');
    my $request = HTTP:Request->new('POST', $url, $headers, $sendthis);
    $request-> protocol('HTTP/1.1');
    my $browser = LWP::UserAgent->new();
    my $response = $browser->request($request);
    my $gotthis= $response->content();
    my $the_file_data = $response->content();
    APEX restful service
    Method: POST
    Source type: PL/SQL
    MIME Types allowed: blank
    require secure access: none
    source:
    {declare
    doc varchar2(32000);
    begin
    insert into table <column name>
    values(doc);
    commit;
    end;
    Table code
    { create table <tablename>
    (column name XMLType>);
    The above code will insert an empty column into the table.
    Any ideas why?

    It's a really bad idea to assemble XML using strings and string concatenation in SQL or PL/SQL. First there is a 4K limit in SQL, and 32K limit in PL/SQL, which means you end up constructing the XML in chunks, adding uneccessary complications. 2nd you cannot confirm the XML is valid or well formed using external tools.
    IMHO it makes much more sense to keep the XML content seperated from the SQL / PL/SQL code
    When the XML can be stored a File System accessable from the database, The files can be loaded into the database using mechansims like BFILE.
    In cases where the XML must be staged on a remote file system, the files can be loaded into the database using FTP or HTTP and in cases where this is not an option, SQLLDR.
    -Mark

  • Retrieve data/files fro HTTP POST request in On-Demand process

    Hello,
    I would like to integrate https://github.com/blueimp/jQuery-File-Upload to my APEX 4.2 application inside XE11g. I would like to use this kind of jQuery component, multiple file upload, use Drag & Drop, image resize, size limit, filter extensions etc...
    This jQuery component and also others javascript uploaders sends data files to some defined URL. Developer need to build some servlet, php script or something on server side that will read files from HTTP request and stores it somewhere.
    Do you know how to do it in APEX? How can I read data from HTTP POST request in PL/SQL? Now I can only call my On-Demand application process from javascript, but I am not able to read any data from HTTP POST in it.
    Can I do it in APEX, or using MOD_PLSQL?
    I would like to implement this:
    1) some javascript uploader will call some URL of my application and sends HTTP POST with data files
    2) I will read data files from HTTP POST and store them into database
    3) I will create some HTTP response for javascript uploader
    Thank you for some tips

    I know about that existing plugin " Item Plugin - Multiple File Upload"
    But I doesn't work in IE and has only basic features. Licence for commercial use is also needed. I would like to use some existing jQuery plugin. There are many of these plugins with nice features. And only one problem is that I need to create some server side process/servlet/script.. that can recieve HTTP request, get files from it and stores them into DB.

  • Query regarding sending XML over HTTP Post request

    Hello,
    I am trying to send XML data from a server to client via HTTP Post request
    And vice versa � receive the data by a client
    Assume that the xml data looks something like
    <?xml+version="1.0"?>
    So my post query will look like
    http://<IP Address>:<port>/
    POST /MessageReceiver.jsp HTTP/1.0
    Host: www.SomeHost.net
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 38
    %3C%3Fxml%2Bversion%3D%221.0%22%3F%3E+
    This information will be received by the client and converted back to xml data.
    My query is - is there some library/open-source stuff that
    does the process of transcoding the entity's non-ASCII characters
    at the server side
    and decoding the URL back to human-readable form at the client side?
    i.e. I need a simple mechanism to convert
    <?xml+version="1.0"?>
    to
    %3C%3Fxml%2Bversion%3D%221.0%22%3F%3E+
    at the server side, while sending data
    and do the opposite at the client side to get the xml back.
    Also could some one confirm if JTidy is a right tool to check if the xml is well-formed?
    Or is there any other standard tool that checks for well-formed properties of xml?
    regards,
    Deepak.

    java.net.URLEncoder / URLDecoder?
    Also could some one confirm if JTidy is a right tool to check if the xml is well-formed?No, it's for parsing HTML. An XML parser is checking for well-formedness in any case.

  • Oracle reports problem in distribution with xml file

    Hi ,
    I am having problem while I am trying to distribute the file with specifing the destination details in the xml. If I am giving the destination details in url then it is working.
    Ex.
    This is Working
    http://bryxh91:8889/reports/rwservlet?report=devlopersuit/reports/test.jsp&userid=anju/[email protected]&desformat=pdf&destype=file&desname=devlopersuit/reports/output_file.pdf
    Not working :
    http://bryxh91:8889/reports/rwservlet?report=devlopersuit/reports/test.jsp&userid=anju/[email protected]&DISTRIBUTE=YES&destination=devlopersuit/reports/dis_test.xml
    xml file
    <destinations>
    <file id="test" name="output_file.pdf" format="pdf">
    <include scr="mainSection"/>
    </file>
    </destinations>
    Error : REP-34304: Distribution failed to complete; review the distribution lists
    Its been week I tried many things , but not working.
    Right now I am trying to distribute to single file but my goal is to burst and distribute on basis of account number.
    This is the first stage of the project.
    Thanks a lot for the help
    Anju

    Hello
    see answer in Oracle reports problem in distribution with xml file
    Regards

  • Connect interface with XML File in jdeveloper

    Hello;
    i want to design a webservice that take an employee ID , and return all employee's data (like his name ,departement, phone,email....)
    i want to make interface and connect it with XML file wich has all employees data
    how can i connect the interface ( input text box and output button) with XML file (taking the Id and searching inside the file and getting the data out in table as output)
    i want to deploy it to get the WSDL file and URL to deploy it at application server to use it in webcenter>>>

    up 2 find an answer
    i want the right way to do it?

  • Problem when load more swf files work with xml files into my movie

    hi ;
    I have one flash file & more of swf files which work with xml files .
    when I load one swf file into my flash file  and remove it and load anther one on the same movieclip in my flash file it load the old swf file.
    when i load one on movieclip and remove it and load anther swf  on anther movieclip the file doesn`t work  and stoped.
    when test my flash file to load and remove swf files without xml file it work fine but when repleaced the swf files with other work with xml files the problem hapend.
    thanks;

    YOu should trace the names of the files that are being targeted for loading to see if they agree with what you expect.  If you want help with the coding you will need to show the code that is relevant to your problem (not all of it)

  • .tmp files genrated along with XML files

    Hi all,
    Here my Interfaces are type of RFC- XI - FTP.
    these are running successfully past long time and creating XML files in the target directory of FTP aplication system. Along with XML files this time abnormally .tmp files were generated in the Target directory of FTP application system. This was occured only one time few days back.
    The generated XML files in target FTP system as usually read by Application system and processed in the sytem.
    And tmp files generated are as XI_ftp_XI_ftp_0c200300-704c.tmp
    could you all please let me know what could be the reason for happening this like generation of .tmp files abnoramally in Target FTP application system.
    Thanks in advance...
    Regards,
    Siva

    Hi, thanks for reply.
    The Write mode is "Use temporary file"
    But we have not got these .tmp files earlier and we have not mentioned any temporary file name sceme too.
    Could any body please explain will .tmp files are generated randomly?
    If i keep 'Directly' mode, will it keeps only the XML files in target directory?
    Please advise.
    Thanks,
    Siva

  • Can you make a HTTP GET request with JSC form element?

    It seems the form element in JSC make a HTTP POST request by default, but is it possible to make a HTTP GET request by the form element in JSC?
    (It is worth to mention here that HTTP GET request has its distinctive advantages like you can embed the parameters in a URL and bookmark it)
    Thank you very much.

    Jim,
    I am doing the sameway as you suggested to MISS_DUKE
    But have you face any problems in doing so? In otherwords its the page rendering correctly?
    On requesting the same page multiple times, Every time I get the page that was rendered for the first time.
    To see the correct results, I need to close the browser and check it .
    see my previous queries here
    http://swforum.sun.com/jive/thread.jspa?threadID=54379&messageID=208223#208223
    http://swforum.sun.com/jive/thread.jspa?threadID=56440&messageID=214302#214302
    http://swforum.sun.com/jive/thread.jspa?threadID=56676&messageID=214987#214987
    http://swforum.sun.com/jive/thread.jspa?threadID=56390&messageID=214139#214139
    And I am still expecting the answer from experts. But nobody turn arround
    Thanks,
    Sudhakar

  • Extract Portal User Name From HTTP POST Request (WSRP SOAP)

    How can we extract the user name from the HTTP POST Request (*WSRP SOAP*) from the Portal to the Portlet Provider (Producer)?
    We are load balancing between the Portal (10.1.14.2) and the providers (OC4J 10.1.3.3) and would like to extract the user name within the load balancer so we can create session affinity based on it.
    BTW, we already tried using TCP Flow but were unable to see the user name.

    From the documentation, it seems that you need to use
    HttpURLConnection.setRequestMethod("POST"); // "GET" is the defaultalthough I have seen examples on the web without it.
    Try!
    Edit: Also the single quotes around userid and password may be a problem.
    Use the previous poster suggestion, but do not include the single quotes.
    Edited by: baftos on Aug 6, 2008 4:27 PM

  • Query regarding encoding/decoding of XML over HTTP Post request

    Hello,
    I am working on a project where I need to put SMS inside XML and
    eventually transfer this XML via HTTP post from/to server/client.
    Assuming the SMS to be 7-bit text the XML may look something like
    <?xml+version="1.0"?>
    <SMS
    TESTMESSAGE
    </SMS>
    This XML when encoded in a HTML post may look something like
    http://<IP Address>:<port>/
    POST /MessageReceiver.jsp HTTP/1.0
    Host: www.SomeHost.net
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 90
    xmlMsg=%3C%3Fxml+version%3D%221.0%22%3F%3E%0D%0A%3CSMS%0D%0A%09TESTMESSAGE0D%0A%3C%2FSMS%3E
    This xml is UTF-8 (7-bit ASCII) by default since no encoding format has been specified.
    My question - how will the encoding of xml change to - when 8 bit binary data
    is transferred via xml.
    for e.g.
    <?xml+version="1.0"?>
    <SMS
    <!!!!!BINARY DATA!!!!!>
    </SMS>
    for such a file how/what shld the encoding be set to.
    Further my spec-states the following.
    "The content of the XML must respect the encoding. Thus a SMS
    containing typically french characters must use ISO-8859-1 encoding"
    "This code needs to work with both UTF-8 and UTF-16 standards (ASCII and Unicode). Because of this the parsing code should work internally with UTF-16 and translate up/down to/from UTF-8 (ASCII) only when dealing with the basic HTTP."
    could anyone clarify this for me.

    The first thing you need to do is clear up some fundamental misconceptions about character encodings. UTF-8 is not the same thing as "7-bit ASCII", and UTF-16 is not the same as "Unicode". Anyway, you're making this a lot more difficult than it needs to be. Just use UTF-8 to encode and decode all messages; it can handle all the characters from any language you're likely to run into.

  • Using live HTTP header get This XML file does not appear to have any style information associated with it. The document tree is shown below

    Im using ReloadEvery 3.6.3 & Live HTTP Headers 0.16 plugin's for playin mobsters on myspace. After capturing the the script, editing & placing in the address bar I recieve a message: Failed Security. This XML file does not appear to have any style information associated with it. The document tree is shown below. There was nothing on the Tree. I know the script was edited correct cause it works on the other PC's. Operating system is win7 & Firefox is current. Thx.
    == The first time

    yea I got the same error for playing files on filestube and its just not that, ever since 2 days ago when I updated firefox everything have just started to ..uck up all the time, high cpu memory load without any addons and it wont terminate for another 20secs after I close it... I think I'll just reinstall with an older version, everything worked just fine then

  • How to get HTTP Post body with text/xml

    There is a HTTP Post like this from a client:
    POST http://local:8080/test HTTP/1.1
    Content-Type: text/xml
    Content-Length: 210
    <?xml version="1.0" encoding="UTF-8"?>
    <CancelOrders>
    <Cancel>
    <ItemID>898980</ItemID>
    <UserName>REM</UserName>
    <DateTime>11/10/2003 06:33:33</DateTime>
    </Cancel>
    </CancelOrders>
    I need to get the content of the xml through servlet.
    What can I do?
    Please help

    Can you put some Duke points here, you might get a response sooner.

Maybe you are looking for