Skip to content

fix: preserve all Services and Capabilities in GetServicesResponse#66

Open
GyeongHoKim wants to merge 3 commits into
use-go:masterfrom
GyeongHoKim:fix/getservices
Open

fix: preserve all Services and Capabilities in GetServicesResponse#66
GyeongHoKim wants to merge 3 commits into
use-go:masterfrom
GyeongHoKim:fix/getservices

Conversation

@GyeongHoKim

Copy link
Copy Markdown

Summary

Fixes two bugs in device.GetServicesResponse that made the parsed result diverge from what the ONVIF WSDL declares.

  • Service was a single value despite the WSDL declaring maxOccurs="unbounded", so every <Service> element except the last was silently dropped during unmarshal.
  • Service.Capabilities was an embedded type with an untagged Any string, so the per-service <Capabilities> payload (declared as xs:any with a service-specific namespace) was never captured — IncludeCapability=true was effectively useless.

Closes #65

- WSDL declares <Service> with maxOccurs="unbounded", but the Go struct held a single value
- Each unmarshalled <Service> overwrote the previous, so only the last survived
- Change Service to []Service so every entry is preserved
- WSDL declares <Capabilities> as xs:any with a service-specific namespace (trt, tev, tptz, ...)
- Old shape embedded a Capabilities type with an untagged Any string, so the payload was silently dropped
- Replace with a named ServiceCapabilities field whose Any string carries xml:",innerxml"
- Callers re-unmarshal the raw payload into the per-service capability type chosen by Service.Namespace
- PreservesAllServices: unmarshals a four-service payload and asserts every <Service> survives, guarding against the single-value field regression
- PreservesInnerXML: unmarshals a Media <Capabilities> block under trt, asserts Capabilities.Any captures the raw XML, then re-unmarshals into a service-specific type to confirm the consumption pattern
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

Successfully merging this pull request may close these issues.

GetServicesResponse drops all but the last service, and Capabilities is never parsed

1 participant