+ Start a Discussion
VG-ACCVG-ACC 

Tooling API WSDL

Hi,

I am not able to call the Login(uname, pwd) method for tooling API. I am getting the following error:

UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 1658340670-295522 (1318667741)


Does anyone have tried this ever before? Please post your suggestions.
Any help would be highly appreciated.


Thanks,
Vishal
Ashish_SFDCAshish_SFDC
Hi Vishal,


This has already been logged as a known issue, R&D teams are working on the same.

See the details below and check the link for updates. 


Login Call Using Tooling API Fails With UNKNOWN_EXCEPTION

API , Authentication

Last updated Yesterday ·Reference W-1895722 ·Reported By 7 users
IN REVIEW

Summary
Using the Tooling API WSDL to issue a login call via third-party application can result in an error similar to the following:

ERROR:- UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 402343489-21430 (1318667741)

Repro
The following is a sample request and a response via the Tooling API.

REQUEST
=======
POST https://na10.salesforce.com/services/Soap/T/29.0

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:tooling.soap.sforce.com">
<soapenv:Header/>
<soapenv:Body>
<urn:login>
<urn:username>[**username**]</urn:username>
<urn:password>[**password**]</urn:password>
</urn:login>
</soapenv:Body>
</soapenv:Envelope>

RESPONSE
========
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:tooling.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode>sf:UNKNOWN_EXCEPTION</faultcode>
<faultstring>UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 402343489-21430 (1318667741)</faultstring>
<detail>
<sf:UnexpectedErrorFault xsi:type="sf:UnexpectedErrorFault">
<sf:exceptionCode>UNKNOWN_EXCEPTION</sf:exceptionCode>
<sf:exceptionMessage>An unexpected error occurred. Please include this ErrorId if you contact support: 402343489-21430 (1318667741)</sf:exceptionMessage>
</sf:UnexpectedErrorFault>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

Workaround
Use a different login method (oAuth / REST, Partner or Enterprise SOAP API) to get the Session ID.


https://success.salesforce.com/issues_view?id=a1p30000000T2GcAAK


Regards,
Ashish
VG-ACCVG-ACC
Thank you so much Ashish..

I'll be using UserInfo.getSessionId method for session Id.
Now I want to create Apex Trigger using Tooling API. How can I accomplish this? There is a Create() method in the wsdl generated class. But I am not able to pass references of ApexTrigger class. Can you help me regarding this?

Thanks,
Vishal
Ashish_SFDCAshish_SFDC
Hi Vishal, 


See the links below for sample code and more information for Apex Trigger using Tooling API. 

http://stackoverflow.com/questions/15306170/salesforce-tooling-api-insufficient-access-rights

http://redcurrantscloud.blogspot.in/2013/09/forcecom-tooling-api-create-apex-class.html

http://salesforce.stackexchange.com/questions/9603/how-do-i-use-the-tooling-api-to-create-a-new-apex-trigger


Regards,
Ashish