ruby-on-railsxmlsoaperror-handlingmindbody

Error: Wasabi::Resolver::HTTPError in HomeController#index for MindBody API SOAP RoR


I'm trying to link into the mindbody API to book members in using RoR from this git: https://github.com/mindbody/API-Examples/tree/master/Ruby

Error:

Wasabi::Resolver::HTTPError in HomeController#index

According to the logs, I haven't entered the correct details. However, I have changed the source and user credentials in the home_controller controller file.

source_credentials = {:SourceName => 'MySourceName', :Password => 'MySourcePassword', :SiteIDs => site_ids } user_credentials = { :Username => 'MyUsername', :Password => 'MyUserPassword', :SiteIDs => site_ids }

Thanks in advance!

SOAP log:

_getClasses_request.xml

<?xml version="1.0" encoding="utf-8" ?> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> <n1:GetClasses xmlns:n1="http://clients.mindbodyonline.com/api/0_5"> <n1:Request> </n1:Request> </n1:GetClasses> </env:Body> </env:Envelope>

_getClasses_response.xml:

<soap:Body> <GetClassesResponse xmlns="http://clients.mindbodyonline.com/api/0_5"> <GetClassesResult> <Status>InvalidCredentials</Status> <Message>SourceCredentials must be provided.</Message> <XMLDetail>Full</XMLDetail> <ResultCount>0</ResultCount> <CurrentPageIndex>0</CurrentPageIndex> <TotalPageCount>0</TotalPageCount> </GetClassesResult> </GetClassesResponse> </soap:Body> </soap:Envelope>


Solution

  • I'd probably avoid basing any Ruby code you plan on writing for your MindBody app on the code you find in their official example code repos, and instead just use the mindbody-api gem to wrap your API calls.

    As for your issue, it doesn't actually look like you have passed any authentication parameters (neither source credentials, nor user credentials) into your XML request, which would explain the response that you got back.

    If you haven't already, have a look at the Authentication page of the MindBody documentation, as well as the GetClasses entry in the ClassService page documentation page to see what your XML request should look like (both require a MindBody account to access).