[Building Sakai] Web services questions

Boyd, Amy E amyboyd at txstate.edu
Mon Jan 24 12:34:50 PST 2011


Just found out the script was actually hitting a different database due to a redirect.  I was using the http protocol,  which redirects to a different server running sakai, and therefore a different database. Changed it to https, and all problems solved.


From: sakai-dev-bounces at collab.sakaiproject.org [mailto:sakai-dev-bounces at collab.sakaiproject.org] On Behalf Of Boyd, Amy E
Sent: Monday, January 24, 2011 2:22 PM
To: sakai-dev at collab.sakaiproject.org Dev
Subject: Re: [Building Sakai] Web services questions

Steve - not sure how to enable logging on site.api or where it would log to - checked all the log files and didn't see anything.


To make sure I'm hitting the right DB (and not just being completely crazy), I create a site in Sakai, the traditional way.  I check the DB, and sure enough under SAKAI_SITE  (select SITE_ID, TITLE, CREATEDON from SAKAI_SITE where CREATEDON like "2011-01%";), there is the site.

I then go to my script using web services.  I log in successfully, get a list of my sites returned to me and print them to the screen, just to know that I've actually got a connection, session, etc.  They print just fine.  Then I tell it create a site:

$newSite = $soap->addNewSite($session, "createdByWebServices5", "Created By Web Services", "web service test", "", "", "",TRUE,"access",TRUE,"","","");
echo "newSite: " .$newSite. "<br>";

it echoes "success", provided the site_id is unique, so that implies to me that's it's saving it somewhere or it wouldn't know that it's a unique id.

Then I go to the db to check for the new site, and it's not there if I search by the above statement, or even if I search by the SITE_ID field.  >:/  I'm starting to think this is some sort of permissions thing on the DB at this point.  Still not sure about the IdUnusedException, but I'm thinking if I can fix the addNewSite problem, the other problems will clear up as well because they are probably related.  It's almost as though the web services script is not hitting the same database that Sakai is running on, but I have no idea how that would be possible.

Has anyone experienced this before?  This is probably something really obvious that I'm overlooking.

From: Steve Swinsburg [mailto:steve.swinsburg at gmail.com]
Sent: Saturday, January 22, 2011 1:56 AM
To: Boyd, Amy E
Cc: sakai-dev at collab.sakaiproject.org Dev; Theriault Seth
Subject: Re: [Building Sakai] Web services questions

Hi Amy,

Can you enable debug logging on site.api so we can see where the issue may be? The web services haven't changed in some time so my guess is the issue lies elsewhere. Your code looks ok.

cheers,
Steve



On 22/01/2011, at 10:48 AM, Boyd, Amy E wrote:

Bryan -

Actually I had already tried that, got the same result.  Then I tried just adding the tool to an existing site/page.  Same result.  I tried this:

$newPage = $active->addNewPageToSite($session, "52ae25e2-e880-41fd-bf71-17b30c67af20", "Mailtool", 0);
Returned org.sakaiproject.exception.IdUnusedException : null.
 I'm passing a valid session id and the site id is also valid.

I've also tried adding the tool to an existing page as opposed to a new page.  Now I'm just trying to get a tool (any tool) added to an existing page (any page), and regardless of what site and what page I use, I keep getting that same error message.

Thanks Bryan!  Let me know if you have any more suggestions because obviously I'm missing something here!

-          Amy



From: Bryan Bakotich [mailto:bakotibj at plu.edu]
Sent: Friday, January 21, 2011 5:35 PM
To: Boyd, Amy E
Cc: sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
Subject: Re: [Building Sakai] Web services questions

Amy,

You have to add a new page to the site first before you add a tool to the page. Something like this:

// Add the page to the site
// Last param is pagelayout: 0 for single column, 1 for double
$active->addNewPageToSite($
session, "52ae25e2-e880-41fd-bf71-17b30c67af20", "Mailtool", 0);
// Now add the tool to the page
$active->addNewToolToPage($
session, "52ae25e2-e880-41fd-bf71-17b30c67af20", "Mailtool", "Mailtool", "sakai.mailtool", "0,0");

Hope that helps!

-Bryan

On Fri, Jan 21, 2011 at 3:18 PM, Boyd, Amy E <amyboyd at txstate.edu<mailto:amyboyd at txstate.edu>> wrote:
I'm trying to write a php script that will add a tool to several sites.  I know web services is a slow way to do this, but accessing the db directly is a scary prospect...  :O

I keep getting the following error when trying to add the tool to a page:

org.sakaiproject.exception.IdUnusedException : null

I've got a session, and the call goes like this:

$active->addNewToolToPage($session, "52ae25e2-e880-41fd-bf71-17b30c67af20", "Mailtool", "Mailtool", "sakai.mailtool", "0,0");

The page actually exists so that's not the problem.  I think it's a problem with the siteid, but I've tried everything I know of to try, including prepending "/site/" to the id.

Does anyone have any working  samples of this call in php?  I'd love to see a few different scripts if anyone has them.  I've been googling for hours and haven't come up with what I'm looking for.

Running 2.6.2.

Thanks all!
-Amy

_______________________________________________
sakai-dev mailing list
sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
http://collab.sakaiproject.org/mailman/listinfo/sakai-dev

TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org<mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a subject of "unsubscribe"



--
Bryan Bakotich
Open Source Implementation Specialist
Digital Media Center, Information & Technology Services
Pacific Lutheran University
Tacoma, WA 98447-0013
Phone: 253-536-5021
_______________________________________________
sakai-dev mailing list
sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
http://collab.sakaiproject.org/mailman/listinfo/sakai-dev

TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org<mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a subject of "unsubscribe"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20110124/2b45bb86/attachment.html 


More information about the sakai-dev mailing list