I am exposing a SOAP webservice written in java . I would like to have simple javascript clients access my webservice. Inorder to allow cross domain access by them, i would like to send Access-Control-Allow-Origin: *
in my response header.This should be send when the client sends a GET request to receive my wsdl file and also when the client POST a SOAP request. I do not kno开发者_运维知识库w how to send such a header from my webservice. The webservice class is given below.
@WebService()
public class ChatServer {
/** This is a sample web service operation */
@WebMethod(operationName="echoChat")
public Message echoChat(Message message){
String userid="Server";
message.setUserid(userid);
return message;
}
}
You can implement a SoapHandler and see the request type and url and set the response header.
Also See
- writing-a-handler-in-jax-ws
精彩评论