将 clientaccesspolicy.xml 放置在 Netbeans Webservice 项目中的什么位置?
我使用 Netbeans 6.9 开发 Web 服务,并使用嵌入式 glassfish 服务器来部署 Web 服务 (http://some_domain/project_name/ws_for_sl4)。在另一台服务器上部署了一个 Silverlight 4 客户端,该客户端应该可以访问 Web 服务。
我知道我必须有 clientaccesspolicy.xml (在 http://some_domain/project_name< /a>)但是我不知道该怎么做。我的意思是,我不知道需要将 clientaccesspolicy.xml 放在 netbeans 项目的哪个文件夹中才能将其自动部署在嵌入式 glassfish 服务器上。让我的 SL4 客户端使用网络服务。
I develop a Webservice using Netbeans 6.9 and I use an embedded glassfish server to deploy my Webservice (http://some_domain/project_name/ws_for_sl4). On a different server there is deployed a Silverlight 4 client, which should have accesss to the Webservice.
I know that I have to have clientaccesspolicy.xml (under http://some_domain/project_name) however I do not know how to do it. I mean, I do not know in which folder of the netbeans project I need to put clientaccesspolicy.xml to have it automaticly deployed on an embedded glassfish server. To have my SL4 client using the webservice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解决方案:
- 将 clientaccesspolity.xml 和 crossdomain.xml 放在 /Web Pages* 下
- 打开“项目属性”(在项目根目录上单击鼠标右键),转到“运行”,然后删除“上下文路径”的值。
现在,您的 WS 将直接部署在 some_domain 下,因为 SL4 需要它(SL4 正在域名下查找这些文件。)。 SL4 访问 clientaccesspolity.xml 和 crossdomain.xml 没有问题。
Solution:
- put clientaccesspolity.xml and crossdomain.xml under /Web Pages*
- open Project Properties (click right mouse button on a project root), go to Run, and delete a value of "Context Path".
Now your WS will be deployed directly under some_domain as it is required by SL4 (SL4 is looking for these files under the domain name.). SL4 will have no problem to access clientaccesspolity.xml and crossdomain.xml.
如果有人不喜欢将其 Web 服务移至“root”,而是更喜欢将其放在
http://localhost:8080/aDifferentLocation/MyActualWebService
中,则将这些 XML 放入项目网页中文件夹不会剪切它。http://localhost:8080/aDifferentLocation/clientaccesspolicy.xml
和
http://localhost:8080/aDifferentLocation/crossdomain.xml
不起作用,因为它们需要位于
http://localhost:8080/clientaccesspolicy.xml
和
http://localhost:8080/crossdomain.xml
要实现此目的,您必须找到 GlassFish 服务器的安装文件夹,我们将其命名为 [GlassFishInstallPATH] 并将 XML 粘贴到名为 < 的子文件夹中code>docroot:
[GlassFishInstallPATH]/domains/domain1/docroot/
<--这里是 XML。(来源)
如果您想知道如何在 Eclipse 中执行相同的操作,您必须找到 Eclipse J2EE 工作区中的 ROOT 文件夹:
C:\Eclipse_j2ee_workspaces\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps \ROOT/
<-- XML 位于此处。In case anyone doesn't like moving their webservice to "root", and instead prefers to have it in
http://localhost:8080/aDifferentLocation/MyActualWebService
, then placing those XMLs in the project Web Pages folder doesn't cut it.http://localhost:8080/aDifferentLocation/clientaccesspolicy.xml
and
http://localhost:8080/aDifferentLocation/crossdomain.xml
would not work, as they need to be in
http://localhost:8080/clientaccesspolicy.xml
and
http://localhost:8080/crossdomain.xml
To achieve this, you must track down the folder where your GlassFish server is installed, let's call it [GlassFishInstallPATH] and paste the XMLs into the subfolder called
docroot
:[GlassFishInstallPATH]/domains/domain1/docroot/
<--here go the XMLs.(source)
In case you're wondering how you would do the same thing in Eclipse, you must track down the ROOT folder in your Eclipse J2EE workspace:
C:\Eclipse_j2ee_workspaces\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT/
<-- the XMLs go here.