+ Start a Discussion
Mark RobertsMark Roberts 

Is it possible to programmatically generate the WSDL?

Hello,

 

I'm trialling SaleForce for our company (specifically synching data via the API)... and in doing so am changing schema quite a bit.

 

At the moment, I'm having to manually log in and regenerate schema each time (and then have an automated process to convert this into C#)

 

I would like to automate the refresh of schema.... however, I cannot see how to authenicate programmatically to the page https://eu1.salesforce.com/soap/wsdl.jsp?type=*

 

I'm probably missing something obvious - can someone help?

 

Regards,

Mark.

 

gwestrgwestr

Yes, this is possible.  For the enterprise wsdl the endpoint is soap/wsdl.jsp?type=* and for partner it is simply soap/wsdl.jsp with no parameter.  You can initiate an HTTP connection to that endpoint with a header value "Cookie: sid=xxxxxxx" and you'll get the result.  Here's an example:

 

curl -v https://na12.salesforce.com/soap/wsdl.jsp -H "Cookie: sid=xxxx"

 

> GET /soap/wsdl.jsp HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3
> Host: na12.salesforce.com
> Accept: */*
> Cookie: sid=xxxx
>
< HTTP/1.1 200 OK
< Server:
< Cache-Control: private
< Content-Disposition: inline; filename="partner.wsdl"
< Content-Type: text/xml; charset=UTF-8
< Transfer-Encoding: chunked
< Date: Thu, 01 Mar 2012 17:47:59 GMT
<
<?xml version="1.0" encoding="UTF-8"?>


<!--
Salesforce.com Partner Web Services API Version 24.0
Generated on 2012-03-01 17:47:59 +0000.

Copyright 1999-2012 salesforce.com, inc.
All Rights Reserved
-->

<definitions targetNamespace="urn:partner.soap.sforce.com"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:fns="urn:fault.partner.soap.sforce.com"
xmlns:tns="urn:partner.soap.sforce.com"
xmlns:ens="urn:sobject.partner.soap.sforce.com">
<types>

<schema elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:sobject.partner.soap.sforce.com">

<import namespace="urn:partner.soap.sforce.com"/>

gwestrgwestr

You can get your session ID with a SOAP login call, or from the OAuth 2.0.  The OAuth "username and password flow" is appropriate for development.

vinaydasarivinaydasari

Hi,

 

I too have the same requirement to generate the WSDL file porgramatically. Could you please elaborate your answer about this so that it can be useful to me.

 

Thanks,

Vinay

Mike SlivkaMike Slivka
Thanks so much for this information. I have gotten this to work for my organization, but I am noticing that the ORGID that ususally gets added to the end point is not listed. Is there a Cookie value I can send that will fill this in for me. I tried a couple different variations of OrganizationID and it doesn't seem to want to take it. Thanks!
Meer ZamanMeer Zaman
Is session Id and access_token are same thing?