Modifying HTTPService Header Values

I am currently developing a system that uses a REST web service which determines the type to return based on the clients Accept header.  When working from FLEX I have been unable to modify this header value to appropriately indicate to the REST service that the format I am accepting is json and instead always get XML back.  What is the appropriate way in FLEX to set the Accept header on an HTTPService in Flex?

Bummer, that looks like a "known issue":
http://verveguy.blogspot.com/2008/07/truth-about-flex-httpservice.html
https://bugs.adobe.com/jira/browse/SDK-11401
Possible alternatives?
http://github.com/gabriel/as3httpclient/tree/master
Ben Edwards

Similar Messages

  • ??? Using JSPs to Send Not-Modified-Since Header ???

    Hi all,
    In looking at past posts, I'm afraid I know the horrible answer
    to this issue but I thought I'd ask just in case I missed
    anything.
    Let me start by saying I'm using Tomcat v4.0.4 beta 3.
    As you know, when a client (usually a web browser) has a cached
    version of a resource (usually a web page) it can send an
    "If-Modified-Since" header to the HTTP server. The server
    compares the time/date stamp specified in the header with that of
    the requested resource. If the resource has not been modified
    since the time specified in the "If-Modified-Since" header, the
    server sends back a 304 (Not-Modified) response, effectively
    telling the client (usually a web browser) that its cached
    version of the resource is still valid.
    When writing a servlet, it's easy to handle this sort of
    scenario. The javax.servlet.http.HttpServlet class has a
    "service()" method. This method first checks if the incoming HTTP
    method is a GET. If it is, the "service()" method proceeds to
    call the "getLastModified()" method of the servlet. As a
    developer, you can override "getLastModified()" to return a long
    value representing the last time the requested resource was
    changed. Depending on the value returned by "getLastModified()"
    (note that -1 is returned if you don't override the method) the
    "service()" method may simply return a 304, Not-Modified response
    rather than calling the servlet's "doGet()" method.
    Now, the $18.32 Question: How do you ensure "getLastModified()"
    is called in JSP?
    No, you cannot simply do this:
    <%!
       public long getLastModified() {
          return xxx;
    %>The problem is that the above method will never be called by the
    container.
    I traced through some of the Tomcat/Catalina/Jasper code and it
    seems to me that the response code is being set to 200/OK very
    early on in the processing.
    I also took a cursory look at the JSP spec and didn't find any
    indication of setting a "Not-Modified" response code...so, I am
    thinking this is something that is (strangely) missing in the JSP
    specification. I have a JSP page that needs to update itself once
    per day. Therefore, it would be very handy to have the
    "getLastModified()" functionality enjoyed by servlet writers.
    Can anyone confirm this?
    Thanks...

    I've not come across this before, but like you I cannot find any mention of how to handle modification dates in the JSP spec. I can think of a couple of possible ways round this:
    1. Try to delegate the functionality to a servlet. You'd need to pass the JSPs modification date and handle the return. Seems messy and I haven't tried it.
    2. Add code to the JSP to read the headers directly and set the appropriate status code. e.g. at start of JSP:
    <%@page  import="java.util.*" %>
    <%
    if (request.getMethod().equals("GET")) {
       GregorianCalendar lastModified = new GregorianCalendar(2002, 01, 01); // use constant for testing
       response.setDateHeader("Last-Modified", lastModified.getTimeInMillis());  //always set header
       long modifiedSince = -1;
       try {
          modifiedSince = request.getDateHeader("If-Modified-Since");
       } catch (IllegalArgumentException iae) {
            // System.out.println(iae);
       if (modifiedSince != -1 && modifiedSince > lastModified.getTimeInMillis()) {     
          response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
          return;
    %>This would probably best be implemented as a custom tag if needed in more than one page.

  • Header value in data table can be fetched from managed bean.

    hi
    My requirement is to display a report in which column headers are also retrieved from data base, it cannot be hardcoded.
    instead of My Column it should come from managed bean
    <f:facet name="header">
    <h:outputText value="My Column"/>
    </f:facet>
    I am not able to fetch the header value from the managed bean.
    I tried
    <f:facet name="header">
    <h:outputText value="#{character.name}"/>
    </f:facet>
    but failed.
    Is there any way i can fetch these values at run time.

    Is that bean the main bean or the row object? It should be the main bean. There is only one column per table, its value is not to be derived from the row object.

  • Get Custom SOAP Header Value in SOA Suite 11.1.1.6 using BPEL 1.1

    Hi Experts,
    We are using SOA Suite 11.1.1.6 and in one of the projects we have requirement to retrieve custom SOAP header value.
    This is enhancement to existing process which is developed using BPEL 1.1 and deployed to Production. So we cannot convert this now to BPEL 2.0
    We suggested to use custom XML element in Header the definition of which will be defined in custom XSD and stored in common location. However the 3rd party who are invoking this service will not be able to do any customization in their process to pass custom XML header.
    Please can you help me in providing any approach through which we can retrieve custom Header value from SOAP header using BPEL 1.1
    I have read some blogs for retrieving the custom XML header but they are using BPEL 2.0. I would like achieve this functionality using BPEL 1.1
    Appreciate your inputs.
    Thanks in Advance - RK

    Hello RK,
    Have you've tried to put the bpex:outputHeaderVariable on the invoke activity of the invoked service.
    <invoke name="Invoke"
                bpelx:outputHeaderVariable="HeaderVariable"/>
    Where the "HeaderVariable" reflects the XSD Datastructure of the received header.
    This is also specified here in section 6.19.1 How to Receive SOAP Headers in BPEL
    Please note that the exact header must be specified in the WSDL of the invoked service.
    Also note that in case of a soap fault. No header will be returned from the invoked service but only a /soap/body/fault part.
    Good luck!
    Melvin

  • How to show header value in each page same as Page field value.

    Hi there
    It would be very helpful if anyone could tell us how to set header value based on the page field.
    To make it more clear.. i have a field in my Rtf (which is basically a group by) so in each page it'll differ.. My Header should reflect the same as field value.
    what my understanding is header wont change for each page. but ,my requirement is something like i have to show the header which is same as one of my filed value..
    for eg:
    HEADER: ABC page-1
    Field - ABC
    HEADER:XYZ page-2
    Field - XYZ
    Regards - Vijay
    Edited by: Vijay Santhanam on 23-Oct-2008 3:51 PM

    Hi Haiye ,
    The Pointer you gave would keep Header ABC through out all the pages in report right, actually i had tried this and got same header for all pages,
    but what i need is my first page Header should be based on one of the field of Page 1, second pge Header again based on the same field, but the value may differ... (coz the page field is group by ).
    Would appreciate your help on this issue!!
    Regards - Vijay

  • How to bring the Header value to the row ?

    Dear All,
    I am a starter in learning SDK. have developed a form having 2 tables a header and a row detailed one.
    Now i need to update a field in all the row with a header value when the header value is added. it should be like the SE name getting updated when the SE name is selected in header level in std doc.
    how to arrive it?
    kindly help me to achieve this.
    Thanks,
    Sam.

    Dear Gordon,
    May the customer enters a value to the header which they want it to be unique value for all the row detail.
    If there exists more than 50 rows they cant enter it for each and every row, for in case if the value needed to be changed for a particular row or for particular few rows they will change it manually to that row alone.
    I just want to achieve this scenario in my form.
    Do you know how to bring in ?
    As this is being a normal functionality in Std forms.
    Thank you...

  • How to display modified condition base value in Pricing Procedure?

    Hi everyone:
    I used a formula to change the condition base value (via the VOFM transaction) of various price conditions that are assigned to the same material. In this way, I can distribute the total quantity of the item line in smaller quantities for each price condition.
    Now the problem is that in the conditions tab of the sales order, I can not see the Condition Base Value of each Price Condition, and that's a little confusing.
    Did Anyone know's a way to show the modified Condition Base Value in the Pricing Procedure of the Condition Tab?
    Thanks a lot,
    Ginno Giuffra

    Thanks JJ:
    Yes,  I can found the modified base value in the condition details, but I still need to show it in the Pricing Procedure scheme.
    It is curious that the table options does not allow you to add that field to the escheme.
    Does anyone knows a user exit wich can modifye the table?
    Thanks again,
    Ginno Giuffra

  • SMP 3.0: how to handle header values in the SOAP WS using Integration Gateway

    Hi Experts,
    We have a requirement from our current customer where they are providing us a SOAP WS.For one of the method we are passing “username” & “password” as input parameters and getting one security key (some unique number) in the response. We are able to do OData modeling for the same method. So far, it is fine.
    For other method, we have to pass that ”security key” in header along with some other parameters in the body section. While doing the request mapping for this method, we don’t see any option for this key parameter apart from those parameters (in that body section).
    We found one publicly available WSDL to reproduce the same scenario:
    e.g http://api.geosvc.com/services/soap?wsdl . To access its one of the method/operation GetPlace,We have to pass APiKey and Cursor value in the header section.
    <wsdl:message name="GetPlaceRq_Headers">
    <wsdl:part name="ApiKey" element="tns:ApiKey"/>
    <wsdl:part name="Cursor" element="tns:Cursor"/>
    To get APiKey, we have to register first. http://www.geosvc.com/register , once its done, you will get one APiKey as below:
    The same API key has to pass to access “GetPlace” method. So we tried it in SOAP UI to understand how exactly it should work:
    As you can see below, for the method “GetPlace”, we are passing values as in:
    Header Value
    Cursor
    blank
    ApiKey
    df7f8cc90e3345b4980cf6631f33a32d
    Body
    Country
    US
    Place
    HOLLYWOOD,CA
    Also got the response.
    When we do modeling (more precisely request mapping as below) for the same method we don’t see any Header related parameters. We can see only parameters which are available in the BODY section.
    We thought if we can get APIKey parameter in the body sections only, then it would be easy to map with. Right?
    What do you suggest how we should handle this kind of scenarios?
    CC: Mustafa Saglam, Jeff Gebo, Bjoern Woppmann
    Regards,
    JK

    Unfortunately the public example is a slightly different use case.  You have to register to get a static API key that is used in all calls.  That is something you would hard code into the headers.
    I think you are asking about a dynamic key they changes on each login.  It would be great if we had a public one that upon login returned a unique session key to be used in subsequent calls so we could better test and model accordingly.
    If you were using Agentry the answer would be yes you can do this.
    --Bill

  • Safari seems not sending If-Modified-Since header for main address

    Not sure I'm in the appropriate forum but let's try (if there is more appropriate one please advise).
    When Safari requests a resource (page, image...) to a web server it doesn't provide If-Modified-Since header for the main resource of the request. That means the web server can't answer "resource not modified, use your cache". This is not the behavior of other browsers and not good in terms of performance for the web server as well as for the user.
    However Safari sends this If-Modified-Since for the sub-elements of the resource (e.g. images, css in a page...). Which is good.
    Is there a way to influence Safari's behavior to provide a If-Modified-Since for the main resource requested to the server?
    acama,

    Found out the answer.  IIS 6 does in fact steal "If-Modified-Since" and "If-None-Match" headers, but only on custom 404 redirects.  That's actually what I'm doing here (that'll teach me not to put details in a question when I think they're irrelevant -- actually I just forgot).
    Here's two discussions on the issue (they're using ASP, but apparently it's the same for ColdFusion):
    http://www.eggheadcafe.com/conversation.aspx?messageid=32839787&threadid=32839787
    http://www.webmasterworld.com/microsoft_asp_net/3935439.htm

  • How to see Header values are passed as a part of a Message in BPEL Invoke

    Hi,
    I have passed some session id in the header of a invoke message.
    In Audit trail I am not able to see those header values, its only showing the body of the request passed.
    Is there any way I can see passed Header values also ?
    Regards,
    En

    Refer the below URL for details about seeing the full SOAP message in 11g.
    http://www.albinsblog.com/2012/10/getting-soap-envelope-of.html#.UUrX7TceBBE
    Mark the posting appropriately as "helpful" or "correct answer", if your issue is solved.
    Regards
    Albin I
    [http://www.albinsblog.com/]

  • Customer Invoice Header Value Problem

    Hi Expert,
    I have configured Customer Invoice App and it is working fine. But in header value is coming Zero. I couldn't able to under stand what value is passing here, tried changing cost, Accounting value but still it is coming zero. I am attaching the screen shot.
    Any one please help me to get ride of this issue.
    Regards
    Niladri

    Hello Niladri ,
    I am also facing same issue .  Did you get any solution????
    Can any one please help ???
    Regards,
    Akshay

  • Modify form field value

    I have the PDF form with several fields. I want to set the value of one field depending on selection made by the user in other field. I am trying to use if statement but it does not work for me. I have copied below the script I am trying to use.
    form1.#pageSet[0].Page1.Table.Table3[0].Row1.Cell1::change - (JavaScript, client)
    if (oField.rawValue == "Service Alert")
       this.resolveNode("Cell4").rawValue = "A";
    else if (oField.rawValue == "Service Bulletin")
       this.resolveNode("Cell4").rawValue = "B";
    When user selects Service Alert in Cell1 I want the value of Cell4 to be set to A and if Service Bulletin is selected I want the value of Cell4 to be set to B.
    Can someone help me with the script. I have done a bit of searching and tested verious syntax but nothing did work. I hope someone will help me to have it working.
    Regards,
    Tony

    Thank you very much for your help, but it did not work for me. I have decided to reply and to send you the form. Could you please have a look on what I have done and try to fix it. I want to add action to Cell1 to modify Cell4 in row 1 of the form, top on the blue background.
    Regards,
    Tony Pluta
    Engineering Technical Coordinator / Graphics Designer, Engineering
    Rail
    Description: C:\Users\tony.pluta\AppData\Roaming\Microsoft\Signatures\UGLLimited.gif
    16 Broadmeadow Rd | Broadmeadow NSW 2292 | Australia
    Direct: +61 2 9492 1277  | Mobile: +61 403 399 167
    Fax: +61 2 9462 1383
    Email: [email protected]
    Web: www.ugllimited.com<http://www.ugllimited.com/>
    Please consider our environment footprint before printing this e-mail
    From: kvdvijaykumar [email protected]
    Sent: Wednesday, 29 May 2013 4:14 PM
    To: Tony Pluta
    Subject: modify form field value
    Re: modify form field value
    created by kvdvijaykumar<http://forums.adobe.com/people/kvdvijaykumar> in LiveCycle Designer - View the full discussion<http://forums.adobe.com/message/5360639#5360639

  • How to change 'Modified By' column value when a new file is uploaded in SharePoint 2013 using Client Object Model?

    I want to change 'Modified By' column value of a file that is being uploaded using Client Object Model in SharePoint 2013. The problem is that the version of the file is changing. Kindly help me. The code that I am using is:
    using (System.IO.Stream fileStream = System.IO.File.OpenRead(m_strFilePath))
        Microsoft.SharePoint.Client.File.SaveBinaryDirect(m_clientContext, str_URLOfFile, fileStream, true);
        Microsoft.SharePoint.Client.File fileUploaded = m_List.RootFolder.Files.GetByUrl(str_URLOfFile);
        m_clientContext.Load(fileUploaded);
        m_clientContext.ExecuteQuery();
        User user1 = m_Web.EnsureUser("User1");
        User user2 = m_Web.EnsureUser("User2");
        ListItem item = fileUploaded.ListItemAllFields;
        fileUploaded.CheckOut();
        item["UserDefinedColumn"] = "UserDefinedValue1";
        item["Title"] = "UserDefinedValue2";
        item["Editor"] = user1;
        item["Author"] = user2;
        item.Update();
        fileUploaded.CheckIn(string.Empty, CheckinType.OverwriteCheckIn);
        m_clientContext.ExecuteQuery();

    Hi talib2608,
    Chris is correct for this issue, when calling update using ListItem.update method, it will increase item versions, using SystemUpdate and UpdateOverwriteVersion will update the list item overwrite version.
    these two methods are not available in CSOM/REST, only server object model is available for this.
    Thanks,
    Qiao Wei
    TechNet Community Support

  • Call HEADER value into ITEM level in mapping

    HI,
    my structure is as below:
    H
    I
    I
    I
    P
    H
    I
    I
    P
    P
    H
    I
    I
    I
    I
    I
    P
    I have created a sequence in DB and retriving the value from DB using lookup for the header level(H) for feild ID.by using the code:
       //write your code here
       //write your code here
    String Query = " ";
    Channel channel = null;
    DataBaseAccessor accessor = null;
    DataBaseResult resultSet = null;
    try{
                    //container.getTrace().addWarning("Obtaining channel");
                    channel = LookupService.getChannel( businessSystem, communicationChannel);
                    //container.getTrace().addWarning("Channel OK");
                    //Get a system accessor for the channel. As the call is being made to an DB, an DatabaseAccessor is obtained.
                    accessor = LookupService.getDataBaseAccessor(channel);
                    //container.getTrace().addWarning("Accessor OK");
                    //Execute Query and get the values in resultset
                    resultSet = accessor.execute(" SELECT ID.NEXTVAL FROM DUAL");
                    //container.getTrace().addWarning("SELECT OK");
                    //String[] cols = resultSet.getMetaData().getColumnNames();
                    //for (int i=0; i<cols.length; i++){
                    //            container.getTrace().addWarning("Column name: " + cols<i>);
                    for(Iterator rows = resultSet.getRows();rows.hasNext();){
                                    //container.getTrace().addWarning("Result has rows");
                                    Map rowMap = (Map)rows.next();
                                    //container.getTrace().addWarning("Trying to get NEXTVAL");
                                    //Object obj = rowMap.get("NEXTVAL");
                                    //container.getTrace().addWarning("Data received " + obj);
                                    //return obj.toString();
                                    return rowMap.get("NEXTVAL").toString();
                                    //return ((String)rowMap.get("NEXTVAL"));
                    //container.getTrace().addWarning("Result has no rows");
                    throw new RuntimeException("Cannot obtain next service repair ID");
                    //return "-1";
    } catch(Exception ex){
                    container.getTrace().addWarning("Exception " + ex.getMessage());
                    throw new RuntimeException("Cannot obtain next service repair ID", ex);
                    //return "-1";
    finally {
                    try {
                                    if (accessor!=null) accessor.close();
                    catch(Exception e){
                                    container.getTrace().addWarning("Cannot close DataBaseAccessor for service " + businessSystem +
                                                                                    " and comm channel " + communicationChannel + " in getNextID user defined funcion");
    now my requirement is i have my to call the same value of ID feild into ID of I.to represent perticular I is related to so and so Header(H).
    Please suggest me how i can call the value to which is passing to ID(targetfeild) of H and map to ID(targetfeild) of I.
    please provide me UDF code....
    thanks in advance,
    Naveen.

    Use standard function UseOneAsMany (found under NodeFunctions) to populate the Header-value for each of the corresponding Item-segments.
    Input 1 - your header-fields as resulted from DB-lookup
    Input 2 - Item-segment
    Input 3 - Item-segment
    Make sure to set the context for Input 1 so that there are equal number of contexts in Input 1 as 2 & 3.
    -Kenneth

  • Modified x-axis values?

    Measurement is made using a sampling frequency of 100 Hz. And now, when I read the file in LabVIEW, the x-axis values are hundred times greater than the actual time. How do I get the modified x-axis values hundred times smaller.

    It would definitely help to see some example code and data.
    My gut feeling is that you're wiring an array of Y values to a waveform graph, e.g. 10, 5, 11, 12, 5, 3. The waveform graph, given an array of values, will plot the data against an x axis of sample number, so your data will appear at an interval of 1.
    If you have a sampling period (dt) value, you can use Build Waveform with your Y array and the dt component, and then feed this waveform to the waveform graph. Alternatively, you could build an array of time values of the same length as your dataset, bundle into a cluster and send to an XY graph. Examples are below:
    CLD

Maybe you are looking for

  • Draw a picture from a XML file

    Hi, the problem I have is the following. We have a UI (JNET) where you can create a data model which later on will be analyzied for data conistency. All details of the data model are stored in an XML file. To document what we did we need to create a

  • Creative Cloud Crashes When I Plug In a USB Drive

    My problem is that Adobe Creative Cloud application crashes every time I plug in a USB drive.  My computer is Windows 7 64-bit.  A brief history: 1.  I signed up for Creative Cloud and started to download and install the Creative Cloud desktop applic

  • Blanket Purchase Order and the Framework Order

    hi Gurus, I wanted to know the following. What is the difference between Blanket Purchase Order and the Framework Order. Thanks.

  • Calling process flow / mapping from comand line on client machine?

    Looking to call a process flow / mapping from a commad line on the client machine. Online research has found some attempts at it, but nothing solid. I'd like to test this functionality so that I can eventually build these calls into a wrapper used by

  • I had problem with h:inputext Events

    <h:inputText id="textId" autocomplete="off"  size="40" onkeyup="getSuggestionValues(this.value)" >                                         </h:inputText>                                         <div align="left" class="box" id="autocomplete"