I am trying to obtain enterprise WSDL by accessing https://cs15.salesforce.com/soap/wsdl.jsp?type=* URL via curl. For this, I have obtained access token through OAUTH2 method via the following curl command.
curl https://cs15.salesforce.com/services/oauth2/token -d ‘grant_type=password -d client_id=myclientid -d client_secret=mysecret -d [email protected] -d password=mypassword
Next I used the access token in following curl command to obtain WSDL
curl https://cs15.salesforce.com/soap/wsdl.jsp?type=* -H "Cookie: sid=myaccesstoken"
But response from above curl command indicates that I was getting redirected to Salesforce login page instead of WSDL page.
- I have validated my approach by taking “sid” value from web browser cookies after successfully logging into Salesforce, used it in the above curl and it worked as I expected.
- I have also tried using the access token which I got through OAUTH2 method in REST API requests and they worked as expected. Hence I assume the access token via OAuth is valid.
Appreciate if someone can advise why I am not getting WSDL page or suggest me an alternate approach.