• paul_nakada
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I know this is simple, so I must be doing something wrong. Please help.

I am taking baby steps with APEX - having now created and run triggers I have progressed to creating a package and want to expose it via the API.

This is the package which saves without Error from Eclipse.

Code:
package GWDWebServiceTest{

 webService Id GWDTest(String lastName, Account a)
 {
   Contact  c = new Contact (LastName = lastName, AccountId = a.Id);
   insert c;
   commit;
   return c.id;
 }
}
I expected that when I generated the WSDL (Enterprise or Partner, I've tried both) I would see a method called GWDTest (or perhaps GWDWebServiceTest.GWDTest) but I don't. I have checked that I don't have two packages with the same name and I don't (So it's not a name space issue).

I even tried to access it using this piece of AJAX

Code:
<script type="text/javascript" src="/js/functions.js"></script>
    <script src="/soap/ajax/8.0/connection.js"></script>
    <script src="/soap/ajax/8.0/apex.js"></script>
    <script language="javascript">
        sforce.debug.trace = true;
        
     function makeaContact()
     {
      alert ("Hi");

      try
      {
       var account = sforce.SObject("Account");
       var id = sforce.apex.execute ("GWDWebServiceTest","GWDTest",{a:"Smith",b:account});
       alert (id);
      }
      catch (ex)
      {
       alert ("Failed : " + ex.message);
      }
     }
    </script>

 But I only get the alert that says "Failed: undefined".

Any pointers?

Cheers
Gareth.