Closed GaikwadPratik closed 2 years ago
Hi @GaikwadPratik ,
It seems you've made a typo with extra 1
at the end of the interface name here you could use InterfaceCom_Hiveio_Vm_Manager
constant to avoid this.
Also fixed the error with unused imports, can you try the latest version?
Hi @amenzhinsky,
1
in here is to provide you with two different services. I couldn't think of better name at the time so I added 1
. I could very well use hardcoded
instead of 1
go get -u github.com/amenzhinsky/dbus-codegen-go@latest
gives me v0.2.0
com.hiveio.vm.Manager1
, but client is calling com.hiveio.vm.Manager
without 1, that's why you're getting the error.@master
Hi @amenzhinsky ,
I updated my source code to include name hardcoded
instead of 1
to avoid confusion. There are two different services. I'm invoking each one of them in both.
golang
javascript
here is the out put that I get
root@hive1:~# ./goclient
{"level":"error","error":"Object does not implement the interface","time":"2021-06-24T12:06:54Z","message":"While checking host for migration in hardcoded call"}
{"level":"debug","val":true,"time":"2021-06-24T12:06:54Z","message":"Recived response in generator call"}
^C{"level":"warn","time":"2021-06-24T12:07:01Z","message":"Adios!"}
root@hive1:~# node client/index.js
hardcoded worked
{ DBusError: Object does not implement the interface
at _methodReturnHandlers.(anonymous function) (/root/client/node_modules/dbus-next/lib/bus.js:343:27)
at handleMessage (/root/client/node_modules/dbus-next/lib/bus.js:101:11)
at EventEmitter.MessageBus.conn.on (/root/client/node_modules/dbus-next/lib/bus.js:151:9)
at EventEmitter.emit (events.js:198:13)
at /root/client/node_modules/dbus-next/lib/connection.js:116:14
at Socket.<anonymous> (/root/client/node_modules/dbus-next/lib/message.js:63:9)
at Socket.emit (events.js:198:13)
at emitReadable_ (_stream_readable.js:555:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
name: 'DBusError',
type: 'org.freedesktop.DBus.Error.UnknownInterface',
text: 'Object does not implement the interface',
reply:
Message {
type: 3,
_sent: false,
_serial: 7,
path: undefined,
interface: undefined,
member: undefined,
errorName: 'org.freedesktop.DBus.Error.UnknownInterface',
replySerial: 2,
destination: ':1.45',
sender: ':1.41',
signature: 's',
body: [ 'Object does not implement the interface' ],
flags: 0 } } 'Inside generator'
I think I understand what you are saying here for invoking hardcoded service from generated goclient. But I am more concerned about javascript
part
You did the same mistake, generated client is calling exactly com.hiveio.vm.Manager
, not *1
, not *hardcoded
https://github.com/GaikwadPratik/dbus-local-test/blob/master/server/goclient/client.go#L11 https://github.com/GaikwadPratik/dbus-local-test/blob/master/server/goclient/client.go#L27
So server MUST export the same interface here: https://github.com/GaikwadPratik/dbus-local-test/blob/master/server/goserver/main.go#L51
I think I understand what you are saying here for invoking hardcoded service from generated goclient. But I am more concerned about javascript part
JS does call both of them: https://github.com/GaikwadPratik/dbus-local-test/blob/master/client/index.js#L5-L7 https://github.com/GaikwadPratik/dbus-local-test/blob/master/client/index.js#L19-L21
@amenzhinsky ,
I'm not sure if this helps or not but I get this with qdbus
for the bindings using generator
root@hive1:~# qdbus --system com.hiveio.vmmanager /com/hiveio/vmmanager
Error: org.freedesktop.DBus.Error.UnknownInterface
Object does not implement the interface
for the inline hardcoded service
root@hive1:~# qdbus --system com.hiveio.vmmanagerhardcoded /com/hiveio/vmmanagerhardcoded
method bool com.hiveio.vm.Managerhardcoded.CheckHostForMigration(QString, QString)
method void com.hiveio.vm.Managerhardcoded.RecoverGuest(QString, QString)
method void com.hiveio.vm.Managerhardcoded.RecoverUservolume(QString guestName, QString username)
method QString org.freedesktop.DBus.Introspectable.Introspect()
root@hive1:~
@amenzhinsky ,
When I'm exposing service using godbus/dbus server example, I noticed it added a Introspectable
interface and exported both custom interface
and introspectable
interface on the bus to object path defined. But the server generated using dbus-codegen-go
doesn't add that. Even if I add the introspectable
interface manually in the xml, it is still not exported.
My observation is based on qdbus
as well deus-send
root@hive1:~# dbus-send --system --dest=com.hiveio.vmmanager --type=method_call --print-reply /com/hiveio/vmmanager org.freedesktop.DBus.Introspectable.Introspect
Error org.freedesktop.DBus.Error.UnknownInterface: Object does not implement the interface
root@hive1:~# dbus-send --system --dest=com.hiveio.vmmanagerhardcoded --type=method_call --print-reply /com/hiveio/vmmanagerhardcoded org.freedesktop.DBus.Introspectable.Introspect
method return time=1624681884.126838 sender=:1.389 -> destination=:1.397 serial=5 reply_serial=2
string "
<node>
<interface name="com.hiveio.vmmanagerhardcoded">
<method name="CheckHostForMigration">
<arg name="guestName" direction="in" type="s"/>
<arg name="cpuxml" direction="in" type="s"/>
<arg name="result" direction="out" type="b"/>
</method>
<method name="RecoverGuest">
<arg name="guestName" direction="in" type="s"/>
<arg name="reason" direction="in" type="s"/>
</method>
<method name="RecoverUservolume">
<arg name="guestName" direction="in" type="s"/>
<arg name="username" direction="in" type="s"/>
</method>
</interface>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="out" direction="out" type="s"/>
</method>
</interface>
</node> "
In both the cases, I'm not using any client. So no mistake of using incorrect interface name or something like that
can you please help? If its something beyond the scope of the library, please do let me know so I'll just continue to maintain inline xml
Seems like this library implements and calls UnexportOrgFreedesktopDBusIntrospectable
so regular Introspectable
interface will not be available.
@amenzhinsky ,
I am currently using the library to generate
server
bindings with example mentioned in client-server example with following command:dbus-codegen-go -package=main -output=dbusserver/server.go -server-only dbusserver/service.xml
When I start dbus server that, I get error on the client side when I invoke generator interface:
However if I hard-code the xml inside the code as mentioned in the dbus-server example, it works just fine.
Same client is being used for calling the server code
I've created a sample project which I uploaded to my github for easiness.
I updated the my github example to include goclient using this library as well and I get same error but this time for
hardcoded
method.Also in the client code, I get below errors:
Can you point me what am I doing wrong?
P.S. Awesome library