开发者

Provide Access-Control-Allow-Origin in a java webservice

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜