hooklift / gowsdl

WSDL2Go code generation as well as its SOAP proxy
Mozilla Public License 2.0
1.15k stars 389 forks source link

WSDL on Snotel, request successful, response empty #15

Closed EntilZha closed 9 years ago

EntilZha commented 9 years ago

First, love your package, definitely fills a need. Found a bug/feature request and would be willing to work on it given some guidance.

I am working with the wsdl service here: http://www.wcc.nrcs.usda.gov/web_service/awdb_web_service_landing.htm

My code calling gowsdl is below

const serviceUrl string = "http://www.wcc.nrcs.usda.gov/awdbWebService/services"

func GetStations() (*struct{}, error) {
    request := getStations{}
    service := NewAwdbWebService(serviceUrl, false)
    var response struct{}
    err := service.client.Call("getStations", request, &response)
    fmt.Println(response)
    return &response, err
}

When I read the println, I get an empty interface. I took a look in wireshark and I get this response

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:getStationsResponse xmlns:ns2="http://www.nrcs.usda.gov/ns/awdbWebService">
<return>2057:AL:SCAN</return>
... (continues for a while in this style)
</ns2:getStationsResponse>
</soap:Body>
</soap:Envelope>

Don't know very much about gowsdl/wsdl internals, but it looks like although there is a response, there is some parsing error perhaps because the service isn't conforming to some expected/well formatted response?

c4milo commented 9 years ago

It's not generating operations for some reason. I'm looking into it.

c4milo commented 9 years ago

Ah, it is because soapAction is empty in all the declared operations in that WSDL. I'm doing some more research to see what I can do about it while still keeping compliance with the WS-I profile.

c4milo commented 9 years ago

Fixed in https://github.com/cloudescape/gowsdl/commit/3df82daec280c7a6aba78e2bff11dc1f5dd8eeae

c4milo commented 9 years ago

I also created an example of how to invoke operations from the USDA webservice here: https://github.com/cloudescape/gowsdl/tree/master/examples/usda-awdb

c4milo commented 9 years ago

Thanks @EntilZha for your bug report and please let me know if you hit any other issue.

EntilZha commented 9 years ago

Thanks for the fix, works super well, repo starred :)