Comments (15)
It seems to be a namespace issue. Go XML package doesn't support namespace prefixes yet but it does set the namespace attribute on each element explicitly instead. That NRCS service doesn't seem to be aware of this and is rejecting what I would consider a valid SOAP request that is at the same time WS-I compliant.
Assuming they are using Java, by default the native Java DOMBuilderFactory is configured to ignore namespaces, thus <getStations xmlns="http://www.wcc.nrcs.usda.gov/ns/awdbWebService"></getStations>
is considered an unexpected element. They need to instruct their unmarshaller to be aware of namespaces in elements, like so: http://stackoverflow.com/a/24399323/2807845. But, considering that's a government service, I guess, we will have to work around that issue somehow. Any help is very much appreciated as I'm out of extra cycles right now.
from gowsdl.
If you could give some direction, I could try working something out. I also actually know some of the people that work for the NRCS on this service in particular, although unlikely, might be able to do something on that end.
from gowsdl.
FWIW, I did improve a little bit error reporting when SOAP faults are received: 8cdcd28
from gowsdl.
@EntilZha these guys ran somewhat into a similar issue and worked around it: https://bitbucket.org/anacrolix/dms/commits/fbd23ce
from gowsdl.
Regarding direction, I would start by reading how the Go xml package is currently dealing with namespaces to see if they can be easily defined at the top of the XML document, using prefixes. In other words, I would try to tackling this issue: https://code.google.com/p/go/issues/detail?id=6800
from gowsdl.
So just to test my understanding, the issue is the xmlns attribute on the getStations element? If it were not there, it would work correctly (it is not related to the "tns" in tns:getStations)?
So the "fix" would be figuring out a way to stick this at the top of the xml doc?
<Envelope xmlns:tns="http://...">
from gowsdl.
So just to test my understanding, the issue is the xmlns attribute on the getStations element?
Yes, it has to be replaced by a namespace prefix in the element instead.
So the "fix" would be figuring out a way to stick this at the top of the xml doc?
Yes, and setting the namespace with the prefix like so <tns:getStations></tns:getStation>
instead of the URL repeated in each element of the XML document. The prefix will have to be auto-generated too, making sure it is unique within the document.
from gowsdl.
I look forward to seeing how you guys deal with this. As far as I'm concerned XML is an unfortunate necessity and poorly supported by the Go standard library. I also found that Go's "size optimizations" regarding " and ' caused problems with some decoders.
from gowsdl.
Any advice on where I might learn to get an idea of what I will need to do in order to accomplish that? (Reading through the prior link, wondering other resources to in general get knowledge required since I am not super savy on xml/soap prior to this)
from gowsdl.
Hey @EntilZha, apologies for the very late response. So, in addition to what I previously mentioned regarding how to start tackling this issue, I would also suggest asking in the golang-dev mailing list. By the way, the issue was moved to golang/go#6800.
from gowsdl.
I ended up on using Scala for this project in part for native support through existing Java libraries (in part from preference) and am too busy to work on this separately. If I end up having time in the future, I will take your advice though. Thanks
from gowsdl.
I was able to resolve this issue by using another package : https://github.com/jteeuwen/go-pkg-xmlx , this package transformed the xml into an node struct, which I was then able to parse and reassign the name spaces in accordance to the headers. Then perform a SaveDoc and voila nicely marshelled document
from gowsdl.
@notzippy, nice! do you think we could use that library in gowsdl?
from gowsdl.
Hoping to, I am working through a solution... will let you know what I have in the form of a PR later
from gowsdl.
ah, great! thank you!
from gowsdl.
Related Issues (20)
- How to remove tag Headers in <soap:Header> HOT 2
- encoding/xml error when field metadata doesn't match XMLName
- Referenced elements of type "xs:dateTime" et al. cannot be marshaled HOT 1
- Namespace support: naming collisions / redeclared types in different namespaces HOT 1
- XML name field tag conflicts with struct's XMLName field
- dump request
- Error when parsing response: Expected param start-info="application/soap+xml", got text/xml HOT 2
- Incorrect namespace handling HOT 5
- Empty strings in enums results in broken code HOT 1
- nodes with multiple namespace are not resolved by the generated code
- Some complex types are missing the namespace
- Separation of generated code into packages HOT 2
- 1511:11: expected type, found '-' (and 3 more errors) HOT 2
- Namespace problem HOT 3
- Cut a new Release v0.6.0 HOT 1
- Failing test TestEPCISWSDL HOT 1
- gowsdl does not respect the targetNamespace value on wsdl definition.
- SOAP Header element not present
- generate code from wsdl HOT 1
- date format: cannot unmarshal into soap.XSDDate
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 gowsdl.