ajax json response

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ajax json response

info@agentur-m3.de
Hello everyone!

Here is a question concerning an ajax request:

<service name="getNext" engine="java"
      location="org.ofbiz.pcomp.pCompServices" invoke="getNext">
    <description>get next</description>
   <!-- <auto-attributes mode="IN" entity-name="pcRating"
include="nonpk" optional="true" /> -->
 <attribute name="pcId" mode="IN" type="String" optional="true" />
 <attribute name="idX" mode="OUT" type="Integer" optional="false" />
 <attribute name="idY" mode="OUT" type="Integer" optional="false" />
</service>

    <request-map uri="getNext">
      <security https="true" auth="true"/>
      <event type="service" invoke="getNext"/>
      <response name="success" type="request" value="json"/>
      <response name="error" type="request" value="json"/>
    </request-map>


The request works fine and gives back correct values for idX and idY.

My question is, if the line
      <response name="success" type="request" value="json"/>

is correct (or if there is an better alternative), because
the return values are not json, but 2 x  plain integer.

The java function implementing the service returns this:

         Map result = ServiceUtil.returnSuccess();
         int idX = 5;
         int idY = 6;
         result.put("idX",idX);
         result.put("idY",idY);
         return result;

So is value="json" formally correct?

Thank you for your help!
Reply | Threaded
Open this post in threaded view
|

Re: ajax json response

Sumit Sabu
Remove my name from this mail chain.

I am not a part of this   so called organisation   :   OFBIZ

Remove my name.

On Sun, Feb 22, 2015 at 4:18 PM, [hidden email] <[hidden email]>
wrote:

> Hello everyone!
>
> Here is a question concerning an ajax request:
>
> <service name="getNext" engine="java"
>       location="org.ofbiz.pcomp.pCompServices" invoke="getNext">
>     <description>get next</description>
>    <!-- <auto-attributes mode="IN" entity-name="pcRating"
> include="nonpk" optional="true" /> -->
>  <attribute name="pcId" mode="IN" type="String" optional="true" />
>  <attribute name="idX" mode="OUT" type="Integer" optional="false" />
>  <attribute name="idY" mode="OUT" type="Integer" optional="false" />
> </service>
>
>     <request-map uri="getNext">
>       <security https="true" auth="true"/>
>       <event type="service" invoke="getNext"/>
>       <response name="success" type="request" value="json"/>
>       <response name="error" type="request" value="json"/>
>     </request-map>
>
>
> The request works fine and gives back correct values for idX and idY.
>
> My question is, if the line
>       <response name="success" type="request" value="json"/>
>
> is correct (or if there is an better alternative), because
> the return values are not json, but 2 x  plain integer.
>
> The java function implementing the service returns this:
>
>          Map result = ServiceUtil.returnSuccess();
>          int idX = 5;
>          int idY = 6;
>          result.put("idX",idX);
>          result.put("idY",idY);
>          return result;
>
> So is value="json" formally correct?
>
> Thank you for your help!
>
Reply | Threaded
Open this post in threaded view
|

Re: ajax json response

Jacques Le Roux
Administrator
Help yourself http://ofbiz.apache.org/mailing-lists.html

Jacques

Le 23/02/2015 04:46, Sumit Sabu a écrit :

> Remove my name from this mail chain.
>
> I am not a part of this   so called organisation   :   OFBIZ
>
> Remove my name.
>
> On Sun, Feb 22, 2015 at 4:18 PM, [hidden email] <[hidden email]>
> wrote:
>
>> Hello everyone!
>>
>> Here is a question concerning an ajax request:
>>
>> <service name="getNext" engine="java"
>>        location="org.ofbiz.pcomp.pCompServices" invoke="getNext">
>>      <description>get next</description>
>>     <!-- <auto-attributes mode="IN" entity-name="pcRating"
>> include="nonpk" optional="true" /> -->
>>   <attribute name="pcId" mode="IN" type="String" optional="true" />
>>   <attribute name="idX" mode="OUT" type="Integer" optional="false" />
>>   <attribute name="idY" mode="OUT" type="Integer" optional="false" />
>> </service>
>>
>>      <request-map uri="getNext">
>>        <security https="true" auth="true"/>
>>        <event type="service" invoke="getNext"/>
>>        <response name="success" type="request" value="json"/>
>>        <response name="error" type="request" value="json"/>
>>      </request-map>
>>
>>
>> The request works fine and gives back correct values for idX and idY.
>>
>> My question is, if the line
>>        <response name="success" type="request" value="json"/>
>>
>> is correct (or if there is an better alternative), because
>> the return values are not json, but 2 x  plain integer.
>>
>> The java function implementing the service returns this:
>>
>>           Map result = ServiceUtil.returnSuccess();
>>           int idX = 5;
>>           int idY = 6;
>>           result.put("idX",idX);
>>           result.put("idY",idY);
>>           return result;
>>
>> So is value="json" formally correct?
>>
>> Thank you for your help!
>>