Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to prepare a soap request which require Authheader #49

Open
mayur2011 opened this issue Jan 21, 2020 · 2 comments
Open

Unable to prepare a soap request which require Authheader #49

mayur2011 opened this issue Jan 21, 2020 · 2 comments

Comments

@mayur2011
Copy link

mayur2011 commented Jan 21, 2020

Please Help me setup below SOAP request xml which contains AuthHeader also.

        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
           xmlns:out="http://Demo.Manufacturing.Webservices/Outbound/">
                   <soapenv:Header>
                       <out:AuthHeader>
	                       <out:UserName>admin</out:UserName>
	                     <out:Password>7338b6c1702d</out:Password>
                          </out:AuthHeader>
                      </soapenv:Header>
                      <soapenv:Body>
                            <out:GetOrder>
         	                <out:bu>1</out:bu>
	                        <out:order>5582</out:order>
                          </out:GetOrder>
                     </soapenv:Body>
           </soapenv:Envelope>
@jamesdube
Copy link

Hey 👋

I was faced with the same problem and here's how I managed to solve it:

    httpClient := &http.Client{
        Timeout: 5 * time.Second,
    }

    soap, err := gosoap.SoapClient("http://some/fancy/location.wsdl", httpClient)
    if err != nil {
        log.Fatalf("SoapClient error: %s", err)
    }

   //set your auth headers here
    soap.HeaderParams = gosoap.HeaderParams{
        "AuthHeader" : map[string]interface{}{
	    "Username" : "admin",
	    "Password" : "7338b6c1702d",
	},
    }

   //execute request
   // _, err = soap.Call("SomeAction", params)

This is in reference to #8 .

I hope its not too late, cheers

@rose-tmp
Copy link

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants