How can I call the servicedef/service.xml in the freemarker?

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

How can I call the servicedef/service.xml in the freemarker?

gavinju
Hello,
I have defined a service in the servicedef/services.xml, So how can I call the service in my freemarker?
Who can help me, Please give me some ideas ?


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

Re: How can I call the servicedef/service.xml in the freemarker?

Rong Nguyen
hi Gavinju,
Your service may be called by mapping form's action to the URI in
controller.xml file(request-map), and then you declare it.
for example: your form with action is 'createPartyRelationship'
<request-map uri="createPartyRelationship">
        <security https="true" auth="true"/>
        <event type="service" path="" invoke="createPartyRelationship"/>
        <response name="success" type="view-last"
value="EditPartyRelationships"/>
        <response name="error" type="view" value="EditPartyRelationships"/>
    </request-map>

*RONG NGUYEN (Mr)*

*OLBIUS FOUNDER**Email:* [hidden email] | *Mobile:* (+84) 902
2468 45

*OLBIUS., JSC*
*Tel:* (+84) 9 88 99 3333
*Address: *6th Fl., No 195, Kham Thien St., Ha Noi City, VietNam
*Website:* http://olbius.com


On Tue, Apr 1, 2014 at 8:21 AM, gavinju [via OFBiz] <
[hidden email]> wrote:

> Hello,
> I have defined a service in the servicedef/services.xml, So how can I call
> the service in my freemarker?
> Who can help me, Please give me some ideas ?
>
>
> Thank you.
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://ofbiz.135035.n4.nabble.com/How-can-I-call-the-servicedef-service-xml-in-the-freemarker-tp4650039.html
>  To start a new topic under OFBiz - User, email
> [hidden email]
> To unsubscribe from OFBiz - User, click here<
> .
> NAML<
http://ofbiz.135035.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




-----
Rong Nguyen

Olbius JSC
Deliver highest business value
http://www.olbius.com/
--
View this message in context: http://ofbiz.135035.n4.nabble.com/How-can-I-call-the-servicedef-service-xml-in-the-freemarker-tp4650039p4650040.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Rong Nguyen

Olbius JSC
Deliver highest business value
http://www.olbius.com/
Reply | Threaded
Open this post in threaded view
|

Re: How can I call the servicedef/service.xml in the freemarker?

Rong Nguyen
In reply to this post by gavinju
hi Gavinju,
Your service may be called by mapping form's action to the URI in controller.xml file(request-map), and then you declare it.
for example: your form with action is 'createPartyRelationship'
<request-map uri="createPartyRelationship">
        <security https="true" auth="true"/>
        <event type="service" path="" invoke="createPartyRelationship"/>
        <response name="success" type="view-last" value="EditPartyRelationships"/>
        <response name="error" type="view" value="EditPartyRelationships"/>
    </request-map>
Rong Nguyen

Olbius JSC
Deliver highest business value
http://www.olbius.com/
Reply | Threaded
Open this post in threaded view
|

Re: How can I call the servicedef/service.xml in the freemarker?

Rong Nguyen
If you mean "call service from Java code", the following code is one way:
DispatchContext dctx = Method_or_parameter;
LocalDispatcher lcDispatcher = dctx.getDispatcher();
Map inputMap = Your_init_method;
resultMap = lcDispatcher.runSync("Your_target_service",
inputMap);
Rong Nguyen

Olbius JSC
Deliver highest business value
http://www.olbius.com/
Reply | Threaded
Open this post in threaded view
|

Re: How can I call the servicedef/service.xml in the freemarker?

gavinju
Thank you for your help.

My case is, For example, in PartyMenus.xml: "
<menu-item align-style="party07" name="security" title="${uiLabelMap.CommonSecurity}">
     <condition>
         <if-service-permission service-name="partyBasePermissionCheck" main-action="VIEW"/>
     </condition>
     <link target="FindSecurityGroup"/>
</menu-item>
"
Now, because some reasean, I have rewrite the code using freemarker.
In my freemarker, my code is :
<a href="${contextPath}/control/FindSecurityGroup">${uiLabelMap.CommonSecurity}
but how can I invoke the service-name in my freemarker?
Reply | Threaded
Open this post in threaded view
|

Re: How can I call the servicedef/service.xml in the freemarker?

Rong Nguyen
You can create one screen and then include this screen in your ftl:

<screen name="test">
<section>
<condition>
<if-service-permission service-name="partyBasePermissionCheck" main-action="VIEW"/>
</condition>
<widgets>
<link target="/control/FindSecurityGroup" text="${uiLabelMap.CommonSecurity}"></link>
</widgets>
</section>
</screen>

Or you can check permission directly in ftl.


RONG NGUYEN (Mr)
OLBIUS FOUNDER
Email: [hidden email] | Mobile: (+84) 902 2468 45

OLBIUS., JSC
Tel: (+84) 9 88 99 3333
Address: 6th Fl., No 195, Kham Thien St., Ha Noi City, VietNam
Website: http://olbius.com


On Tue, Apr 1, 2014 at 12:23 PM, gavinju [via OFBiz] <[hidden email]> wrote:
Thank you for your help.

My case is, For example, in PartyMenus.xml: "
<menu-item align-style="party07" name="security" title="${uiLabelMap.CommonSecurity}">
     <condition>
         <if-service-permission service-name="partyBasePermissionCheck" main-action="VIEW"/>
     </condition>
     <link target="FindSecurityGroup"/>
</menu-item>
"
Now, because some reasean, I have rewrite the code using freemarker.
In my freemarker, my code is :
<a href="${contextPath}/control/FindSecurityGroup">${uiLabelMap.CommonSecurity}

but how can I invoke the service-name in my freemarker?


If you reply to this email, your message will be added to the discussion below:
http://ofbiz.135035.n4.nabble.com/How-can-I-call-the-servicedef-service-xml-in-the-freemarker-tp4650039p4650044.html
To start a new topic under OFBiz - User, email [hidden email]
To unsubscribe from OFBiz - User, click here.
NAML

Rong Nguyen

Olbius JSC
Deliver highest business value
http://www.olbius.com/
Reply | Threaded
Open this post in threaded view
|

Re: How can I call the servicedef/service.xml in the freemarker?

gavinju
Thank you very much.
I have solved the problem follow your solution.

Best Regards
Gavin.Ju