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

Expected element type <Envelope> but have <html> #93

Open
abhishek-vaishnav-VTS opened this issue Aug 31, 2023 · 3 comments
Open

Expected element type <Envelope> but have <html> #93

abhishek-vaishnav-VTS opened this issue Aug 31, 2023 · 3 comments

Comments

@abhishek-vaishnav-VTS
Copy link

abhishek-vaishnav-VTS commented Aug 31, 2023

I'm trying to connect to this sample soap API server (https://www.w3schools.com/xml/tempconvert.asmx) but the soap.Call method always results in this error "expected element type <Envelope> but have <html>"

Following is my code snippet,

httpClient := &http.Client{
		Timeout: 1500 * time.Millisecond,
	}

	soap, err := gosoap.SoapClient("https://www.w3schools.com/xml/tempconvert.asmx?wsdl", httpClient)
	if err != nil {
		fmt.Println("error occurred: ", err)
		return
	}

	params := gosoap.Params{
		"Celsius": 500,
	}

	res, err := soap.Call("CelsiusToFahrenheit", params)
	if err != nil {
		fmt.Println("error occurred while fetching response: ", err)
		return
	}

Can anyone help?

@chirag-parmar-vts
Copy link

I have opened up a pull request for the same here. Basically we need to extract soap URL instead of fetching it from wsdl definition. There are cases where the actual URL starts with https but it starts with http in wsdl definition. In this case, httpClient will try to invoke https URL with http which would result in above error.

@abhishek-vaishnav-VTS
Copy link
Author

@tiaguinho can you please look into it if it seems OK to you as well?

@all2ham
Copy link

all2ham commented Feb 12, 2024

@abhishek-vaishnav-VTS @chirag-parmar-vts what did you guys end up doing to get around this? Any chance you know of a fork or different SOAP package

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