0

我正在尝试做一个 jquery ajax SOAP 请求。但无法使其工作。我尝试连接的服务器仅接收 SOAP 格式的请求和响应。

var productServiceUrl = 'https://edelivery2.readiness.metavante.com/ConnectwareWS/ePaymentServices';
var soapMessage = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://epayments.metavante.com/types/request" xmlns:com="http://metavante.com/types/common" xmlns:req1="http://epayments.metavante.com/types/security/request" xmlns:com1="http://epayments.metavante.com/types/common" xmlns:req2="http://epayments.metavante.com/types/consumer/request" xmlns:req3="http://epayments.metavante.com/types/user/request" xmlns:req4="http://epayments.metavante.com/types/fundingAccount/request" xmlns:req5="http://epayments.metavante.com/types/consumerPayee/request">'+
                '<soapenv:Header/>'+
                '<soapenv:Body>'+
                   '<req:EbMtvnSvcReq>'+
                      '<req:MtvnSvcVer>v1.0.0</req:MtvnSvcVer>'+
                      '<req:MsgUUID>9919cd11-346a-0323-0358-19fd184dba81</req:MsgUUID>'+
                      '<req:PrcsParms>'+
                         '<req:SrcID>DCUMOBILE</req:SrcID>'+
                      '</req:PrcsParms>'+
                      '<req:Svc>'+
                         '<req:SvcParms>'+
                            '<req:ApplID>EB_UAT</req:ApplID>'+
                            '<req:SvcID>GetConsumerPayeeDetails</req:SvcID>'+
                            '<req:SvcVer>v1.3.0</req:SvcVer>'+
                            '<req:RoutingID>hfs-3427</req:RoutingID>'+
                         '</req:SvcParms>'+
                         '<req:MsgData>'+
                            '<req:GetConsumerPayeeDetails>'+
                               '<com:locale>en-US</com:locale>'+
                               '<req1:userId>4811</req1:userId>'+
                            '</req:GetConsumerPayeeDetails>'+
                         '</req:MsgData>'+
                      '</req:Svc>'+
                   '</req:EbMtvnSvcReq>'+
                '</soapenv:Body>'+
                '</soapenv:Envelope>';

做这个请求我正在做

$.ajax({
        url: productServiceUrl,
        type: "POST",
        dataType: "xml",
            processData: false,
        data: soapMessage,
        complete: endSaveProduct,
        contentType: "text/xml; charset=\"utf-8\"",
        success: processSuccess,
        error: processError

    });


function processSuccess(data, status, req) {
            if (status == "success")
                $("#response").text($(req.responseXML).find("HelloResult").text());
        }

        function processError(data, status, req) {
            console.log(data);
            console.log(status);
            console.log(req);
        }  

我在本地主机中运行 html 页面。并执行上述请求。但出现错误

![XMLHttpRequest cannot load https://edelivery2.readiness.metavante.com/ConnectwareWS/ePaymentServices. Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin.][1]
4

0 回答 0