1
我已经在java中使用JAX-WS公开SOAP SOAP webservice。 以下是代码片段:如何在java中的JAX-WS服务器端启用CORS
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;
}
}
以下是用于发布此WebService的代码片段:
包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与此web服务使用SOAP.Since此web服务上的一些其他域暴露通信
,在浏览器模式CORS并产生用于访问web服务预检要求被启用。我的问题是如何使用jax-ws在服务器端启用CORS支持?