ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "info@agentur-m3.de" <i...@agentur-m3.de>
Subject ajax json response
Date Sun, 22 Feb 2015 10:48:31 GMT
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" />

    <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"/>

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;
	 return result;

So is value="json" formally correct?

Thank you for your help!

View raw message