Comments (11)
I will try to grab some communication examples tomorrow I guess this will provide more details.
from go-xmlrpc.
Sorry for the late feedback, with https://github.com/alexejk/go-xmlrpc/releases/tag/v0.4.1 and the any
type Array it works like a charm. Thanks for your support and great library.
from go-xmlrpc.
Hi @graugans, I haven't seen a case like this but i think it should be possible to implement. I'll take a look at this
from go-xmlrpc.
This little guy behaves like this: https://www.ifm.com/us/en/product/O3D200 In case you have an idea or example, how this could be handled I can try it by myself.
from go-xmlrpc.
Do you have an example of how the payload looks like on the wire? XML-RPC should only have one parameter in the response.
An XML-RPC response can only contain one parameter, despite the use of the enclosing params element. That parameter, may, of course, be an array or a struct, so it is possible to return multiple values.
However what im trying to understand - does it respond with a struct + flexible amount of fields OR does it respond with multiple parameters directly?
from go-xmlrpc.
I've given it a quick stab based on the scarce information i have right now. You can give 0.5.0-RC1 a try when you have a moment, i will make a proper release if this works or after some fixes.
from go-xmlrpc.
Sorry for the delay, this was a busy day. A successful call captured in Wireshark looks like this:
POST /RPC1/ HTTP/1.1
Host: 10.121.123.14:8080
Accept-Encoding: gzip
Content-Type: text/xml
User-Agent: Python-xmlrpc/3.12
Content-Length: 109
<?xml version='1.0'?>
<methodCall>
<methodName>MDAXMLConnectCP</methodName>
<params>
</params>
</methodCall>
HTTP/1.1 200 OK
Server: XMLRPC++ 0.7
Content-Type: text/xml
Content-length: 222
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse><params><param>
<value><array><data><value><i4>0</i4></value><value>4099</value><value>O3D217AC</value></data></array></value>
</param></params></methodResponse>
When the device returns an error it looks like this:
POST /RPC1/ HTTP/1.1
Host: 10.121.123.14:8080
Accept-Encoding: gzip
Content-Type: text/xml
User-Agent: Python-xmlrpc/3.12
Content-Length: 109
<?xml version='1.0'?>
<methodCall>
<methodName>MDAXMLConnectCP</methodName>
<params>
</params>
</methodCall>
HTTP/1.1 200 OK
Server: XMLRPC++ 0.7
Content-Type: text/xml
Content-length: 183
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse><params><param>
<value><array><data><value><i4>-102</i4></value></data></array></value>
</param></params></methodResponse>
I have captured this with a small Python example.
I hopefully find some time on Thursday to give your branch a try
from go-xmlrpc.
Okay so your response contains a single array value, so that should just work by specifying that your response is expected to be an array. This would not require any modifications.
type MyResponse struct {
Response []any
}
However I've noticed that your system does NOT wrap all values in data types. First parameter is correctly wrapped into which identifies the integer. Problem is that second and third parameter in the array should be wrapped into or but they aren't.
Today the library will return nil on them...
I will look into changing implementation to have the flag that would default unknown types to string (or attempt at least) but that will likely come at certain tradeoffs.. Will get back to you on this.
from go-xmlrpc.
Yeah, the device is not behaving in an optimal way. Anyway according to the specification here: http://xmlrpc.com/spec.md the default is string
If no type is indicated, the type is string.
from go-xmlrpc.
Thats a good catch! then I don't need an extra flag for that. I will adjust the behavior, as this is clearly then a bug on my side.
from go-xmlrpc.
This should be resolved in v0.4.1. You can check the test-case i added with your data sample (slightly modified) for example how to do the data mapping for this type of responses.
from go-xmlrpc.
Related Issues (12)
- Support for decoding to aliased types
- Support decoding to pointer of struct
- Passing arguments to the call
- Error handling HOT 2
- Dependabot couldn't parse the config file at .dependabot/config.yml
- How are the parameters sorted?
- Need a script to transform xml request to RPC call struct HOT 2
- panic when fields not define on response struct HOT 2
- Your .dependabot/config.yml contained invalid details
- Possible goroutines leak HOT 1
- Allow customization of User-Agent
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-xmlrpc.