在Apex类中引用远程站点设置URL? [英] Reference a remote site setting URL in Apex class?

查看:81
本文介绍了在Apex类中引用远程站点设置URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web服务类,该类将在托管程序包中并分发给多个客户端.该类当前具有一个变量,该变量具有要访问的服务器的硬编码值.

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.

我认为,由于每个客户端都必须将其服务器添加到其远程站点设置中,所以最简单的方法可能是从其设置中获取正确的URL.这可能吗?还是有另一种正确"的方式来实现这一目标?谢谢

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

推荐答案

我发现保存配置值的最佳方法是使用Apex 元数据API .

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.

这篇关于在Apex类中引用远程站点设置URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆