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

Serve/define XML-RPC methods without namespacing to a class/struct? #14

Closed
daluu opened this issue Oct 2, 2016 · 3 comments
Closed

Comments

@daluu
Copy link

daluu commented Oct 2, 2016

Hi,

Great project. I'm a novice at go, and looking at your example usage in the README, as well as the unit tests for gorilla/rpc, it looks like the class/struct is prefixed as namespace to the XML-RPC method being called/requested. For my particularly use case, the RPC method names are not "prefixed" with a class/namespace, but rather being global, so just a method name to call. e.g. call "say" or "Say" instead of "HelloService.Say".

I understand namespace is useful/necessary when serving from multiple structs or packages, but in my case, it would be a single one, so there's no ambiguity. And for my use case, the "client" is expecting to make the XML-RPC call without a namespace, so I don't have leeway to accommodate namespacing in the RPC request. Is there an option or way to make the RPC call omitting the namespace, more like just use a "global" namespace? I submitted a duplicate issue to gorilla/rpc#48 in case it's really more about gorilla/rpc than your XML extension of it.

For some background/history, the XML-RPC server I intend to build is serving multiple namespaced methods via use of reflection through a single wrapper class. I've done this same thing in other XML-RPC server implementations (for other languages, e.g. Perl, PHP, Java, .NET), would like to do for go now. The server I'm trying to build is a go implementation for https://github.com/robotframework/RemoteInterface, with the Python version being the reference implementation.

@daluu
Copy link
Author

daluu commented Oct 9, 2016

I guess for my particular case, an interim solution may be to patch this package's code to prepend the service package name (since it will be missing in the XML-RPC request) when passing on the data after the XML unmarshal process, if that would even work.

@Shark
Copy link

Shark commented Oct 15, 2016

There's a method RegisterAlias:

xmlrpcCodec := xml.NewCodec()
xmlrpcCodec.RegisterAlias("call", "System.Multicall")

Maybe this one already does everything you need...

@daluu
Copy link
Author

daluu commented Nov 27, 2016

Thanks, that seems to do the trick :)

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

No branches or pull requests

2 participants