Giter VIP home page Giter VIP logo

gowsdl's Introduction

WSDL to Go

Gitter GoDoc Build Status

Generates Go code from a WSDL file.

Install

  • Download release
  • Download and build locally
    • 1.15: go get github.com/hooklift/gowsdl/...
    • 1.20: go install github.com/hooklift/gowsdl/cmd/gowsdl@latest
  • Install from Homebrew: brew install gowsdl

Goals

  • Generate idiomatic Go code as much as possible
  • Support only Document/Literal wrapped services, which are WS-I compliant
  • Support:
    • WSDL 1.1
    • XML Schema 1.0
    • SOAP 1.1
  • Resolve external XML Schemas
  • Support external and local WSDL

Caveats

  • Please keep in mind that the generated code is just a reflection of what the WSDL is like. If your WSDL has duplicated type definitions, your Go code is going to have the same and may not compile.

Usage

Usage: gowsdl [options] myservice.wsdl
  -o string
        File where the generated code will be saved (default "myservice.go")
  -p string
        Package under which code will be generated (default "myservice")
  -i    Skips TLS Verification
  -v    Shows gowsdl version

gowsdl's People

Contributors

54niyu avatar anjmao avatar c4milo avatar cursork avatar dmarkhas avatar dwhutchison avatar giovanni-orciuolo avatar gitter-badger avatar iszak avatar jgersdorf avatar kylescottmcgill avatar lizapolyudova avatar maddyblue avatar md5 avatar mitch000001 avatar nkobber avatar nmfr avatar notzippy avatar npenkov avatar ori-moisis avatar rahmanme avatar realmfoo avatar ronoaldo avatar sanbornm avatar sfqsfq avatar soh335 avatar tgulacsi avatar thomasobenaus avatar w65536 avatar ymouncef avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gowsdl's Issues

External Schemas Not Supported

If a wsdl file references a schema at a separate URL, which contains types, gowsdl will not read that schema file, and as a result, those types will not be generated, and errors will be generated during the build process.

My workaround has been to copy the contents of the external schema into the wsdl file, which then allows gowsdl to generate all of the client info for the web service.

Is there some way to store namespace at struct`s field level?

Hi, Ive come with the problem of getting proper structs when wsdl has more than one namespace (therefor prefix).

Considering my expected XML should looks like:

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Header xmlns="http://schemas.xmlsoap.org/soap/envelope/"/>
<Body xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<MyRequest xmlns="http://somthin1"
<SubTag xmlns="http://somethin2"/>
</MyRequest>
</Body>
</Header>
</Envelope>

I have a respective WSDL file that describes a a model to be:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:prefix1="http://somethin1" xmlns:prefix2="http://somethin2">
<soapenv:Header>
<soapenv:Body>
<prefix1:MyRequest>
<prefix2:SubTag/>
</MyRequest>
</Body>
</Header>
</Envelope>

Having go not working with multiple prefexis i would be fine to have namespaces written inline (expected XML - see above).
Is it possible to do with gowsdl package? In case its not, what would be my change to have it?

Element type renaming

I will start off with I am no wsdl expert - given the following wsdl fragment

<xsd:element name="ValidateCityPostalCodeZipRequestContainer" nillable="true" type="tns:ValidateCityPostalCodeZipRequestContainer"/>
<xsd:complexType name="ArrayOfShortAddress">
  <xsd:sequence>
    <xsd:element minOccurs="0" maxOccurs="unbounded" name="ShortAddress" nillable="true" type="tns:ShortAddress"/>
  </xsd:sequence>
  </xsd:complexType>
    <xsd:element name="ArrayOfShortAddress" nillable="true" type="tns:ArrayOfShortAddress"/>
    <xsd:element name="ValidateCityPostalCodeZipRequest" nillable="true" type="tns:ValidateCityPostalCodeZipRequestContainer"/>

The proper output response is

    <ns1:ValidateCityPostalCodeZipRequest>
        <ns1:Addresses>
            <ns1:ShortAddress>
    ...
            </ns1:ShortAddress>
        </ns1:Addresses>
    </ns1:ValidateCityPostalCodeZipRequest>

What is being generated is

    <AA:ValidateCityPostalCodeZipRequestContainer>
        <AA:Addresses>
            <AA:ShortAddress>
    ...
            </AA:ShortAddress>
        </AA:Addresses>
    </AA:ValidateCityPostalCodeZipRequestContainer>

Notice the ValidateCityPostalCodeZipRequestContainer vs ValidateCityPostalCodeZipRequest The later is correct, I assume this is described in <xsd:element name="ValidateCityPostalCodeZipRequest" nillable="true" type="tns:ValidateCityPostalCodeZipRequestContainer"/>

The structure is good, just the xml.Name should be changed
XMLName xml.Namexml:"http://purolator.com/pws/service/v1 ValidateCityPostalCodeZipRequest"``

Generate code syntax error: unexpected comma

Trying to generate code for the Billing Tree Payrazr WSDL located here:

https://staging.mypayrazr.com/ApiServiceWeb/SimpleApiService.svc?wsdl

func returns are invalid, pointer ref "*" with no type, example of one generated func:

	func (service *ISimpleApiService) SubmitCardSale () (*, error) {
		response := new()
		err := service.client.Call("http://tempuri.org/ISimpleApiService/SubmitCardSale", nil, response)
		if err != nil {
			return nil, err
		}

		return response, nil
	}

Error with mPAY24

Using the SOAP WSDL definition of mPAY24 with the latest gowdsl version from master:

gowsdl -o mpay24.go -p mpay24 "https://test.mpay24.com/soap/etp/1.5/ETP.wsdl"
๐Ÿ€  Downloading file https://test.mpay24.com/soap/etp/1.5/ETP.wsdl
๐Ÿ€  Downloading external schema location https://test.mpay24.com/soap/etp/1.5/ETP.wsdl
๐Ÿ€  expected element type <schema> but have <definitions>

Shouldn't this be compatible?

Unable to reate cache directory

$ go version
go version go1.3.1 linux/amd64
$ go get github.com/c4milo/gowsdl
$ gowsdl -h
2014/08/25 11:44:39 Unable to reate cache directory

using gowdsl with virtualbox web service

FYI: it took me some time to figure out how to do this, so maybe someone will benefit from my experience

after using gowsdl to generate vboxweb.go as part of the vboxweb package I can now do this:

package main

import v "vboxweb"
import "fmt"

func main() {
    service:= v.NewVboxPortType("http://localhost:18083/", false, &v.BasicAuth{})
    session,err := service.IWebsessionManagerlogon(&v.IWebsessionManagerlogon{})
    if err == nil {
      sessionID :=session.Returnval
      //fmt.Println(sessionID)
      version,err := service.IVirtualBoxgetVersion(&v.IVirtualBoxgetVersion{This:sessionID})
      if err == nil {
          fmt.Println("getVersion",version.Returnval)
      }
      machine,err := service.IVirtualBoxfindMachine(&v.IVirtualBoxfindMachine{This:sessionID,NameOrId:"myvmname"})
      if err == nil {
        fmt.Println("Machine object",machine.Returnval)
      }
      state,err := service.IMachinegetState(&v.IMachinegetState{This:machine.Returnval})
      if err == nil {
            fmt.Println("Machine state",*state.Returnval)
      }
    }
}

Virtualbox expects an object identifier in a this parameter to be able to work.
After login you get a session object id, some operations return another object id which you need to pass to get to the attributes.

xsd:integer as int / string

This xsd generates the following golang code, which fails to compile with the following reason.
What I see is xsd:integer is different from xsd:int and xsd:integer could probably be a string, since it is unbounded.

  <xsd:simpleType name="XyzType_e">
    <xsd:restriction base="xsd:integer">
      <xsd:enumeration value="0" codegen:cname="USER_0" />
      <xsd:enumeration value="1" codegen:cname="USER_1" />
      <xsd:enumeration value="2" codegen:cname="USER_2" />
      <xsd:enumeration value="3" codegen:cname="USER_3" />
    </xsd:restriction>
  </xsd:simpleType>
type XyzTypee int32

const (
    XyzTypee0 XyzTypee = "0"

    XyzTypee1 XyzTypee = "1"

    XyzTypee2 XyzTypee = "2"

    XyzTypee3 XyzTypee = "3"
)

myservice/myservice.go:105: cannot convert "0" to type XyzTypee
myservice/myservice.go:107: cannot convert "1" to type XyzTypee
myservice/myservice.go:109: cannot convert "2" to type XyzTypee
myservice/myservice.go:111: cannot convert "3" to type XyzTypee

Improve error messaging on go fmt err

Current message shows something like this:

๐Ÿ€ 75:53: expected type, found ',' (and 2 more errors)

It should mention something about not a valid WSDL or unable to parse schema. This is a tough one though as it could be a gowsdl bug or it could be a problem with their WSDL. I still think it should say something along with this current message. As this message just looks like a gowsdl bug.

where to define the type String

In wsdl :


I use gowsds to get the .go file from the wsdl .

Find the String type in the .go file because it set the Param as String type.
But How can I define the String type ?
or where is the String type ?

Problem Reading ASP.NET Web Service response

I am consuming a classic ASP.NET Web Service (.asmx file).

The relevant WSDL says:

      <s:element name="StartSigfoxSessionResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="StartSigfoxSessionResult" type="tns:DeviceReports" />
          </s:sequence>
        </s:complexType>
      </s:element>

And the Response that is returned is:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soap:Body>
        <StartSigfoxSessionResponse xmlns="http://ayyeka.com/">
            <StartSigfoxSessionResult>
                <Id>1274841</Id>
                <DeviceAKId>99836700ABCDEF00</DeviceAKId>
                <DeviceSessionId>0</DeviceSessionId>
                <DeviceSessionState>Start</DeviceSessionState>
                <StartDate>2016-08-09T13:53:09.2764767Z</StartDate>
                <EndDate>0001-01-01T00:00:00</EndDate>
                <DeviceProtocolVersion>NotSecure</DeviceProtocolVersion>
                <FirmwareVersion>0</FirmwareVersion>
                <FirmwareCompileDate>0001-01-01T00:00:00</FirmwareCompileDate>
                <FilesReceived>0</FilesReceived>
                <FilesSent>0</FilesSent>
                <NumAlerts>0</NumAlerts>
                <Token>0</Token>
            </StartSigfoxSessionResult>
        </StartSigfoxSessionResponse>
    </soap:Body>
</soap:Envelope>

However, I am getting the following error from gowsdl:

xml: name "StartSigfoxSessionResult" in tag of bebridge.StartSigfoxSessionResponse.StartSigfoxSessionResult conflicts with name "DeviceReports" in *bebridge.DeviceReports.XMLName

I believe this happens with any method that returns a complex type.
It looks as though gowsdl is expecting a element under , while ASP.NET doesn't generate it.

Separate file for SOAP functions

I generate code for multiple services in the same package but since every service appends SOAP functions at the end, so i manually delete them.

I think its better to create separate file for soap functions and create two new flag one to disable SOAP function generation and one to only create SOAP functions without any wsdl.

If this is OK for you i can work on a pull request.

time.Time parsing error

After generating a class to access the VIES web service for EU VAT validation service I get an error when class tries to parse a good response:

Error: parsing time "2015-08-05+02:00" as "2006-01-02T15:04:05Z07:00": cannot parse "+02:00" as "T"

The field generating the error is a time.Time field both in CheckVatResponse and CheckVatApproxResponse structs:

RequestDate time.Time `xml:"requestDate,omit empty"`

If I convert the field to a string, I can successfully access the service as reported in issue #30.
The response from the service contains a "RequestDate" field filled in like this:

    RequestDate:2015-08-05+02:00

which generates the error above.

how to use generated service?

it would be very helpful to see basic example of how to use the generated code.
i am just starting with golang. i've managed to generate myservice.go and now what?

Underscores stripped out causes type clash

I've got some xsds with similar type names, that then clash in go when the underscore is stripped out.

myservice/myservice.go:7253: AccountStatust redeclared in this block

  <xsd:simpleType name="Account_Status_t">
    <xsd:restriction base="xsd:string">
      <xsd:maxLength value="32" />
    </xsd:restriction>
  </xsd:simpleType>
  <xsd:simpleType name="AccountStatus_t">
    <xsd:restriction base="xsd:string">
      <xsd:maxLength value="32" />
    </xsd:restriction>
  </xsd:simpleType>

WSDL parse does something wrong =)

Hi,

I'm trying to generate code from WSO2-CEP WSDL and get this in output:

๐Ÿ€  Downloading file https://172.18.0.3:9443/services/EventProcessorAdminService.EventProcessorAdminServiceHttpsSoap12Endpoint?wsdl
๐Ÿ€  [WARN] editActiveExecutionPlanResponse message doesn't have any parts, ignoring message...
๐Ÿ€  [WARN] undeployActiveExecutionPlanResponse message doesn't have any parts, ignoring message...
๐Ÿ€  [WARN] deployExecutionPlanResponse message doesn't have any parts, ignoring message...
๐Ÿ€  [WARN] setStatisticsEnabledResponse message doesn't have any parts, ignoring message...
๐Ÿ€  [WARN] undeployInactiveExecutionPlanResponse message doesn't have any parts, ignoring message...
๐Ÿ€  [WARN] setTracingEnabledResponse message doesn't have any parts, ignoring message...
๐Ÿ€  [WARN] editInactiveExecutionPlanResponse message doesn't have any parts, ignoring message...
๐Ÿ€  893:115: expected type, found ',' (and 6 more errors)

Result file is corrupted.
I have tried this WSDL in Zeep (python library) and in SoapUI - works fine.

As a suggestion, could it be issue with wsdl imports?

Error while generating code

 gowsdl http://files.btbytes.com/tmp/stock.xml -p stock -o stock.go
๐Ÿ€  Downloading http://files.btbytes.com/tmp/stock.xml...
๐Ÿ€  52:66: expected type, found ')'

This is using the WSDL Spec document

onvif: Can't convert. Go file

http://www.onvif.org/Documents/Specifications.aspx
ONVIF WSDL and XML Schemas Specifications
...
http://www.onvif.org/onvif/ver10/events/wsdl/event.wsdl
...

gowsdl.exe event.wsdl
๐Ÿ€ Downloading external schema location http://www.w3.org/20
05/08/addressing/ws-addr.xsd
๐Ÿ€ Downloading external schema location http://docs.oasis-op
en.org/wsn/t-1.xsd
๐Ÿ€ Downloading external schema location http://docs.oasis-op
en.org/wsn/b-2.xsd
๐Ÿ€ 708:2: expected type, found 'const' (and 3 more errors)

Can we have a verbose more or better error messages please?

Using the latest version grabbed by go get on OS X 10.11 with Xcode 7.2 and Go 1.5.2.

I'm trying to process a fairly complicated file, with multiple (local, mostly xsd) imports (yes I'm using that special branch support-for-imports) and it fails with this:

574 [13:58] roberto@rron> gowsdl -p airspace -o airspace.go AirspaceServices_PREOPS_19.5.0.wsdl
๐Ÿ€  72:69: expected type, found ',' (and 10 more errors)

I don't even know in which file it is failing, I do not see the line or anything that could gives me a clue on where the problem actually is.

Thanks.

Can't evaluate field Restriction in type *gowsdl.XSDAttribute

Getting the following error on Windows and Linux:

genTypes error template: types:28:55: 
executing "Attributes" at <.Restriction.Base>: 
can't evaluate field Restriction in type *gowsdl.XSDAttribute

To reproduce run:

 gowsdl https://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl

Generate Soap Client rather than make it a dependency

I love what has been built so far, one suggestion:

I feel like the common use case for gowsdl is to be used as a one time code generator. I noticed there were some open issues regarding authentication and other client related features requested. I personally need several types of authentication as well as proxy support. I can easily add these with a few lines of code if I am in control of the soap client.

I think gowsdl should be responsible for only code generation and not function as a library. The soap client should be generated along with the types and allow the user to modify it to fit their needs. This has some benefits:

  • Generated code wouldn't need to depend on an external library
  • Gowsdl could be forked and built in another repo as it wouldn't have embedded dependency paths. Currently you have to go get the main repo and adjust your git remote in order to work on it.
  • This frees gowsdl from trying to support every possible auth/header combination and allows the project to focus on getting the type generation correct (it currently doesn't support sequence>choice>element types or navigate around duplicate type names and I am sure other things ๐Ÿ˜ƒ ).

In summary, I think gowsdl should inject the soap client into the generated code, require the user to have no external dependencies, and focus on getting correct compilable code. I am willing to restructure the output of the soap client (and add tests) if this is something that you would consider merging in.

Thoughts?

Problem generating code from WSDL

hi,

I'm trying to feed gowsdl the following http://st.atb.no/SMWS/SMService.svc?wsdl

and the output I get is:

๐Ÿ€  Downloading file http://st.atb.no/SMWS/SMService.svc?wsdl
๐Ÿ€  Downloading external schema location http://st.atb.no/SMWS/SMService.svc?xsd=xsd0
๐Ÿ€  2530:3: expected '}', found 'interface'

I tried to figure out if this is a problem with the WSDL, but according to this:

https://www.wsdl-analyzer.com/qualityReport/show/357796858?version=1

It seems to check out.

Am I doing something wrong, is the WSDL broken or is this a bug (or some missing feature I'm not aware of) in gowsdl?

Encode/Decode errors with mismatched annotations.

I have an XML file that has a bunch of types/functions that look like this:

<wsdl:definitions targetNamespace="Namespace">
  <wsdl:types>
    <xs:schema targetNamespace="Namespace">
      <xs:complexType name="ArrayOfString">
        <xs:sequence>
          <xs:element name="stringItem" type="xs:string" minOccurs="0" maxOccurs="unbounded" nillable="false"/>
        </xs:sequence>
      </xs:complexType>

      <xs:complexType name="Tag">
        <xs:sequence>
          <xs:element name="type" type="xs:string" minOccurs="0" maxOccurs="1" nillable="false"/>
          <xs:element name="values" type="tns:ArrayOfString" minOccurs="0" maxOccurs="1" nillable="false"/>
        </xs:sequence>
      </xs:complexType>
      <xs:complexType name="ArrayOfTag">
        <xs:sequence>
          <xs:element name="tag" type="tns:Tag" minOccurs="0" maxOccurs="unbounded" nillable="false"/>
        </xs:sequence>
      </xs:complexType>

      <xs:complexType name="ParamsGetTags">
        <xs:sequence>
          <xs:element name="tagList" type="tns:ArrayOfTag" minOccurs="0" maxOccurs="1" nillable="false"/>
        </xs:sequence>
      </xs:complexType>
      <xs:complexType name="ResultGetTags">
        <xs:sequence>
          <xs:element name="tagList" type="tns:ArrayOfTag" minOccurs="1" maxOccurs="1" nillable="false"/>
        </xs:sequence>
      </xs:complexType>
      <xs:complexType name="SuccessGetTags">
        <xs:sequence>
          <xs:element name="result" type="tns:ResultGetTags" minOccurs="1" maxOccurs="1"/>
        </xs:sequence>
      </xs:complexType>

      <xs:element name="paramsGetTags" type="tns:ParamsGetTags"/>
      <xs:element name="successGetTags" type="tns:SuccessGetTags"/>
    </xs:schema>
  </wsdl:types>

  <wsdl:message name="GetTagsRequest">
    <wsdl:part name="paramsGetTags" element="tns:paramsGetTags"/>
  </wsdl:message>
  <wsdl:message name="GetTagsResponse">
    <wsdl:part name="successGetTags" element="tns:successGetTags"/>
  </wsdl:message>

  <wsdl:portType name="NPort">
    <wsdl:operation name="getTags">
      <wsdl:documentation>Get Tags
      </wsdl:documentation>
      <wsdl:input message="tns:GetTagsRequest"/>
      <wsdl:output message="tns:GetTagsResponse"/>
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="NApiSoapBinding" type="tns:NPort">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
      <wsdl:operation name="getTags">
          <soap:operation soapAction="example.com/N/getTags" />
          <wsdl:input>
              <soap:header use="literal" part="authentication" message="tns:AuthenticationHeader" />
              <soap:body use="literal" />
          </wsdl:input>
          <wsdl:output>
              <soap:body use="literal" />
          </wsdl:output>
      </wsdl:operation>
  </wsdl:binding>

</wsdl:definitions>

I've included all the definitions (e.g. of ArrayOfTags) for completeness, and since it allows the example above to be complete/testable.

It wasn't working for me, and when I looked more closely, I was eventually able to uncovere the problem.
There are two issues:
The first is that there are too many type annotations all over the place, so I end up with structs that won't encode.
Things like:

type ArrayOfTag struct {
        XMLName xml.Name `xml:"http://url ArrayOfTag"`

        Tag []*Tag `xml:"tag,omitempty"`
}

type ParamsGetTags struct {
        XMLName xml.Name `xml:"http://url ParamsGetTags"`

        TagList *ArrayOfTag `xml:"tagList,omitempty"`
}

Result in errors of the form
err xml: name "tagList" in tag of soap.ParamsGetTags.TagList conflicts with name "ArrayOfTag" in *soap.ArrayOfTag.XMLName

These are all over the place, and require removing copious xmlNames in order to get my code to run.

The second issue is that <xs:element name="paramsGetTags" type="tns:ParamsGetTags"/> should override the "name" on the complex type <xs:complexType name="ParamsGetTags">. The generated struct is (as above)

type ParamsGetTags struct {
        XMLName xml.Name `xml:"http://url ParamsGetTags"`

        TagList *ArrayOfTag `xml:"tagList,omitempty"`
}

but it fails when the element name is ParamsGetTags. If I change it to paramsGetTags, it works correctly (assuming I've fixed the first issue as well).

Is there an easy fix you recommend for these? I can dig into some of the code generation, but nothing jumped at me as an easy way to look up if there's a simple element with that type, and I didn't want to build out a hacky solution if there was something you felt was more appropriate.

Let me know what you think.
I'm really looking forward to using this library to make my dealing with SOAP in Go much more bearable. I'm so close I can taste it, I just have to get over the finish line. :)
Thanks!

Line feeds in WSDL

Hi

I found that if the wsdl:documentation had line feeds in it the generated code would get messed up like the following

    // Error can be either of the following types:
    // 
    //   - ValidationFaultFault 
    //
            GetFullEstimate
            @param request GetFullEstimateRequest
            @return GetFullEstimateResponse
    func (service *EstimatingServiceContract) GetFullEstimate (request *GetFullEstimateRequestContainer) (*GetFullEstimateResponseContainer, error) {

Relevant WSDL source

    <wsdl:operation name="GetFullEstimate">
        <wsdl:documentation>
            GetFullEstimate
            @param request GetFullEstimateRequest
            @return GetFullEstimateResponse
        </wsdl:documentation>

Support for imports

It looks like imports are not being pulled into the schema. They are specified on the XSDSchema struct but never used.

Error unmarshalling responses from VirtualBox vboxwebsrv

I'm trying to use gowsdl to generate code to interface with VirtualBox's vboxwebsrv SOAP service, but I'm running into namespace issues.

My test code can be found here: https://github.com/md5/gowsdl-vboxwebsrv-test, including the generated service code, but the stripped-down test file looks like this:

package main

import (
    "./vboxwebsrv"

    "log"
    "os"
)

func main() {
    var addr string

    if len(os.Args) < 2 {
        addr = "http://127.0.0.1:18083"
    } else {
        addr = os.Args[1]
    }

    svc := vboxwebsrv.NewVboxPortType(addr, false, nil)
    vbox, err := svc.IWebsessionManagerlogon(&vboxwebsrv.IWebsessionManagerlogon{})
    if err != nil {
        log.Fatalln(err)
    }

    log.Printf("returnval=%s\n", vbox.Returnval)
}

When I run it with go run test.go, I get the following error:

$ go run test.go http://192.168.99.1:18083
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:vbox="http://www.virtualbox.org/"><SOAP-ENV:Body><vbox:IWebsessionManager_logonResponse><returnval>954ddf3e6d57d58b-000000000000000a</returnval></vbox:IWebsessionManager_logonResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
2015/09/10 08:42:18 expected element <IWebsessionManager_logonResponse> in name space http://www.virtualbox.org/ but have vbox
exit status 1

After looking through the gowsdl code, it appears that the issue is that the <vbox:IWebsessionManager_logonResponse><returnval>954ddf3e6d57d58b-000000000000000a</returnval></vbox:IWebsessionManager_logonResponse> body is being unmarshalled by an instance of xml.Decoder that no longer has the xmlns:vbox="http://www.virtualbox.org/" namespace mapping.

Any advice you can provide here would be appreciated. It seems like gowsdl might need to use something lower level than xml.Unmarshal to allow the same xml.Decoder to decode the entire SOAP payload and maintain its namespace mappings.

Here's my Go version:

$ go version 
go version go1.5 darwin/amd64

NRCS Envelope Fault

Got around to working more on the NRCS wsdl service I was interested. Ran into another problem, like before open to helping, but some insight/maybe fix would be great. I am using the code from #15

Below is what I wrote additionally to query all stations which are also snotels, so using networkCd of SNTL.

func GetSnotelStations() ([]string, error) {
    request := &getStations{NetworkCds: []string{"SNTL"}, LogicalAnd: true}
    stations, err := service.GetStations(request)
    if err != nil {
        return nil, err
    }
    return stations.Return_, err
}

When I do this, I get the following error:
PANIC: expected element type <getStationsResponse> but have <Fault>

Wireshark shows these request contents, couldn't find a way to copy/paste so they are images
out
500a
500b

Here is the wireshark of my pre-existing ruby code that makes a successful request.
correct

Thanks and let me know how else I can help with info/etc

Compliant WSDL doesn't parse some constants and nested complexType objects correctly

This WSDL is SOAP 1.1, and claims to be WS-I 1.0 compliant, but gowsdl can't seem to handle some of the objects that are nested complexTypes. The formatter fails because some types don't seem to be parsed correctly.
These are two general examples I have been running into:

// Constants with odd characters (spaces and hyphens)
// generated code
const (
DriveTrain_Front Wheel Drive DriveTrain = "Front Wheel Drive" 
)
// I believe should be
const (
DriveTrain_Front_Wheel_Drive DriveTrain = "Front Wheel Drive" 
)

// Constants with hyphens
// generated code
const(
SwitchChromeMediaGallery_Multi-View SwitchChromeMediaGallery = "Multi-View"
)
// I believe should be
const(
SwitchChromeMediaGallery_Multi_View SwitchChromeMediaGallery = "Multi-View"
)
// Structs with no objects
type VersionInfo struct {
    XMLName xml.Name `xml:"urn:description7a.services.chrome.com VersionInfo"`
    *BaseResponse
    Data []* `xml:"data,omitempty"` //missing object type
}

This may be a limitation of the project that I'm just not aware of, but I figured I would raise an issue just in case.

WSDL on Snotel, request successful, response empty

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?

Picking up the wrong TargetNamespace

In my WDSL the schema defines a target name space of

    <xsd:schema elementFormDefault="qualified" targetNamespace="http://purolator.com/pws/datatypes/v1" xmlns:tns="http://purolator.com/pws/datatypes/v1">

and the WSDL target namespace is different

<wsdl:definitions name="ServiceAvailabilityService" targetNamespace="http://purolator.com/pws/service/v1" ...>

When rendering the structure (in GoWsdl.genTypes) the template function targetNamespace returns the wsdl name space func() string { return g.wsdl.TargetNamespace } which is incorrect, as it should be returning the schema

Choice elements not being generated

It looks like elements wrapped in the choice tag are not being generated. I see there are some test fixtures with choice tags but I don't see any tests for them. I tried troubleshooting this myself but was unsuccessful. Can you try generating a wsdl with choice elements or point me in the right direction for adding support for these.

It looks like the ec2 fixture has choice elements.

Thanks!

coulnd't parse nested list type

example:
<xs:simpleType name="DeviceTypeReportFilter">
xs:list
xs:simpleType
<xs:restriction base="xs:string">
<xs:enumeration value="Computer"/>
<xs:enumeration value="SmartPhone"/>
<xs:enumeration value="NonSmartPhone"/>
<xs:enumeration value="Tablet"/>
</xs:restriction>
</xs:simpleType>
</xs:list>
</xs:simpleType>

result:

type DeviceTypeReportFilter *

const ()

expected:

type DeviceTypeReportFilter string

const (
DeviceTypeReportFilterComputer DeviceTypeReportFilter = "Computer"
DeviceTypeReportFilterSmartPhone DeviceTypeReportFilter = "SmartPhone"
DeviceTypeReportFilterNonSmartPhone DeviceTypeReportFilter = "NonSmartPhone"
DeviceTypeReportFilterTablet DeviceTypeReportFilter = "Tablet"
)

Errors with EU VAT Validation service

Hello,
I generated a service to access the EU VIES web service (EU VAT Validation service) from the wsdl at http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl: service appears to be correctly generated, but when I try to use it I get the error:

expected element type <Envelope> but have <definitions>

The function with which I use the generated service is very simple and should be ok:

func VerifyVAT(vat string, countrycode string) error {
    var data vies.CheckVat
    data.VatNumber = vat
    data.CountryCode = countrycode

    svc := vies.NewCheckVatPortType("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl", false)
    resp, err := svc.CheckVat(&data)
    if err != nil {
        fmt.Printf("Error: %v\n", err)
    }
    fmt.Printf("RESULT: %v", resp)

    return nil
}

Am I missing something, or is it the generator failing with this wsdl?

Date/time types fail to unmarshal

As far as I know the Go XML unmarshler doesn't support changing date/time format and often fails if the date/time is not in the go expected format. We should probably map these to string instead of time.Time and let the user parse these later.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.