Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I use "system.multicall" to call more than one methods ? #39

Open
luxin88 opened this issue May 12, 2016 · 2 comments
Open

How can I use "system.multicall" to call more than one methods ? #39

luxin88 opened this issue May 12, 2016 · 2 comments

Comments

@luxin88
Copy link

luxin88 commented May 12, 2016

I am a golang new user.

but I don't know how can I call more than one methods at the same time, by using "system.multicall".

thanks alot.

@luxin88
Copy link
Author

luxin88 commented May 12, 2016

the xml request looks like this

<?xml version="1.0"?>
<methodCall>
    <methodName>system.multicall</methodName>
    <params>
        <param>
            <value>
                <array>
                    <data>
                        <value>
                            <struct>
                                <member>
                                    <name>methodName</name>
                                    <value>main.get_trx_state</value>
                                </member>
                                <member>
                                    <name>params</name>
                                    <value>
                                        <array>
                                            <data>
                                                <value><nil/></value>
                                            </data>
                                        </array>
                                    </value>
                                </member>
                            </struct>
                        </value>
                        <value>
                            <struct>
                                <member>
                                    <name>methodName</name>
                                    <value>main.get_frequency</value>
                                </member>
                                <member>
                                    <name>params</name>
                                    <value>
                                        <array>
                                            <data>
                                                <value><nil/></value>
                                            </data>
                                        </array>
                                    </value>
                                </member>
                            </struct>
                        </value>
                        <value>
                            <struct>
                                <member>
                                    <name>methodName</name>
                                    <value>rig.get_mode</value>
                                </member>
                                <member>
                                    <name>params</name>
                                    <value>
                                        <array>
                                            <data>
                                                <value><nil/></value>
                                            </data>
                                        </array>
                                    </value>
                                </member>
                            </struct>
                        </value>
                        <value>
                            <struct>
                                <member>
                                    <name>methodName</name>
                                    <value>rig.get_bandwidth</value>
                                </member>
                                <member>
                                    <name>params</name>
                                    <value>
                                        <array>
                                            <data>
                                                <value><nil/></value>
                                            </data>
                                        </array>
                                    </value>
                                </member>
                            </struct>
                        </value>
                    </data>
                </array>
            </value>
        </param>
    </params>
</methodCall>

@xmo-odoo
Copy link

Fundamentally there's nothing special to system.multicall, while it can have dedicated support in the library (as in python) it's not necessary.

It does need to be implemented in the server, but aside from that it's just a regular function which takes an array of {methodName, params} structs, and returns the corresponding responses array, where each response is either the result of calling the method, or a {faultCode, faultString} struct.

So yes, if the server you're accessing supports system.multicall you can call it by crafting the multicall by hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants