Send an entity to rest-service

I registered rest-services.xml in web-app.properties.
like this cuba.rest.servicesConfig = +kz/ensoft/portal/rest-services.xml

In rest-services.xml I point portal_RequestJoinService in such way

<?xml version="1.0" encoding="UTF-8"?>
<services xmlns="http://schemas.haulmont.com/cuba/rest-services-v2.xsd">
    <service name="portal_RequestJoinService">
        <method name="sendRequestJoin">
            <param name="requestJoin"/>
        </method>
        <method name="sendLogTest">
        </method>
    </service>
</services>

This is how portal_RequestJoinService.java looks like

public interface RequestJoinService {
    String NAME = "portal_RequestJoinService";
    void sendRequestJoin(RequestJoin requestJoin);
    void sendLogTest();
}

Finally, I gotta an edit page called portal-request-join-edit.html. It was created using cuba-studio via
Polimer UI → New → Entity-Management → Select appropriate views and tap on ‘Create’ button.

I tried to invoke service using
this.app.invokeService('portal_RequestJoinService', 'sendRequestJoin', this.entity)

but it sends all the fields of this entity separately, not the entity itself.
image

Please, help to pass entity correctly.

I create another method sendLogTest() it takes no parameters.
And when i inkove it, it works perfectly. That’s why i think there is no problem in configurations.

Maybe it would be better to @minaev answer this issue, because he already resolved another my ticket and he is kind of familiar with portal-request-join-edit.html.
Actually, he made a big contribution to it and i’m very grateful for him. Again, thank you Vald!

Hi, method parameter name is requestJoin so you should pass data in the following way:

this.app.invokeService('portal_RequestJoinService', 'sendRequestJoin', {requestJoin: this.entity})
1 Like