Reputation: 133
I am using savon gem for integrating paysbuy in my project which is made in Ruby on Rails. This is how I am creating the savon client
client = Savon.client do
endpoint "https://www.paysbuy.com/receiveresponse/Result.aspx"
namespace "https://www.paysbuy.com/receiveresponse/ResultReg.aspx"
wsdl "https://demo.paysbuy.com/api_paynow/api_paynow.asmx"
end
logger.info"%%%%%%%%%%%%%%%%%#{client.operations}%%%%%%%%%%%%%%5555555"
But the response for "client.operations" is coming as "[]". I need help for rectifying anything wrong doing in my side. Thanks in advance for any help.
Upvotes: 1
Views: 785
Reputation: 3494
I assume you use Savon 2.x? The syntax of your call is not correct. You need a parameter list not a block.
You also mix WSDL with WSDL less calling convention. You either specify
wsdl:
or
endpoint: ...
namespace: ...
client.operations
doesn't work because you didn't give it a correct wsdl url.
Giving that's a MS based interface it is safe to assume that you can retrieve the WSDL with the parameter ?WSDL
at the URL. Try this:
client = Savon.client(
wsdl: "https://demo.paysbuy.com/api_paynow/api_paynow.asmx?wsdl",
log: true,
log_level: debug,
pretty_print_xml: true
)
print client.operations
Unfortunately that call fails using Savon. I suspect it can't interpret the WSDL document.
What you can do is to use SoapUI to inspect your service and build a client without a WSDL.
client = Savon.client(
endpoint: "https://demo.paysbuy.com/api_paynow/api_paynow.asmx",
namespace: "http://tempuri.org",
log: true,
log_level: debug,
pretty_print_xml: true
)
I read the WSDL and found something which might be the namespace, but that can be tricky. Sometimes it needs some tinkering to find the correct request. When you've found a working request using SoapUI, you need to translate it into Ruby code to make it work. That was always my approach at least. Feel free to ask when you've reached that point.
Upvotes: 1