messagemedia / messagemedia-soap-api-ruby-sdk

⚠️ Deprecated | Sample Ruby code demonstrating how to send a SMS/Text message with the MessageMedia SOAP API
Apache License 2.0
1 stars 4 forks source link

Invalid SOAP request with check_replies and check_reports #9

Open jbat opened 9 years ago

jbat commented 9 years ago

Issue relates to how the body is formed, specifically fails at api:maxReplies. I checked the docs http://www.messagemedia.com.au/wp-content/uploads/2013/05/MessageMedia_Messaging_Web_Service.pdf and after updating to use api:maximumReplies and maximumReports the soap calls succeed.

Failure Example with body[:'api:requestBody'][:'api:maxReplies'] = max_replies


[3] pry(main)> Messagemedia::SOAP::Client.new(uid, token).check_replies(5)
Savon::SOAPFault: (SOAP-ENV:Client) The request is either not well-formed or is not valid against the relevant schema.
from /usr/local/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/response.rb:85:in `raise_soap_and_http_errors!'
[4] pry(main)> Messagemedia::SOAP::Client.new(uid, token).check_replies("5")
Savon::SOAPFault: (SOAP-ENV:Client) The request is either not well-formed or is not valid against the relevant schema.
from /usr/local/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/response.rb:85:in `raise_soap_and_http_errors!'

Successful Example with body[:'api:requestBody'][:'api:maximumReplies'] = max_replies

[4] pry(main)> Messagemedia::SOAP::Client.new(uid, token).check_replies("5")
=> {:replies=>
  [{:origin=>"6146xxx1793", :received=>Tue, 03 Nov 2015 01:29:57 +0000, :content=>"Test3", :@format=>"SMS", :@uid=>"1234567890", :@receipt_id=>"206215221"},
   {:origin=>"6146xxx1793", :received=>Tue, 03 Nov 2015 01:55:23 +0000, :content=>"Hi", :@format=>"SMS", :@uid=>"549232", :@receipt_id=>"206219570"},
   {:origin=>"6143xxx5151", :received=>Thu, 05 Nov 2015 07:19:02 +0000, :content=>"Hello Neptune ... hows tricks?", :@format=>"SMS", :@uid=>"11", :@receipt_id=>"206655092"}],
 :@returned=>"3",
 :@remaining=>"0"}

And on the check_reports method, same update needed with maximumReports Failure Example

[6] pry(main)> Messagemedia::SOAP::Client.new(uid, token).check_reports("5")
Savon::SOAPFault: (SOAP-ENV:Client) The request is either not well-formed or is not valid against the relevant schema.
from /usr/local/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/response.rb:85:in `raise_soap_and_http_errors!'

Successful example after updating to use maximumReports body[:'api:requestBody'][:'api:maximumReports'] = max_reports

[3] pry(main)> Messagemedia::SOAP::Client.new(uid, token).check_reports("5")
=> {:reports=>
  [{:recipient=>"6141xxx2820", :timestamp=>Fri, 23 Oct 2015 04:34:21 +0000, :@uid=>"113", :@receipt_id=>"186312960", :@status=>"delivered"},
   {:recipient=>"6141xxx2820", :timestamp=>Fri, 23 Oct 2015 04:43:34 +0000, :@uid=>"114", :@receipt_id=>"186316129", :@status=>"delivered"},
   {:recipient=>"6141xxx2820", :timestamp=>Mon, 26 Oct 2015 23:27:38 +0000, :@uid=>"117", :@receipt_id=>"187212335", :@status=>"delivered"},
   {:recipient=>"6141xxx3344", :timestamp=>Tue, 27 Oct 2015 00:13:44 +0000, :@uid=>"118", :@receipt_id=>"187238500", :@status=>"delivered"},
   {:recipient=>"6141xxx2820", :timestamp=>Tue, 27 Oct 2015 00:13:44 +0000, :@uid=>"124", :@receipt_id=>"187238504", :@status=>"delivered"}],
 :@returned=>"5",
 :@remaining=>"33"}
[4] pry(main)>
jbat commented 9 years ago

Have created a PR but need access to repo to push to github ?

danieldraper commented 8 years ago

@jbat you should be able to fork the repo, create a branch, commit to that branch and then pull request from your repo to this repo. That way you can contribute without direct write access to this repo. Hope this helps get your changes accepted.

shawr commented 8 years ago

@jbat did you have any luck?