Reference a remote site setting URL in Apex class?

こ雲淡風輕ζ 提交于 2019-12-06 00:42:09

问题


I have a webservice class that will be in a managed package and distributed to multiple clients. The class currently has a variable with the hardcoded value of the server it's hitting.

The problem: the server will be different for each client, so a hardcoded value will not work.

I figured since each client will have to add their server to their remote site settings, the easiest way might be to grab the correct URL from their setting. Is this possible? Or is there another "right" way to accomplish this? Thanks


回答1:


The best way I've found to save configuration values is to use Apex Custom Settings. To set the Remote Site settings programmatically you could use the Metadata API.



来源:https://stackoverflow.com/questions/6832695/reference-a-remote-site-setting-url-in-apex-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!