Apache CXF Web服务在AJAX调用上失败 [英] Apache CXF Webservice failing on AJAX call

查看:66
本文介绍了Apache CXF Web服务在AJAX调用上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经开发了基于 Apache CXF 的Web服务。

We have developed a webservice based on Apache CXF.

在正常访问时,这种方法工作正常,即使用 APIGEE 或使用 JaxWsProxyFactoryBean (用于 Apache CXF )。但是,当我尝试通过AJAX调用提供SOAP地址来访问此地址时,它给了我以下异常:

This is working fine when accessed normally that is using APIGEE or by using a JaxWsProxyFactoryBean (A clinet for Apache CXF). But when I tried to access this by providing the SOAP Address through AJAX call it is giving me the following exception:

INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: No such operation:  (HTTP GET PATH_INFO: /tata-ws-1.0/TataWeb)
        at org.apache.cxf.interceptor.URIMappingInterceptor.handleMessage(URIMappingInterceptor.java:77)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)
        ...

这是我的AJAX调用代码发生单击按钮

This is my AJAX call code happens on click of a button

<a onclick="sendRequest('GET','http://localhost:8080/tata-ws-1.0/services/TataWeb')"href="#">

获取数据:

function sendRequest(method, url)
{
    method == 'POST';
    {
        http.open(method,url,true);
        http.onreadystatechange = handleResponse;
        http.send(null);
    }
}

WSDL的URL是正确的,因为当我使用
http:// localhost:8080 / tata-ws-1.0 / services / TataWeb?wsdl 显示该Web服务的WSDL。

The URL for WSDL is correct because when i use http://localhost:8080/tata-ws-1.0/services/TataWeb?wsdl it shows the WSDL for that webservice.

请分享您的输入。
谢谢。

Please share your inputs. Thanks.

推荐答案

您需要发送SOAP请求而不是常规的HTTP请求。
最好的方法是使用类似这样的东西:
http:// archive。 plugins.jquery.com/project/jqSOAPClient

Your need to send a SOAP request rather than a regular HTTP request. Best way would be use something like this: http://archive.plugins.jquery.com/project/jqSOAPClient

这篇关于Apache CXF Web服务在AJAX调用上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆