【发布时间】:2015-12-02 19:21:00
【问题描述】:
我已经在 java 中使用 JAX-WS 公开了 SOAP webservice。 以下是代码sn-p:
package com.soap.calculator;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class Calci {
@WebMethod
public int add(int x, int y){
return x+y;
}
@WebMethod
public int subtract(int x, int y){
return x-y;
}
}
以下是发布此网络服务的代码 sn-p:
包 com.soap.calculator;
import javax.xml.ws.Endpoint;
public class Server {
public static void main(String agrs[]){
Endpoint ep = Endpoint.publish("http://localhost:8081/SoapwebService", new Calci());
System.out.println("Service created");
}
}
我正在使用jQuery plugin 使用 SOAP 与此 Web 服务进行通信。由于此 Web 服务在其他域上公开,因此在 CORS 模式下启用了浏览器并生成用于访问 Web 服务的预检请求。我的问题是如何使用 jax-ws 在服务器端启用 CORS 支持?
【问题讨论】:
标签: web-services soap cors jax-ws