Re: [go-nuts] xml namespaces - encoding ok, decoding result not ok

2017-08-02 Thread roger peppe
It seems to me like your unmarshaling isn't actually working (look inside the decoded data). Here's an alternative version: https://play.golang.org/p/CAChEa4-Kp It's still not exactly right, as the DID tag is in the empty namespace in the original XML, but is in os.xsd.v1 in the encoded version.

Re: [go-nuts] xml namespaces - encoding ok, decoding result not ok

2017-08-02 Thread Marcin Jurczuk
Here is fully working/not working/not working example with whole SOAP envelope I'm getting from server: If I use different structs for encoding/decoding it works. https://play.golang.org/p/hVzB0lh2WH Change line: rx := new(SOAPEnvelope2) to: rx := new(SOAPEnvelope) And you will get error that

Re: [go-nuts] xml namespaces - encoding ok, decoding result not ok

2017-08-02 Thread Konstantin Khomoutov
On Tue, Aug 01, 2017 at 10:48:23AM -0700, Marcin Jurczuk wrote: > Your example is returning xml that is wrong from system I'm talking to. > My SOAP service requires tags in few different namespaces. > My code returns: > > * * > > Your code returns: > > ** [...] > > > https://play.golang.org/p/

Re: [go-nuts] xml namespaces - encoding ok, decoding result not ok

2017-08-01 Thread roger peppe
The sample XML in your code doesn't appear to be valid - it doesn't actually define the namespace that the os namespace prefix refers to. I am fully aware that encoding/xml has bugs, but I'm not sure that this is one of them. On 1 August 2017 at 18:48, Marcin Jurczuk wrote: > Your example is ret

Re: [go-nuts] xml namespaces - encoding ok, decoding result not ok

2017-08-01 Thread Marcin Jurczuk
Your example is returning xml that is wrong from system I'm talking to. My SOAP service requires tags in few different namespaces. My code returns: * * Your code returns: ** etc. Such syntax is not ok. My Service is returning error. With my syntax - I'm getting responses. Of course os

Re: [go-nuts] xml namespaces - encoding ok, decoding result not ok

2017-08-01 Thread roger peppe
Namespaces are space-separated from tag names in the struct tags. Changing that seems to make your example work OK: https://play.golang.org/p/GBvhcWLew_ >From the encoding/xml docs: If the XMLName field has an associated tag of the form "name" or "namespace-URL name", the XML element must

[go-nuts] xml namespaces - encoding ok, decoding result not ok

2017-08-01 Thread Marcin Jurczuk
Hi gophers, I stuck with something that supposed to be easy - XML decoding. Encoding works perfeclty. I'm trying for past two days to find working code for parsing SOAP message. I have structures that are encoded correctly but decoding responses (same structure, just filled with values) is faili