hooklift/gowsdl

how to add xmlns="" <tag xmlns=""> </tag>

ironytr opened this issue · 1 comments

hello i'm new at golang and programming and i have a noobish question. i couldn't find on google the answer. the soap server fails with generated code by gowsdl. but i add this xmlns="" to auth tag its working like a charm. So how can i add this to tags?

Not accepted by server


<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body xmlns="http://schemas.xmlsoap.org/soap/envelope/">
	<GetCitiesRequest xmlns="http://www.n11.com/ws/schemas">
		<auth>                     <<<<<<<<<<<<<<<<------------ fails because no xmlns=""
			<appKey>xxx</appKey>
			<appSecret>xx</appSecret>
		</auth>
	</GetCitiesRequest>
	</Body>
</Envelope>

Accepted by server


 <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <Body>
        <GetCitiesRequest xmlns="http://www.n11.com/ws/schemas">
            <auth xmlns="">
                <appKey>[string]</appKey>
                <appSecret>[string]</appSecret>
            </auth>
        </GetCitiesRequest>
    </Body>
</Envelope>

im using quick fix:

buffers := new(bytes.Buffer)
buffers.WriteString(strings.ReplaceAll(buffer.String(),"<auth>","<auth xmlns=\"\">"))

req, err := http.NewRequest("POST", s.url, buffers)

what should i add struct tag to see empty xmlns="" ?

type GetCitiesRequest struct {
	XMLName xml.Name `xml:"http://www.n11.com/ws/schemas GetCitiesRequest"`

	Auth *Authentication `xml:"auth,omitempty" json:"auth,omitempty"`
}
type Authentication struct {
	AppKey string `xml:"appKey,omitempty" json:"appKey,omitempty"`

	AppSecret string `xml:"appSecret,omitempty" json:"appSecret,omitempty"`
}

Any help appreciated, sorry for if i did something wrong with opening new issue.