JSON RPC

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

JSON RPC

Mansour
Is there a way to get JSON for all the services. Like SOAPService or
xmlrpc, I like to be able to call the service through http in the same
pattern:

http://demo-trunk.ofbiz.apache.org/webtools/control/SOAPService/

I looked in ./service/config/serviceengine.xml but couldn't find any
reference to JSON engine. The closest I found is xmlrpc but nothing
related to json.

 <engine name="xml-rpc-local"
class="org.ofbiz.service.engine.XMLRPCClientEngine">
            <parameter name="url"
value="http://localhost:8080/webtools/control/xmlrpc"/>
            <parameter name="login" value="admin"/>
            <parameter name="password" value="ofbiz"/>
</engine>

Is there a way to add json handler ?? for example
http://demo-trunk.ofbiz.apache.org/webtools/control/jsonrpc

thank you.
Reply | Threaded
Open this post in threaded view
|

Re: JSON RPC

Amit Sharma
Use REST https://cwiki.apache.org/OFBIZ/export-service-using-rest.html

HTH!

Thank and Regards,
Amit Sharma

On Wednesday 13 June 2012 10:18 AM, Mansour Al Akeel wrote:

> Is there a way to get JSON for all the services. Like SOAPService or
> xmlrpc, I like to be able to call the service through http in the same
> pattern:
>
> http://demo-trunk.ofbiz.apache.org/webtools/control/SOAPService/
>
> I looked in ./service/config/serviceengine.xml but couldn't find any
> reference to JSON engine. The closest I found is xmlrpc but nothing
> related to json.
>
>   <engine name="xml-rpc-local"
> class="org.ofbiz.service.engine.XMLRPCClientEngine">
>              <parameter name="url"
> value="http://localhost:8080/webtools/control/xmlrpc"/>
>              <parameter name="login" value="admin"/>
>              <parameter name="password" value="ofbiz"/>
> </engine>
>
> Is there a way to add json handler ?? for example
> http://demo-trunk.ofbiz.apache.org/webtools/control/jsonrpc
>
> thank you.

Reply | Threaded
Open this post in threaded view
|

Re: JSON RPC

Amit Sharma
Hi Mansour,

In the given example if you change Response object to String using JSON,
that should work for you.

Thanks and Regards
Amit Sharma

On Wednesday 13 June 2012 10:44 AM, Amit wrote:

> Use REST https://cwiki.apache.org/OFBIZ/export-service-using-rest.html
>
> HTH!
>
> Thank and Regards,
> Amit Sharma
>
> On Wednesday 13 June 2012 10:18 AM, Mansour Al Akeel wrote:
>> Is there a way to get JSON for all the services. Like SOAPService or
>> xmlrpc, I like to be able to call the service through http in the same
>> pattern:
>>
>> http://demo-trunk.ofbiz.apache.org/webtools/control/SOAPService/
>>
>> I looked in ./service/config/serviceengine.xml but couldn't find any
>> reference to JSON engine. The closest I found is xmlrpc but nothing
>> related to json.
>>
>>   <engine name="xml-rpc-local"
>> class="org.ofbiz.service.engine.XMLRPCClientEngine">
>>              <parameter name="url"
>> value="http://localhost:8080/webtools/control/xmlrpc"/>
>>              <parameter name="login" value="admin"/>
>>              <parameter name="password" value="ofbiz"/>
>> </engine>
>>
>> Is there a way to add json handler ?? for example
>> http://demo-trunk.ofbiz.apache.org/webtools/control/jsonrpc
>>
>> thank you.
>

Reply | Threaded
Open this post in threaded view
|

Re: JSON RPC

Mansour
Amit,
can not thank you enough for the fast response. I am still lost, and I
believe I am missing something.
The example is talking about creating a new component, but I need to
use existing ones.
It's not clear to me how to call the service and get json response. My
needs is to do something like what is in the article
and get json.
https://cwiki.apache.org/OFBIZ/using-xmlrpc-as-an-alternative-to-soap.html


Thank you a lot.



On Wed, Jun 13, 2012 at 1:23 AM, Amit <[hidden email]> wrote:

> Hi Mansour,
>
> In the given example if you change Response object to String using JSON,
> that should work for you.
>
> Thanks and Regards
> Amit Sharma
>
>
> On Wednesday 13 June 2012 10:44 AM, Amit wrote:
>>
>> Use REST https://cwiki.apache.org/OFBIZ/export-service-using-rest.html
>>
>> HTH!
>>
>> Thank and Regards,
>> Amit Sharma
>>
>> On Wednesday 13 June 2012 10:18 AM, Mansour Al Akeel wrote:
>>>
>>> Is there a way to get JSON for all the services. Like SOAPService or
>>> xmlrpc, I like to be able to call the service through http in the same
>>> pattern:
>>>
>>> http://demo-trunk.ofbiz.apache.org/webtools/control/SOAPService/
>>>
>>> I looked in ./service/config/serviceengine.xml but couldn't find any
>>> reference to JSON engine. The closest I found is xmlrpc but nothing
>>> related to json.
>>>
>>>  <engine name="xml-rpc-local"
>>> class="org.ofbiz.service.engine.XMLRPCClientEngine">
>>>             <parameter name="url"
>>> value="http://localhost:8080/webtools/control/xmlrpc"/>
>>>             <parameter name="login" value="admin"/>
>>>             <parameter name="password" value="ofbiz"/>
>>> </engine>
>>>
>>> Is there a way to add json handler ?? for example
>>> http://demo-trunk.ofbiz.apache.org/webtools/control/jsonrpc
>>>
>>> thank you.
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: JSON RPC

Mansour
In reply to this post by Amit Sharma
Amit,
I gave it another thought, and I see what you mean. I need to modify
the code and tweak it a bit and use it as a component to call another
services. This will be fine for now, but I will lose control over some
service that should not be exported. It will be nice if I can get the
same as the xmlrpc. For now this should work. I am getting a
nullPointerException with this code as the header is not being
initialized properly or not injected.

 @Context
    HttpHeaders headers;

I am still digging. Thank you a lot.



On Wed, Jun 13, 2012 at 1:23 AM, Amit <[hidden email]> wrote:

> Hi Mansour,
>
> In the given example if you change Response object to String using JSON,
> that should work for you.
>
> Thanks and Regards
> Amit Sharma
>
>
> On Wednesday 13 June 2012 10:44 AM, Amit wrote:
>>
>> Use REST https://cwiki.apache.org/OFBIZ/export-service-using-rest.html
>>
>> HTH!
>>
>> Thank and Regards,
>> Amit Sharma
>>
>> On Wednesday 13 June 2012 10:18 AM, Mansour Al Akeel wrote:
>>>
>>> Is there a way to get JSON for all the services. Like SOAPService or
>>> xmlrpc, I like to be able to call the service through http in the same
>>> pattern:
>>>
>>> http://demo-trunk.ofbiz.apache.org/webtools/control/SOAPService/
>>>
>>> I looked in ./service/config/serviceengine.xml but couldn't find any
>>> reference to JSON engine. The closest I found is xmlrpc but nothing
>>> related to json.
>>>
>>>  <engine name="xml-rpc-local"
>>> class="org.ofbiz.service.engine.XMLRPCClientEngine">
>>>             <parameter name="url"
>>> value="http://localhost:8080/webtools/control/xmlrpc"/>
>>>             <parameter name="login" value="admin"/>
>>>             <parameter name="password" value="ofbiz"/>
>>> </engine>
>>>
>>> Is there a way to add json handler ?? for example
>>> http://demo-trunk.ofbiz.apache.org/webtools/control/jsonrpc
>>>
>>> thank you.
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: JSON RPC

Deepak Agarwal-2
I want to call search service from REST and hence ProductSearchSession
needs to be accessed but methods in this class requires HttpServletRequest.

On Wed, Jun 13, 2012 at 1:56 PM, Mansour Al Akeel <[hidden email]
> wrote:

> Amit,
> I gave it another thought, and I see what you mean. I need to modify
> the code and tweak it a bit and use it as a component to call another
> services. This will be fine for now, but I will lose control over some
> service that should not be exported. It will be nice if I can get the
> same as the xmlrpc. For now this should work. I am getting a
> nullPointerException with this code as the header is not being
> initialized properly or not injected.
>
>  @Context
>     HttpHeaders headers;
>
> I am still digging. Thank you a lot.
>
>
>
> On Wed, Jun 13, 2012 at 1:23 AM, Amit <[hidden email]> wrote:
> > Hi Mansour,
> >
> > In the given example if you change Response object to String using JSON,
> > that should work for you.
> >
> > Thanks and Regards
> > Amit Sharma
> >
> >
> > On Wednesday 13 June 2012 10:44 AM, Amit wrote:
> >>
> >> Use REST https://cwiki.apache.org/OFBIZ/export-service-using-rest.html
> >>
> >> HTH!
> >>
> >> Thank and Regards,
> >> Amit Sharma
> >>
> >> On Wednesday 13 June 2012 10:18 AM, Mansour Al Akeel wrote:
> >>>
> >>> Is there a way to get JSON for all the services. Like SOAPService or
> >>> xmlrpc, I like to be able to call the service through http in the same
> >>> pattern:
> >>>
> >>> http://demo-trunk.ofbiz.apache.org/webtools/control/SOAPService/
> >>>
> >>> I looked in ./service/config/serviceengine.xml but couldn't find any
> >>> reference to JSON engine. The closest I found is xmlrpc but nothing
> >>> related to json.
> >>>
> >>>  <engine name="xml-rpc-local"
> >>> class="org.ofbiz.service.engine.XMLRPCClientEngine">
> >>>             <parameter name="url"
> >>> value="http://localhost:8080/webtools/control/xmlrpc"/>
> >>>             <parameter name="login" value="admin"/>
> >>>             <parameter name="password" value="ofbiz"/>
> >>> </engine>
> >>>
> >>> Is there a way to add json handler ?? for example
> >>> http://demo-trunk.ofbiz.apache.org/webtools/control/jsonrpc
> >>>
> >>> thank you.
> >>
> >>
> >
>
> --
> Thanks,
> Deepak Agarwal,
>
> Paxcel Technologies Pvt Ltd.
> Hartron Complex, Sector 18, Gurgaon, India.
> E-Mail: [hidden email]
> Mobile: +91 9910322604
>
>
Reply | Threaded
Open this post in threaded view
|

Re: JSON RPC

Amit Sharma
Hi Deepak,

I think in such case you can pass *@Context HttpServletRequest request*
In your REST Service and use *request* object further.

Thanks and Regards
--
Amit Sharma

On Wednesday 04 July 2012 01:16 AM, Deepak Agarwal wrote:

> I want to call search service from REST and hence ProductSearchSession
> needs to be accessed but methods in this class requires HttpServletRequest.
>
> On Wed, Jun 13, 2012 at 1:56 PM, Mansour Al Akeel<[hidden email]
>> wrote:
>> Amit,
>> I gave it another thought, and I see what you mean. I need to modify
>> the code and tweak it a bit and use it as a component to call another
>> services. This will be fine for now, but I will lose control over some
>> service that should not be exported. It will be nice if I can get the
>> same as the xmlrpc. For now this should work. I am getting a
>> nullPointerException with this code as the header is not being
>> initialized properly or not injected.
>>
>>   @Context
>>      HttpHeaders headers;
>>
>> I am still digging. Thank you a lot.
>>
>>
>>
>> On Wed, Jun 13, 2012 at 1:23 AM, Amit<[hidden email]>  wrote:
>>> Hi Mansour,
>>>
>>> In the given example if you change Response object to String using JSON,
>>> that should work for you.
>>>
>>> Thanks and Regards
>>> Amit Sharma
>>>
>>>
>>> On Wednesday 13 June 2012 10:44 AM, Amit wrote:
>>>> Use REST https://cwiki.apache.org/OFBIZ/export-service-using-rest.html
>>>>
>>>> HTH!
>>>>
>>>> Thank and Regards,
>>>> Amit Sharma
>>>>
>>>> On Wednesday 13 June 2012 10:18 AM, Mansour Al Akeel wrote:
>>>>> Is there a way to get JSON for all the services. Like SOAPService or
>>>>> xmlrpc, I like to be able to call the service through http in the same
>>>>> pattern:
>>>>>
>>>>> http://demo-trunk.ofbiz.apache.org/webtools/control/SOAPService/
>>>>>
>>>>> I looked in ./service/config/serviceengine.xml but couldn't find any
>>>>> reference to JSON engine. The closest I found is xmlrpc but nothing
>>>>> related to json.
>>>>>
>>>>>   <engine name="xml-rpc-local"
>>>>> class="org.ofbiz.service.engine.XMLRPCClientEngine">
>>>>>              <parameter name="url"
>>>>> value="http://localhost:8080/webtools/control/xmlrpc"/>
>>>>>              <parameter name="login" value="admin"/>
>>>>>              <parameter name="password" value="ofbiz"/>
>>>>> </engine>
>>>>>
>>>>> Is there a way to add json handler ?? for example
>>>>> http://demo-trunk.ofbiz.apache.org/webtools/control/jsonrpc
>>>>>
>>>>> thank you.
>>>>
>> --
>> Thanks,
>> Deepak Agarwal,
>>
>> Paxcel Technologies Pvt Ltd.
>> Hartron Complex, Sector 18, Gurgaon, India.
>> E-Mail: [hidden email]
>> Mobile: +91 9910322604
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: JSON RPC

Deepak Agarwal-2
I have a little confusion now. Do I really need a REST service ? I need to
call a url and get the json/xml from external source and this I can do in
normal request -respnose fashion of controller.xml.

Any thoughts...

On Thu, Jul 5, 2012 at 12:45 PM, Amit <[hidden email]> wrote:

> Hi Deepak,
>
> I think in such case you can pass *@Context HttpServletRequest request* In
> your REST Service and use *request* object further.
>
> Thanks and Regards
> --
> Amit Sharma
>
>
> On Wednesday 04 July 2012 01:16 AM, Deepak Agarwal wrote:
>
>> I want to call search service from REST and hence ProductSearchSession
>> needs to be accessed but methods in this class requires
>> HttpServletRequest.
>>
>> On Wed, Jun 13, 2012 at 1:56 PM, Mansour Al Akeel<mansour.alakeel@gmail.*
>> *com <[hidden email]>
>>
>>> wrote:
>>> Amit,
>>> I gave it another thought, and I see what you mean. I need to modify
>>> the code and tweak it a bit and use it as a component to call another
>>> services. This will be fine for now, but I will lose control over some
>>> service that should not be exported. It will be nice if I can get the
>>> same as the xmlrpc. For now this should work. I am getting a
>>> nullPointerException with this code as the header is not being
>>> initialized properly or not injected.
>>>
>>>   @Context
>>>      HttpHeaders headers;
>>>
>>> I am still digging. Thank you a lot.
>>>
>>>
>>>
>>> On Wed, Jun 13, 2012 at 1:23 AM, Amit<[hidden email]**>
>>>  wrote:
>>>
>>>> Hi Mansour,
>>>>
>>>> In the given example if you change Response object to String using JSON,
>>>> that should work for you.
>>>>
>>>> Thanks and Regards
>>>> Amit Sharma
>>>>
>>>>
>>>> On Wednesday 13 June 2012 10:44 AM, Amit wrote:
>>>>
>>>>> Use REST https://cwiki.apache.org/**OFBIZ/export-service-using-**
>>>>> rest.html<https://cwiki.apache.org/OFBIZ/export-service-using-rest.html>
>>>>>
>>>>> HTH!
>>>>>
>>>>> Thank and Regards,
>>>>> Amit Sharma
>>>>>
>>>>> On Wednesday 13 June 2012 10:18 AM, Mansour Al Akeel wrote:
>>>>>
>>>>>> Is there a way to get JSON for all the services. Like SOAPService or
>>>>>> xmlrpc, I like to be able to call the service through http in the same
>>>>>> pattern:
>>>>>>
>>>>>> http://demo-trunk.ofbiz.**apache.org/webtools/control/**SOAPService/<http://demo-trunk.ofbiz.apache.org/webtools/control/SOAPService/>
>>>>>>
>>>>>> I looked in ./service/config/**serviceengine.xml but couldn't find
>>>>>> any
>>>>>> reference to JSON engine. The closest I found is xmlrpc but nothing
>>>>>> related to json.
>>>>>>
>>>>>>   <engine name="xml-rpc-local"
>>>>>> class="org.ofbiz.service.**engine.XMLRPCClientEngine">
>>>>>>              <parameter name="url"
>>>>>> value="http://localhost:8080/**webtools/control/xmlrpc<http://localhost:8080/webtools/control/xmlrpc>
>>>>>> "/>
>>>>>>              <parameter name="login" value="admin"/>
>>>>>>              <parameter name="password" value="ofbiz"/>
>>>>>> </engine>
>>>>>>
>>>>>> Is there a way to add json handler ?? for example
>>>>>> http://demo-trunk.ofbiz.**apache.org/webtools/control/**jsonrpc<http://demo-trunk.ofbiz.apache.org/webtools/control/jsonrpc>
>>>>>>
>>>>>> thank you.
>>>>>>
>>>>>
>>>>>  --
>>> Thanks,
>>> Deepak Agarwal,
>>>
>>> Paxcel Technologies Pvt Ltd.
>>> Hartron Complex, Sector 18, Gurgaon, India.
>>> E-Mail: [hidden email]
>>> Mobile: +91 9910322604
>>>
>>> --
>>> Thanks,
>>> Deepak Agarwal,
>>>
>>> Paxcel Technologies Pvt Ltd.
>>> Hartron Complex, Sector 18, Gurgaon, India.
>>> E-Mail: [hidden email]
>>> Mobile: +91 9910322604
>>>
>>>  <%2B91%209910322604>
>>
>>
Reply | Threaded
Open this post in threaded view
|

RE: JSON RPC

SkipDever
Here is a controller example:

    <request-map uri="getToolsFromCatagoryJSON">
        <security https="true" auth="true"/>
        <event type="java" path="com.fs.jobshop.JobshopEvents"
invoke="getToolsFromCatagoryJSON"/>
        <response name="success" type="none"/>
        <response name="error" type="none"/>
    </request-map>

Here is the function header:

    public static String getToolsFromCatagoryJSON(HttpServletRequest
request, HttpServletResponse response)


-----Original Message-----
From: [hidden email] [mailto:[hidden email]]On
Behalf Of Deepak Agarwal
Sent: Thursday, July 05, 2012 2:38 AM
To: [hidden email]
Subject: Re: JSON RPC


I have a little confusion now. Do I really need a REST service ? I need to
call a url and get the json/xml from external source and this I can do in
normal request -respnose fashion of controller.xml.

Any thoughts...

On Thu, Jul 5, 2012 at 12:45 PM, Amit <[hidden email]> wrote:

> Hi Deepak,
>
> I think in such case you can pass *@Context HttpServletRequest request* In
> your REST Service and use *request* object further.
>
> Thanks and Regards
> --
> Amit Sharma
>
>
> On Wednesday 04 July 2012 01:16 AM, Deepak Agarwal wrote:
>
>> I want to call search service from REST and hence ProductSearchSession
>> needs to be accessed but methods in this class requires
>> HttpServletRequest.
>>
>> On Wed, Jun 13, 2012 at 1:56 PM, Mansour Al Akeel<mansour.alakeel@gmail.*
>> *com <[hidden email]>
>>
>>> wrote:
>>> Amit,
>>> I gave it another thought, and I see what you mean. I need to modify
>>> the code and tweak it a bit and use it as a component to call another
>>> services. This will be fine for now, but I will lose control over some
>>> service that should not be exported. It will be nice if I can get the
>>> same as the xmlrpc. For now this should work. I am getting a
>>> nullPointerException with this code as the header is not being
>>> initialized properly or not injected.
>>>
>>>   @Context
>>>      HttpHeaders headers;
>>>
>>> I am still digging. Thank you a lot.
>>>
>>>
>>>
>>> On Wed, Jun 13, 2012 at 1:23 AM, Amit<[hidden email]**>
>>>  wrote:
>>>
>>>> Hi Mansour,
>>>>
>>>> In the given example if you change Response object to String using
JSON,

>>>> that should work for you.
>>>>
>>>> Thanks and Regards
>>>> Amit Sharma
>>>>
>>>>
>>>> On Wednesday 13 June 2012 10:44 AM, Amit wrote:
>>>>
>>>>> Use REST https://cwiki.apache.org/**OFBIZ/export-service-using-**
>>>>>
rest.html<https://cwiki.apache.org/OFBIZ/export-service-using-rest.html>

>>>>>
>>>>> HTH!
>>>>>
>>>>> Thank and Regards,
>>>>> Amit Sharma
>>>>>
>>>>> On Wednesday 13 June 2012 10:18 AM, Mansour Al Akeel wrote:
>>>>>
>>>>>> Is there a way to get JSON for all the services. Like SOAPService or
>>>>>> xmlrpc, I like to be able to call the service through http in the
same
>>>>>> pattern:
>>>>>>
>>>>>>
http://demo-trunk.ofbiz.**apache.org/webtools/control/**SOAPService/<http://
demo-trunk.ofbiz.apache.org/webtools/control/SOAPService/>

>>>>>>
>>>>>> I looked in ./service/config/**serviceengine.xml but couldn't find
>>>>>> any
>>>>>> reference to JSON engine. The closest I found is xmlrpc but nothing
>>>>>> related to json.
>>>>>>
>>>>>>   <engine name="xml-rpc-local"
>>>>>> class="org.ofbiz.service.**engine.XMLRPCClientEngine">
>>>>>>              <parameter name="url"
>>>>>>
value="http://localhost:8080/**webtools/control/xmlrpc<http://localhost:8080
/webtools/control/xmlrpc>
>>>>>> "/>
>>>>>>              <parameter name="login" value="admin"/>
>>>>>>              <parameter name="password" value="ofbiz"/>
>>>>>> </engine>
>>>>>>
>>>>>> Is there a way to add json handler ?? for example
>>>>>>
http://demo-trunk.ofbiz.**apache.org/webtools/control/**jsonrpc<http://demo-
trunk.ofbiz.apache.org/webtools/control/jsonrpc>

>>>>>>
>>>>>> thank you.
>>>>>>
>>>>>
>>>>>  --
>>> Thanks,
>>> Deepak Agarwal,
>>>
>>> Paxcel Technologies Pvt Ltd.
>>> Hartron Complex, Sector 18, Gurgaon, India.
>>> E-Mail: [hidden email]
>>> Mobile: +91 9910322604
>>>
>>> --
>>> Thanks,
>>> Deepak Agarwal,
>>>
>>> Paxcel Technologies Pvt Ltd.
>>> Hartron Complex, Sector 18, Gurgaon, India.
>>> E-Mail: [hidden email]
>>> Mobile: +91 9910322604
>>>
>>>  <%2B91%209910322604>
>>
>>