-
-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable endpoint
as a configuration option to bypass NS WSDL issues
#473
Conversation
@iloveitaly obviously zero rush, but when you get a chance :) |
Looks great! Thanks. In another PR, it would be great to add this snippet to the configuration:
So users don't need to construct this themselves. Maybe it's something set if the API version is 2020 or greater and if the |
@iloveitaly are we planning on including this in a released version soon? |
@gordysc done! Just pushed 0.8.7 |
In the future-proof example: NetSuite::Configuration.endpoint = "#{wsdl_domain}/services/NetSuitePort_#{api_verson}" That needs a protocol, right? NetSuite::Configuration.endpoint = "https://#{wsdl_domain}/services/NetSuitePort_#{api_verson}" It seems I can open up a PR to fix the docs once we confirm that's the issue, not something on my side. |
@cgunther ah, yes, that was a mistake on my part! If could submit a PR to fix that would be great. |
Background
This is related to #445, which I believe first raised this issue.
Recent versions of the NS WSDL contain an incorrect endpoint reference. This seems to have begun on version 2020_1. If you go to
https://<acount_id>.suitetalk.api.netsuite.com/wsdl/v2020_1_0/netsuite.wsdl
you can see at the very bottom:When requests are made to this endpoint the following error is returned:
Solution
To fix, I added a configuration option to set the WSDL endpoint:
This option is passed through to the Savon::Client at the time of client instantiation. Savon then reads the endpoint from its global config when it is building the request:
Note that the
endpoint
configuration is optional, and Savon ignores nilendpoint
configs in favor of the endpoint defined on the WSDL document:So this should be backwards compatible.
Testing
I added automated tests. But the nature of the change makes it hard to really test without deeply mocking private methods of Savon classes. So the best tests are probably manual.
By loading these changes into a console I was able to get a record on the 2020_1 version of the NS API:
Note that the request is sent to the desired endpoint:
https://1234567.suitetalk.api.netsuite.com/services/NetSuitePort_2020_1