[
https://issues.apache.org/jira/browse/CXF-4805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13570162#comment-13570162
]
Freeman Fang commented on CXF-4805:
-----------------------------------
Hi Benson,
I think in some scenario cxf endpoint can handle request from local browser is
useful, especially for some demos, let customer open a local browser and edit a
soap message and send it out and see the response from same browser page is
convenient.
For the CORS issue, I generally add a out interceptor for the cxf endpoint in
demos, something like
{code}
public class EnableCORSInterceptor extends AbstractPhaseInterceptor<Message> {
public EnableCORSInterceptor() {
super(Phase.PRE_PROTOCOL);
}
@Override
public void handleMessage(Message message) throws Fault {
Map<String, List<String>> headers =
Headers.getSetProtocolHeaders(message);
try {
//Access-Control-Allow-Origin:*
Access-Control-Allow-Methods:POST,GET
headers.put("Access-Control-Allow-Origin", Arrays.asList("*"));
headers.put("Access-Control-Allow-Methods", Arrays.asList("POST",
"GET"));
} catch (Exception ce) {
throw new Fault(ce);
}
}
}
{code}
This can make browser send/receive soap message to/from CXF endpoint.
Freeman
> SOAP services try to process HTTP 'OPTIONS'
> -------------------------------------------
>
> Key: CXF-4805
> URL: https://issues.apache.org/jira/browse/CXF-4805
> Project: CXF
> Issue Type: Bug
> Affects Versions: 2.5.6
> Reporter: Benson Margulies
>
> We tried, somewhat absentmindedly, to access a JAX-WS SOAP service
> cross-origin-ly from a browser. The browser sent the required OPTIONS ahead
> of the POST, and CXF went ahead and tried to handle it as if it was a SOAP
> request, and then got very sad trying to parse the empty payload as XML.
> Shouldn't CXF have produced a clear log message and error response about not
> understanding OPTIONS?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira