You need to sign in to do that
Don't have an account?

Tooling API: No operation available for request...
I've been trying to use the tooling api with no luck. After I found this post (https://success.salesforce.com/issues_view?id=a1p30000000T2GcAAK ) I tried the work around, but it's not working for me. I get "No operation available for request {urn:tooling.soap.sforce.com}create" on the code below. Anyone know whta's wrong?
I'm using VS2013 Pro with C#.
here's my code:
Thanks in advance.
I'm using VS2013 Pro with C#.
here's my code:
sfdc.tooling.SforceServiceService tooling; sfdc.partner.SforceService partner; private void Form1_Load(object sender, EventArgs e) { if (Login()) { string classBody = "public class Messages {\n" + "public string SayHello() {\n" + " return 'Hello';\n" + "}\n" + "}"; // create a new ApexClass object and set the body sfdc.tooling.ApexClass apexClass = new sfdc.tooling.ApexClass(); apexClass.Body = classBody; sfdc.tooling.ApexClass[] classes = new sfdc.tooling.ApexClass[]{ apexClass }; // call create() to add the class sfdc.tooling.SaveResult[] saveResults = tooling.create(classes);//error here for (int i = 0; i < saveResults.Length; i++) { if (saveResults[i].success) { Console.WriteLine("Successfully created Class: " + saveResults[i].id); } else { Console.WriteLine("Error: could not create Class "); Console.WriteLine(" The error reported was: " + saveResults[i].errors[0].message + "\n"); } } tooling.logout(); } } private bool Login() { bool success = false; try { tooling = new sfdc.tooling.SforceServiceService(); partner = new sfdc.partner.SforceService(); sfdc.partner.LoginResult lr; lr = partner.login(username, password + secretkey); success = true; string authEndPoint = tooling.Url; tooling.Url = lr.serverUrl; partner.Url = lr.serverUrl; tooling.SessionHeaderValue = new sfdc.tooling.SessionHeader(); tooling.SessionHeaderValue.sessionId = lr.sessionId; } catch( SoapException e) { MessageBox.Show("Login failed: " + e.Message); //success = false; } return success; }
Thanks in advance.
I don't know if you have solved that already or not, but maybe others have same issue.
I figures that the problem is in this section: The problem is that tooling and partner APIs have differrent URLs and you're pointing Tooling API to Partner API endpoint. If you look at WSDLs you can see it:
Tooling: https://cs18.salesforce.com/services/Soap/T/32.0
Partner: https://cs18.salesforce.com/services/Soap/u/32.0
Thus what you have to do is to get the original URL from your partner login result and change it to point to tooling. Assuming you're using C#, it can be done with the simple regex: At least that's how it worked for me :)
All Answers
I don't know if you have solved that already or not, but maybe others have same issue.
I figures that the problem is in this section: The problem is that tooling and partner APIs have differrent URLs and you're pointing Tooling API to Partner API endpoint. If you look at WSDLs you can see it:
Tooling: https://cs18.salesforce.com/services/Soap/T/32.0
Partner: https://cs18.salesforce.com/services/Soap/u/32.0
Thus what you have to do is to get the original URL from your partner login result and change it to point to tooling. Assuming you're using C#, it can be done with the simple regex: At least that's how it worked for me :)