How does service event type work

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

How does service event type work

Ritesh Trivedi
Hi,

This is probably a basic question - but I could understand how it works.

I am looking at controller.xml file in e-commerce application. Specific line is

<request-map uri="emailorder">
        <security https="true" direct-request="false"/>
        <event type="service" path="async" invoke="sendOrderConfirmation"/>
...

I see that event is of type service, so the service is invoked when the uri is called. However what I dont understand is how are the contexts, both dispatch context and the values context for the service IN variables, passed in this case?

Will appreciate any pointers
Reply | Threaded
Open this post in threaded view
|

Re: How does service event type work

BJ Freeman
look for:
http://docs.ofbiz.org/display/OFBTECH/Framework+Introduction+Videos+and+Diagrams
#6 Service Definitions and Implementations
then if you have a xml editor that reads the xsd files you will see choices.
usually events are in
like:
script/org/ofbiz/example/example/ExampleServices.xml


Ritz123 sent the following on 7/22/2008 3:47 PM:

> Hi,
>
> This is probably a basic question - but I could understand how it works.
>
> I am looking at controller.xml file in e-commerce application. Specific line
> is
>
> <request-map uri="emailorder">
>         <security https="true" direct-request="false"/>
>         <event type="service" path="async" invoke="sendOrderConfirmation"/>
> ...
>
> I see that event is of type service, so the service is invoked when the uri
> is called. However what I dont understand is how are the contexts, both
> dispatch context and the values context for the service IN variables, passed
> in this case?
>
> Will appreciate any pointers

Reply | Threaded
Open this post in threaded view
|

Re: How does service event type work

Ritesh Trivedi
Thanks for the reply BJ.

Not sure if I was clear in my question. I know where the service is defined, I also know how services are called etc. But what I dont understand in this case is where is how is the context passed? e.g every service call needs context to be passed so in this case, who is creating the context and where, is the question.

BJ Freeman wrote
look for:
http://docs.ofbiz.org/display/OFBTECH/Framework+Introduction+Videos+and+Diagrams
#6 Service Definitions and Implementations
then if you have a xml editor that reads the xsd files you will see choices.
usually events are in
like:
script/org/ofbiz/example/example/ExampleServices.xml


Ritz123 sent the following on 7/22/2008 3:47 PM:
> Hi,
>
> This is probably a basic question - but I could understand how it works.
>
> I am looking at controller.xml file in e-commerce application. Specific line
> is
>
> <request-map uri="emailorder">
>         <security https="true" direct-request="false"/>
>         <event type="service" path="async" invoke="sendOrderConfirmation"/>
> ...
>
> I see that event is of type service, so the service is invoked when the uri
> is called. However what I dont understand is how are the contexts, both
> dispatch context and the values context for the service IN variables, passed
> in this case?
>
> Will appreciate any pointers
Reply | Threaded
Open this post in threaded view
|

Re: How does service event type work

Adrian Crum
All of that is handled automatically by the request handler and the
service engine. The request handler will pass the request parameters to
the service engine. The service engine will put those parameters in the
context along with some other objects, like userLogin, locale, timeZone,
etc.

-Adrian

Ritz123 wrote:

> Thanks for the reply BJ.
>
> Not sure if I was clear in my question. I know where the service is defined,
> I also know how services are called etc. But what I dont understand in this
> case is where is how is the context passed? e.g every service call needs
> context to be passed so in this case, who is creating the context and where,
> is the question.
>
>
> BJ Freeman wrote:
>> look for:
>> http://docs.ofbiz.org/display/OFBTECH/Framework+Introduction+Videos+and+Diagrams
>> #6 Service Definitions and Implementations
>> then if you have a xml editor that reads the xsd files you will see
>> choices.
>> usually events are in
>> like:
>> script/org/ofbiz/example/example/ExampleServices.xml
>>
>>
>> Ritz123 sent the following on 7/22/2008 3:47 PM:
>>> Hi,
>>>
>>> This is probably a basic question - but I could understand how it works.
>>>
>>> I am looking at controller.xml file in e-commerce application. Specific
>>> line
>>> is
>>>
>>> <request-map uri="emailorder">
>>>         <security https="true" direct-request="false"/>
>>>         <event type="service" path="async"
>>> invoke="sendOrderConfirmation"/>
>>> ...
>>>
>>> I see that event is of type service, so the service is invoked when the
>>> uri
>>> is called. However what I dont understand is how are the contexts, both
>>> dispatch context and the values context for the service IN variables,
>>> passed
>>> in this case?
>>>
>>> Will appreciate any pointers
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: How does service event type work

BJ Freeman
In reply to this post by Ritesh Trivedi
if you look in
applications/order/servicedef/services.xml
for sendOrderConfirmation
which takes you eventually to the
org.ofbiz.order.order.OrderServices"
public static Map sendOrderConfirmNotification(DispatchContext ctx, Map
context) {

in short you don't have to worry about it. it is done for you and you
get it as context in the service (java)


Ritz123 sent the following on 7/22/2008 4:38 PM:

> Thanks for the reply BJ.
>
> Not sure if I was clear in my question. I know where the service is defined,
> I also know how services are called etc. But what I dont understand in this
> case is where is how is the context passed? e.g every service call needs
> context to be passed so in this case, who is creating the context and where,
> is the question.
>
>
> BJ Freeman wrote:
>> look for:
>> http://docs.ofbiz.org/display/OFBTECH/Framework+Introduction+Videos+and+Diagrams
>> #6 Service Definitions and Implementations
>> then if you have a xml editor that reads the xsd files you will see
>> choices.
>> usually events are in
>> like:
>> script/org/ofbiz/example/example/ExampleServices.xml
>>
>>
>> Ritz123 sent the following on 7/22/2008 3:47 PM:
>>> Hi,
>>>
>>> This is probably a basic question - but I could understand how it works.
>>>
>>> I am looking at controller.xml file in e-commerce application. Specific
>>> line
>>> is
>>>
>>> <request-map uri="emailorder">
>>>         <security https="true" direct-request="false"/>
>>>         <event type="service" path="async"
>>> invoke="sendOrderConfirmation"/>
>>> ...
>>>
>>> I see that event is of type service, so the service is invoked when the
>>> uri
>>> is called. However what I dont understand is how are the contexts, both
>>> dispatch context and the values context for the service IN variables,
>>> passed
>>> in this case?
>>>
>>> Will appreciate any pointers
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: How does service event type work

Ritesh Trivedi
In reply to this post by Adrian Crum
Thanks Adrian for the reply.

Feel stupid now, now I recall that event handlers have the house keeping logic for the event, so for the completion of the thread the context is built in the ServiceEventHandler.java.

Adrian Crum wrote
All of that is handled automatically by the request handler and the
service engine. The request handler will pass the request parameters to
the service engine. The service engine will put those parameters in the
context along with some other objects, like userLogin, locale, timeZone,
etc.

-Adrian

Ritz123 wrote:
> Thanks for the reply BJ.
>
> Not sure if I was clear in my question. I know where the service is defined,
> I also know how services are called etc. But what I dont understand in this
> case is where is how is the context passed? e.g every service call needs
> context to be passed so in this case, who is creating the context and where,
> is the question.
>
>
> BJ Freeman wrote:
>> look for:
>> http://docs.ofbiz.org/display/OFBTECH/Framework+Introduction+Videos+and+Diagrams
>> #6 Service Definitions and Implementations
>> then if you have a xml editor that reads the xsd files you will see
>> choices.
>> usually events are in
>> like:
>> script/org/ofbiz/example/example/ExampleServices.xml
>>
>>
>> Ritz123 sent the following on 7/22/2008 3:47 PM:
>>> Hi,
>>>
>>> This is probably a basic question - but I could understand how it works.
>>>
>>> I am looking at controller.xml file in e-commerce application. Specific
>>> line
>>> is
>>>
>>> <request-map uri="emailorder">
>>>         <security https="true" direct-request="false"/>
>>>         <event type="service" path="async"
>>> invoke="sendOrderConfirmation"/>
>>> ...
>>>
>>> I see that event is of type service, so the service is invoked when the
>>> uri
>>> is called. However what I dont understand is how are the contexts, both
>>> dispatch context and the values context for the service IN variables,
>>> passed
>>> in this case?
>>>
>>> Will appreciate any pointers
>>
>>
>