如何在服务器端为使用 Grails 和 CXF 发布的 Web 服务启用 MTOM?
使用 Grails 和 CXF,我发布了一个小型 Web 服务,如下所示。
class TestService {
static expose=['cxf']
int pushData(int id, DataHandler data) {
//receives data for a specific ID,
return 1
}
}
事情是我现在想要启用 MTOM 来传输 DataHandler 数据。通常,使用 Groovy 和 CXF(或 JAX-WS),我会将 TestService
发布为 Endpoint
Endpoint ep = Endpoint.publish("http://localhost:9000/test", new TestService())
SOAPBinding binding = (SOAPBinding)ep.getBinding();
binding.setMTOMEnabled(true);
一切就完成了。
现在我使用 Grails 进行发布,但我不知道如何获取 Endpoint
。有谁知道如何实现这一点?
Using Grails and CXF, I have published a small web service that looks like this
class TestService {
static expose=['cxf']
int pushData(int id, DataHandler data) {
//receives data for a specific ID,
return 1
}
}
The thing is that I now would like to enable MTOM for the transfer of the DataHandler-data. Normally with Groovy and CXF (or JAX-WS) I'd publish TestService
as an Endpoint
Endpoint ep = Endpoint.publish("http://localhost:9000/test", new TestService())
SOAPBinding binding = (SOAPBinding)ep.getBinding();
binding.setMTOMEnabled(true);
And all's done.
Now that I use Grails to do my publishing I can't figure out how to get the Endpoint
. Does anyone know how this could be accomplished?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设服务接口如下所示。
端点的属性可以在 cxf-servlet.xml 中指定。对于名为 ServiceImpl 的实现服务,您需要添加以下规范
Let's assume that the service interface looks like this
The attributes of the endpoint can be specified in the cxf-servlet.xml . With an implementing service called ServiceImpl, you need to add the following specifications