JSON response

Hi There,
Is it advisible to use JSON with heavy traffic ..
Thanks

Depends. Hard to say based on the as far given information.

Similar Messages

  • How to fix a problem with the order of strings in a JSON response for a CFHTTP request?

    Good morning, guys! (It's 10:50 a.m. in Brazil)
    First of all, I'm still new at CF and my questions may seem too much silly and my English's not the best, so, please be patient with me. hehe
    Well, I'm accessing a link via CFHTTP that gives me a JSON response. I'm not familiar with JSON yet, so I'm working it as a string and using string functions (Find,RemoveChars,Replace,etc), but it happens to me that I'm receiving a certain kind of order of the strings list from the JSON when I access it directly from the browser and other kind of order totally different when I access it from the CFHTTP.
    I only figured it out because I was working at home with my code and there everything went just fine as expected. Then I brought to my job to develop a little bit more as soon as I get a free time and here my code doesn't work anymore. When I took a look at the JSON by a CFOUTPUT, I realized the strings were in a different order.
    Does anyone know why is it happening?
    Link to the JSON: http://sigmine.dnpm.gov.br/ArcGIS/rest/services/extra/dados_dnpm/MapServer/0/query?text=83 0620/2012&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelInter sects&where=&returnGeometry=true&outSR=&outFields=FID,Shape,PROCESSO,ID,NUMERO,ANO,AREA_HA ,FASE,ULT_EVENTO,NOME,SUBS,USO,UF&f=pjson
    Basic code simplified to find out that the order of strings were coming different when access by CFHTTP:
    <cfhttp url="#URLAbove#" method="get" result="DadosDoDNPM" charset="utf-8" timeout="10000" />
    <cfset DadosJSON = deserializeJSON(DadosDoDNPM.FileContent) />
    <cfif arrayLen(DadosJSON.features)>
        <cfset CodigoFonteJSON = ToString(serialize(DadosJSON.features)) />   
        <cfoutput> #CodigoFonteJSON# </cfoutput>
    </cfif>
    Is there a way to fix it and to make my code work everywhere?
    If it matters, I use Railo at home and at my job.
    Since now, I thank you.

    When you deserialize JSON data, ColdFusion converts it into native structures and arrays (roughly equivalent to JavaScript objects and arrays).  In ColdFusion, structures are unordered (that is, they don't maintain keys in any particular ordered sequence).
    This really shouldn't be a problem though, at least not if you just want to work with the data contained in the deserialized JSON structure.  So DadosJSON should be a native ColdFusion structure, and you can interact with it like any other structure in ColdFusion.  In fact, you should not have to re-serialize it at all unless you need to send it to an external application using JSON.
    Why are you reserializing the data?  And why use serialize() instead of serializeJSON()?
    -Carl V.

  • MVC Web API json response truncated?

    I have an MVC 4 Web API in C# hosted in IIS 7
    Basically this service has a queue that has items enqueued every minute. I expose a GET method that allows for all the items in the queue to be returned in a json array.
    the queue is really this: Queue<List<CustomObject>> mQueue; then every minute a new list is enqueued.
    The max size of the queue is 50 (1 hour of data)
    the maximum count of a list in said queue is ~500 and minimum count is ~100. When I debug the api locally It will return all the elemnets in the queue no problem. only takes a couple seconds. The size of the json response (saved to disk) is ~10Mb.
    So I decided to host this service on a VM. I let it run for a while so the queue gets populated. then I make my request:
    http://somepoint:4328/AzureQueueService?view=Full
    I only get 1.30 - 1.32 mb of data back. Which equates to about 4 minutes worth of data! So the question becomes is there some setting in IIS that forces the response sent to be less than 2Mb? Maybe there is a similar setting in my webconfig? Or maybe IIS
    has created more than one instance of my service? Either way, I'm missing something here.

    What OS (including SP number) your service is running on? (both local and VM)
    Do you receive the same amount of data as specified in Content-Length header? Is your response a valid JSON (just having less data than expected), or it is really truncated?
    Where is your queue hosted? Is it just a static object inside IIS process, or somewhere out-of-process?
    How is it filled? By another method passing incoming data? Do you use thread synchronization when accessing the queue?
    IIS may have multiple worker processes per application, and each will have its own static queue (of course, if it is hosted in-process). Also IIS might recycle worker processes, so in-process data could be lost.

  • How to remove 'd' wrapper from odata json response ?

    Hello,
    from example request :
    /sap/opu/odata/sap/ZQM_CONFIRMATION_SRV/Check_batch_and_cust?$format=json&WERK='ASJV'&PDATUM=''&CHARGE='140005'&MENGE=''&VORG=''
    response json looks like this:
    {"d":{"__metadata":{"id":"http://x:8000/sap/opu/odata/sap/ZQM_CONFIRMATION_SRV/CHECK_BATCH_AND_CUSTOMERSet(Charge='',Menge='',Pdatum='',Vorg='',Werk='')","uri":"http://x:8000/sap/opu/odata/sap/ZQM_CONFIRMATION_SRV/CHECK_BATCH_AND_CUSTOMERSet(Charge='',Menge='',Pdatum='',Vorg='',Werk='')","type":"ZQM_CONFIRMATION_SRV.CHECK_BATCH_AND_CUSTOMER"},"Charge":"","Menge":"","Pdatum":"","Vorg":"","Werk":"","Msg":"OK","Name1":"WIN-Warth GmbH","Name2":"","Status":"0"}}
    I want to remove wrapper 'd'
    Any ideas ?
    regards
    Lucas

    Hello Lukasz,
    In my openion your json response will always be encapsulated in a standard structure/format as u have shared. I do not see any way u can remove ' d ' from the json response in GW level
    Regards,
    Ashwin

  • Create dynamic controls from JSON Response

    I have a requirement to create a group of checkbox with lebels in a page from JSON response.
    The JSON response is
        "data": [
                "CodeStatus": "Red"
                "CodeStatus": "Orange"
                "CodeStatus": "Green"
                "CodeStatus": "Yellow"
    the  design is:
    the box is vertically scrollable, as it can have more color codes.
    Can anyone suggest how to design the above?
    If one can provide the implemantation code, that would be very good as I have very time to implement it.

    Have a look at templates and for more complex scenarios factory functions, which give you the ability to dynamically create controls from model data.
    SAPUI5 SDK - Demo Kit
    Regards,
    Jason

  • Want a JSON response by the Bing Synonyms API

    Hello,
    How do I request for a JSON response from the synonyms API. I could not find the answer in the documentation found here: https://onedrive.live.com/view.aspx?resid=23DD320B9FC9364A!113&app=Word&authkey=!AAxXlP949CZOQyA
    I decided to try query param format=json and it did not work, neither did it work if I passed in the Content-Type: application/json
    Everytime the API sends back the response in XML.
    Please let me know,
    AJ

    What I could get from the documentation is basically:
    A request to the HTTP endpoint consists of an HTTP GET request to the appropriate URI. There are two
    URIs, one for XML results and one for JSON results. These are http://api.bing.com/xml.aspx and
    http://api.bing.net/json.aspx, respectively.
    Now the synonyms API URL is: 
    https://api.datamarket.azure.com/Bing/Synonyms/GetSynonyms?Query=%27word%27
    what I am supposed to do here?

  • Cache JSON response

    Hi,
    I used following blog to Ajaxify a component
    http://blogs.adobe.com/mtg/2011/11/building-components-in-adobe-cq5-part-2-a-tutorial-on-j query-ajax-and-sling.html
    Basically this talks about creating a JSP file in conponent with name [ComponentName].json.POST.jsp to allow running custom code to return JSON.
    My component is doing JCR search based a parameters and returning a JSON list (which could be different for different parameters)
    So all went well till I discover performance issues with AJAX response time.
    Is there a way in CQ5 to cache result of JSON and have it auto every x mins?
    Thanks in adavnce.

    Thanks Justin. I have couple of questions to understand the proposed solution
    1) Do you know how can I convert component POST to GET (for the reference blog). I tried renaming to myajaxsample.json.GET.jsp but it breaks component input dialog. Note that this component is making Ajax call to
    <%= currentNode.getPath() %>.json
    2) Can I force cache to update for cases when data for a particular JSON request is updated?

  • How to handle JSON response in XSL-Fo templates during PDF creation of the page

    XSL-FO in CQ5 converts xml output to PDF so for each new XML tag I need to introduce xsl-templates.
    But For ext-js javascript widget on the page that’s not part of CRX Node/page that shows result by making Ajax call and render JSON output. How to address that inside PDF page creation.
    Please share your thought.
    Thanks Chandra

    Declaratevly You can't do this.
    I use two event handler for state remembering:
    public static EventResult goToPage(BajaContext context,
    Page page,
    PageEvent pageEvent) {
    Page newPage = new Page(page.getProperty("nextPageName"));
    page.setProperty(NEXT_PAGE_NAME, null);
    newPage.setPropertyAsPage("returnPage", page, context.getPageEncoder());
    return new EventResult(newPage);
    public EventResult returnToPage(BajaContext context,
    Page page,
    PageEvent pageEvent) {
    Page oldPage = page.getPropertyAsPage("returnPage", context.getPageDecoder());
    return new EventResult(oldPage);
    StartPage.uix
    <handlers>
    <event name="nextPage">
    <bc4j:chaining>
    <bc4j:setPageProperty name="nextPageName" value="NextPage"/>
    <method class="..." method="goToPage"/>
    </bc4j:chaining>
    </event>
    </handlers>
    NextPage.uix
    <handlers>
    <event name="nextPage">
    <bc4j:chaining>
    <method class="..." method="returnToPage"/>
    </bc4j:chaining>
    </event>
    </handlers>
    method setPropertyAsPage save all page properties and state informations for page.
    On every page I use ctrl:page or ctrl:pageState DataObjectLists.
    On pages with search criteria I use ctrl:httpSession DataObjectList to save all criteria in one session. You must write event handler when you make search or trigger FIND event. In this event handler you must put every search form parameter in session.
    That's all from me! I hope this help You to resolve problems!

  • Empty JSON response can't be serialized

    Hi,
    FB4 B2
    I was getting an error from JSONSerializer object when the returned array has no elements inside. the returned JSON encoded raw data is a simple array representation: []. Is there anything I'm doing wrong, server side is php and I'm using PHP's json_encoder function. When I have elements inside the serializer works well.
    r. Sandor
    Error:
    Error: Error while Parsing
    at com.adobe.serializers.json::JSONDecoder/parseValue()[C:\perforceGAURAVP01\depot\flex\ide_ builder\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serializers\json\JSONDecoder .as:249]
    at com.adobe.serializers.json::JSONDecoder/parseArray()[C:\perforceGAURAVP01\depot\flex\ide_ builder\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serializers\json\JSONDecoder .as:431]
    at com.adobe.serializers.json::JSONDecoder/parseValue()[C:\perforceGAURAVP01\depot\flex\ide_ builder\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serializers\json\JSONDecoder .as:221]
    at com.adobe.serializers.json::JSONDecoder/decode()[C:\perforceGAURAVP01\depot\flex\ide_buil der\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serializers\json\JSONDecoder.as: 178]
    at com.adobe.serializers.json::JSONSerializationFilter/deserializeResult()[C:\perforceGAURAV P01\depot\flex\ide_builder\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serialize rs\json\JSONSerializationFilter.as:102]
    at mx.rpc.http::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::processResult()[E:\dev\gumbo_beta2\frameworks\ projects\rpc\src\mx\rpc\http\AbstractOperation.as:929]
    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\gumbo_beta2\frameworks\ projects\rpc\src\mx\rpc\AbstractInvoker.as:313]
    at mx.rpc::Responder/result()[E:\dev\gumbo_beta2\frameworks\projects\rpc\src\mx\rpc\Responde r.as:56]
    at mx.rpc::AsyncRequest/acknowledge()[E:\dev\gumbo_beta2\frameworks\projects\rpc\src\mx\rpc\ AsyncRequest.as:84]
    at DirectHTTPMessageResponder/completeHandler()[E:\dev\gumbo_beta2\frameworks\projects\rpc\s rc\mx\messaging\channels\DirectHTTPChannel.as:446]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

    Another possible workaround is use a drop-in replacement to the built-in JSONSerializationFilter:
    https://github.com/audreyt/plurk/blob/master/src/com/serialization/json/JSONSerializationF ilter.as
    https://github.com/audreyt/plurk/blob/master/src/com/serialization/json/JSON.as
    All it takes is changing the "import com.adobe.serializers.json.JSONSerializtionFilter" lines in service
    class's templates into "import com.serialization.json.JSONSerializationFilter", and empty arrays would start working.
    Theoretically one can also do this, though I have not tested it yet:
        SerializationFilter.registerFilterForResultFormat( 'json', new JSONSerializationFilter ());

  • HTTPService JSON response

    Hi. I am playing with Flash Builder 4 (so excuse my ignorance).
    I'm trying to connect to a Twitter data source for a test and the results are returned in JSON format. I then want to loop through all the tweets returned, showing each one for five seconds. I am trying to get this example working through actionscript and through the connect to the Data/Services wizard. Connecting and returning the results isn't a problem but I can't find any examples showing how to move through the records one at a time (using the Timer event). I'd love to get this working using the Data/Services wizard approach but all the examples I have found are all about binding to a datagrid (or similar) and I can't find anything showing how you can get your results and display one record at a time.
    Can anybody point me in the direction of an example or give me an idea of how to do this?
    Apologies for the ignorance. Any help greatly appreciated (I hope the above makes sense).
    Cheers.

    I haven't done this, so this may not be the best way, but how about:
    When data returns:
    1. put the results into a public global ArrayCollection acElements
    2. set a public global variable totalElements
    3. set a public global variable elementIndex=0
    4. start the timer
    When the timer event fires:
    1. display what is in acElements[elementIndex]
    2. increment elementIndex by 1
    3. if elementIndex >= totalElements then set elementIndex back to 0
    It occurs to me that this is a snapshot and you may be talking about real-time streaming data, but perhaps this will help. I suppose you could restart this process on a second timer, every few minutes?

  • Parsing date from JSON response

    Is there any helper method to parse date time value being returned in JSONResponse to get java.util.Date. For example, 2012-06-26T15:51:59.078-05:00. I have done simple java method using SimpleDateFormat, but that does not handle all possible formats. Anyone has ideas on libraries that can be used for this purpose?
    Chandresh

    Oh I see you receive different formats from different services, who's backend you can not modify.
    I found this, it should help you get the job done:
    http://stackoverflow.com/questions/4024544/how-to-parse-dates-in-multiple-formats-using-simpledateformat
    Note however, that his problem is only relatively simplistic, yours on the other hand seems to be one of a kind where you have to be set up a pretty nifty algorithm taking care of all the different possible formats. That being said, there is no method which can parse ANY format you throw at it. you must write one yourself which knows which possible formats to expect.
    If its only those two formats you can expect:
    2012-06-26T15:51:59.078-05:00
    2012-06-26T15:51:59-05:00
    it should be an easy try-catch construct within a helper method. just be sure to use the right letters when setting up your SimpleDateFormat parse object, it's case sensitive and one quickly gets lost in all those letters.
    Edit:
    Again this should do the trick:
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz");
    Just make sure you remove the last ":" from the JSONString (simple string manipulation) and then have two cases
    //removing last ":" from JSONString
    //====
    //Parsing string to date or gregCalendar
    GregorianCalendar time= new GregorianCalendar();
    try{
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz");
    time.setTime(sdf.parse(JSONString));
    catch{
    SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz");
    time.setTime(sdf2.parse(JSONString));
    Edited by: Pascal B on 05.07.2012 04:50
    Edited by: Pascal B on 05.07.2012 04:55

  • The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType.  Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the

    Hi,
    Im trying to create a Rest WS with a @GET method that will return me an Emp object. I need the output as a JSON string.
    I have created a dynamic web project and added javax RS jars:
    When im trying to run this, i'm getting the below mentioned error:
    FlushResultHa E org.apache.wink.server.internal.handlers.FlushResultHandler handleResponse The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType.  Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the type and media type specified.
    RequestProces I org.apache.wink.server.internal.RequestProcessor logException The following error occurred during the invocation of the handlers chain: WebApplicationException (500 - Internal Server Error)
    Please help as im stuck with this from long.
    Thanks in advance.
    Below is the code for my service class:
    package com.rest.assignment;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.util.Enumeration;
    import java.util.HashSet;
    import java.util.Properties;
    import java.util.Set;
    import javax.ws.rs.GET;
    import javax.ws.rs.Path;
    import javax.ws.rs.Produces;
    import javax.ws.rs.core.Application;
    import javax.ws.rs.core.MediaType;
    import javax.ws.rs.core.Response;
    @Path("/restService")
    public class RestService extends Application {   
        @GET
        @Path("/getEmpDetails")
        @Produces(MediaType.APPLICATION_JSON)
        public Response getStringResponse()
            EmpBean empBean = new EmpBean();
            String filePath = "C:/Program Files/IBM/workspace/HelloWorld/src/com/rest/resources/EmpData.properties";
            Properties properties = new Properties();
            try {
                properties.load(new FileInputStream(filePath));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
             Enumeration e = properties.propertyNames();
             String result="";
            String[] empDetailsArr;
            while (e.hasMoreElements()) {
              String key = (String) e.nextElement();
              String empDetails = properties.getProperty(key);
              empDetailsArr=empDetails.split(",");    
              empBean.setFirstName(empDetailsArr[0]);
              empBean.setLastName(empDetailsArr[1]);
              empBean.setEmpId(empDetailsArr[2]);
              empBean.setDesignation(empDetailsArr[3]);
              empBean.setSkillSet(empDetailsArr[4]);
              result = empDetailsArr[1];
            //return empBean;
            return Response.ok(empBean).type(MediaType.APPLICATION_JSON_TYPE).build();
        @Override
        public Set<Class<?>> getClasses() {
            Set<Class<?>> classes = new HashSet<Class<?>>();
            classes.add(RestService.class);
            classes.add(EmpBean.class);
            return classes;
    and my empBean goes like this:
    package com.rest.assignment;
    public class EmpBean {
        private String firstName;
        private String lastName;
        private String empId;
        private String designation;
        private String skillSet;
        public String getFirstName() {
            return firstName;
        public void setFirstName(String firstName) {
            this.firstName = firstName;
        public String getLastName() {
            return lastName;
        public void setLastName(String lastName) {
            this.lastName = lastName;
        public String getEmpId() {
            return empId;
        public void setEmpId(String empId) {
            this.empId = empId;
        public String getDesignation() {
            return designation;
        public void setDesignation(String designation) {
            this.designation = designation;
        public String getSkillSet() {
            return skillSet;
        public void setSkillSet(String skillSet) {
            this.skillSet = skillSet;
    Web.xml goes like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <display-name>restWS</display-name>
    <welcome-file-list>
      <welcome-file>index.html</welcome-file>
      <welcome-file>index.htm</welcome-file>
      <welcome-file>index.jsp</welcome-file>
      <welcome-file>default.html</welcome-file>
      <welcome-file>default.htm</welcome-file>
      <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
      <servlet-name>REST</servlet-name>
      <servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
      <init-param>
       <param-name>javax.ws.rs.Application</param-name>
       <param-value>com.rest.assignment.RestService</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
      <servlet-name>REST</servlet-name>
      <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
    </web-app>
    When i try to return a string from my get method, it gives me a proper response. i get this exception when im trying to return a JSON response.

    Hi,
    Im trying to create a Rest WS with a @GET method that will return me an Emp object. I need the output as a JSON string.
    I have created a dynamic web project and added javax RS jars:
    When im trying to run this, i'm getting the below mentioned error:
    FlushResultHa E org.apache.wink.server.internal.handlers.FlushResultHandler handleResponse The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType.  Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the type and media type specified.
    RequestProces I org.apache.wink.server.internal.RequestProcessor logException The following error occurred during the invocation of the handlers chain: WebApplicationException (500 - Internal Server Error)
    Please help as im stuck with this from long.
    Thanks in advance.
    Below is the code for my service class:
    package com.rest.assignment;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.util.Enumeration;
    import java.util.HashSet;
    import java.util.Properties;
    import java.util.Set;
    import javax.ws.rs.GET;
    import javax.ws.rs.Path;
    import javax.ws.rs.Produces;
    import javax.ws.rs.core.Application;
    import javax.ws.rs.core.MediaType;
    import javax.ws.rs.core.Response;
    @Path("/restService")
    public class RestService extends Application {   
        @GET
        @Path("/getEmpDetails")
        @Produces(MediaType.APPLICATION_JSON)
        public Response getStringResponse()
            EmpBean empBean = new EmpBean();
            String filePath = "C:/Program Files/IBM/workspace/HelloWorld/src/com/rest/resources/EmpData.properties";
            Properties properties = new Properties();
            try {
                properties.load(new FileInputStream(filePath));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
             Enumeration e = properties.propertyNames();
             String result="";
            String[] empDetailsArr;
            while (e.hasMoreElements()) {
              String key = (String) e.nextElement();
              String empDetails = properties.getProperty(key);
              empDetailsArr=empDetails.split(",");    
              empBean.setFirstName(empDetailsArr[0]);
              empBean.setLastName(empDetailsArr[1]);
              empBean.setEmpId(empDetailsArr[2]);
              empBean.setDesignation(empDetailsArr[3]);
              empBean.setSkillSet(empDetailsArr[4]);
              result = empDetailsArr[1];
            //return empBean;
            return Response.ok(empBean).type(MediaType.APPLICATION_JSON_TYPE).build();
        @Override
        public Set<Class<?>> getClasses() {
            Set<Class<?>> classes = new HashSet<Class<?>>();
            classes.add(RestService.class);
            classes.add(EmpBean.class);
            return classes;
    and my empBean goes like this:
    package com.rest.assignment;
    public class EmpBean {
        private String firstName;
        private String lastName;
        private String empId;
        private String designation;
        private String skillSet;
        public String getFirstName() {
            return firstName;
        public void setFirstName(String firstName) {
            this.firstName = firstName;
        public String getLastName() {
            return lastName;
        public void setLastName(String lastName) {
            this.lastName = lastName;
        public String getEmpId() {
            return empId;
        public void setEmpId(String empId) {
            this.empId = empId;
        public String getDesignation() {
            return designation;
        public void setDesignation(String designation) {
            this.designation = designation;
        public String getSkillSet() {
            return skillSet;
        public void setSkillSet(String skillSet) {
            this.skillSet = skillSet;
    Web.xml goes like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <display-name>restWS</display-name>
    <welcome-file-list>
      <welcome-file>index.html</welcome-file>
      <welcome-file>index.htm</welcome-file>
      <welcome-file>index.jsp</welcome-file>
      <welcome-file>default.html</welcome-file>
      <welcome-file>default.htm</welcome-file>
      <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
      <servlet-name>REST</servlet-name>
      <servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
      <init-param>
       <param-name>javax.ws.rs.Application</param-name>
       <param-value>com.rest.assignment.RestService</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
      <servlet-name>REST</servlet-name>
      <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
    </web-app>
    When i try to return a string from my get method, it gives me a proper response. i get this exception when im trying to return a JSON response.

  • How to make an OSB proxy to the server responding with application/json?

    Hi,
    My question is related to unfortunately unanswered question: Re: OSB and Oracle Maps
    Big picture: There is a Jetty server on local network with SpringMVC controllers which respond with JSON. The only way to communicate from frontend application to that server is through the OSB. So OSB should work as transparent proxy, passing headers and respond with original JSON message.
    I tried to build such proxy, following some blogs entries. Proxy worked for the REST services based on XML, but when I go to the JSON business service I get stuck.
    I think that business service to communicate with JSON server should be a Messaging Service, with Response Type: Text and Request Type: None.
    All headers should be passed (Outbound request) so the JSON server receives them in same state as frontend send.
    Business service should be invoked from 'Service Callout' because I don't need any asynchronous calls, or routing - just call the business service endpoint, which will call JSON server and pass the response.
    There are some problems in which I stepped into when tried this approach:
    1. When using Request Type: None the Service Callout give me an error of type:
    A callout cannot invoke a one-way operation
    When switching Request Type to Text I get it working, but some services on JSON server which operates only on GET method stop work (because switching to Text automatically require to use POST method, which is obvious but not necessary in my case).
    2. Even with above modification I cannot get the response from business service - I guess it's because the JSON response isn't wrapped into any XML elements. So in Service Callout any logger prints the message on Request side, but anything is written by Response logger inside the Service Callout. The browser which launch the Proxy Service also answers with:
    HTTP 500 (Internal Server Error)
    and I don't see any errors in logs, last message is from Request logger inside Service Callout.
    3. Business Service itself seems to work - here is an output from 'Run on Server':
    Business Service Testing - SampleJSON
    Request Document
    Response Document      
    {"models":[],"success":1}
    Response Metadata      
    <con:metadata xmlns:con="http://www.bea.com/wli/sb/test/config">
    <tran:headers xsi:type="http:HttpResponseHeaders" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <http:Content-Length>696</http:Content-Length>
    <http:Content-Type>application/json;charset=ISO-8859-1</http:Content-Type>
    <http:Server>Jetty(7.4.2.v20110526)</http:Server>
    </tran:headers>
    <tran:response-code xmlns:tran="http://www.bea.com/wli/sb/transports">0</tran:response-code>
    <tran:response-message xmlns:tran="http://www.bea.com/wli/sb/transports">OK</tran:response-message>
    <tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">ISO-8859-1</tran:encoding>
    <http:http-response-code xmlns:http="http://www.bea.com/wli/sb/transports/http">200</http:http-response-code>
    </con:metadata>
    But when calling it from a service proxy I don't get any logger message on the JSON server, which appears normally when I runs business service tests. So it seems that the request doesn't even reach it.
    If anyone has a time to look at this problem I can share the configuration jar ready to import: http://dl.dropbox.com/u/21341604/sample-osb-json/sample-json.jar, to make it working you need change Endpoint URI in SampleJSON.biz.
    Thanks in advance for any kind of help or tips,
    Adrian

    If you are the admin, then use the following command in Terminal:
    sudo mkdir /.nameOfFolder
    Replace nameOfFolder with the name you want.  The sudo will prompt you for your admin password. 

  • CRX/DE failing on Publish nodes with 404 for JSON data

    I'm in the process of rebuilding our author and publish staging instances using the 2.1 service pack for CQ5.5, and now I'm seeing problems with CRX/DE on both publish nodes on two difference machines.
    We get this error whenever we try to pull up CRX/DE on these two nodes:
    11.03.2013 13:18:40.222 *INFO* [12.104.103.30 [1363022320201] GET /crx/server/crx.default/jcr%3aroot/.1.json HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Resource /crx/server/crx.default/jcr:root/.1.json not found
    The app works fine on the author node, and the websites themselves still appear to serve correctly from the publish instances.
    The odd thing is that, after I saw this problem, I wiped both publish instances and restored from a backup I had made this morning and restarted them to find that the problem persists.
    Any thoughts?  I had thought myself done with this process until this issue appearing suddenly.  At the time I was rebuilding bundles on the Author node after having installed an updated content package and replicating it to the publish nodes.  I was attempting to rebuild the bundles on the Publish nodes when I saw the CRX/DE problem.

    Hi,
    It seems to be access issue to me even though you have logged in as admin. To confirm this do the below.
    1. Open a browser and log in to your author instance using admin rights.
    2. Now using same browser now access http://localhost:4502/crx/server/crx.default/jcr:root/.1.json which is actually request to access jcr respository. When you access this link you will see the proper JSON response return.
    Now
    1. Open another browser (not same as above because above browser does have your cq session) and just access http://localhost:4502/crx/server/crx.default/jcr:root/.1.json you will see a 404 because anonymous user doesnt have access to it.
    If above is true then plz try to look at your permissioning for jcr:root ("/") and if it looks good then check for authorization bundles status in felix console and check logs.
    Also try to access crx explorer, if you can see the hierarchy http://<host>:<port>/crx/explorer/browser/index.jsp
    Thanks,
    Pawan

  • URL Services Data Control (REST / JSON)

    Hi,
    I am planning to write a PoC of an integration for JIRA in an ADF Application. I am not too expert on REST services but that is what JIRA API gives me, REST API.
    I have been trying to create an URL Services Data Control but I have encounter 2 problems;
    - Since I need to use 11g R1 I can't choose the HTTP type request so I just have read access through GET request. If I am not mistaken, 11g R2 allows you the possibility to chose GET,POST,DELETE etc.
    - Under the assumption that OK, I am OK just working with GET action, the REST service response comes as JSON so I don't know exactly if its worth to use the URL Data Control at this point since once I have created my DC it doesnt have any structure like would normally do.
    My questions;
    In this blog by Frank Nimphius https://blogs.oracle.com/jdevotnharvest/entry/which_option_to_choose_for he says
    Note: In the above, I exclude REST services in my recommendation because this is what ADF will
    address much better using the URL data control in JDeveloper 11g R2 (available) and with improved functionality
    in the upcoming Oracle JDeveloper 12c release.*.- Is this valid for XML and JSON responses or just for XML responses?
    *.- Do I need to create an XSD file myself in order to get a better DC objects?
    *.- Finally, what is the best approach since I am confused about all information on internet.
    Thanks
    p.s: I am using 11.1.1.6

    If you are stuck on 11.1.1.6 then you can just write simple POJOs that access the REST services and then expose those services as data controls for ADF.
    If you can upgrade to 11.1.2.3 then you'll be able to fully leverage the REST data control - the basic steps are here:
    https://blogs.oracle.com/adf/entry/exposing_multiple_methods_under_one

Maybe you are looking for