无法加载响应

时间:2012-07-05 07:53:46

标签: javascript iphone ios web-services titanium

    var soapre1 = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:glob=\"http://sap.com/xi/SAPGlobal20/Global\">";
    var soapre2 = "<soapenv:Header/><soapenv:Body><glob:EmployeeLeaveRequestByParticipantQuery><EmployeeLeaveRequestSelectionByParticipant><EmployeeLeaveRequestParticipantRoleCode listVersionID=\"?\">2</EmployeeLeaveRequestParticipantRoleCode>";
 var soapre3 = "<!--Zero or more repetitions:--> <EmployeeLeaveRequestParticipantWorkAgreementIDInterval><IntervalBoundaryTypeCode>1</IntervalBoundaryTypeCode>  <!--Optional:-->  <LowerBoundaryWorkAgreementID schemeID=\"?\" schemeAgencyID=\"?\">1009</LowerBoundaryWorkAgreementID></EmployeeLeaveRequestParticipantWorkAgreementIDInterval>";
 var soapre4 = " <!--Zero or more repetitions:--> </EmployeeLeaveRequestSelectionByParticipant></glob:EmployeeLeaveRequestByParticipantQuery> </soapenv:Body></soapenv:Envelope>";

    var soapRequest = soapre1+soapre2+soapre3+soapre4;

    var authstr = 'Basic ' +Titanium.Utils.base64encode('S0009231839'+':'+ 'm8390967743!'); 

     var soapxhr = Ti.Network.createHTTPClient();
        soapxhr.setRequestHeader('SOAPAction',soapRequest);
    soapxhr.open("POST","http://erp.esworkplace.sap.com/sap/bc/srt/pm/sap/ecc_empleavereqparctqr/800/default_profile/2/binding_t_http_a_http_ecc_empleavereqparctqr_default_profile");
        soapxhr.setRequestHeader('Authorization', authstr);   
        soapxhr.setRequestHeader('Content-Type','text/xml','charset=utf-8');    
        soapxhr.send();

        soapxhr.onload = function(e)


    {
         Ti.API.info('abcd');       
        //get the xml data and let it roll!
        var doc = this.responseXML;
         Ti.API.info(doc);      
    }

    soapxhr.onerror = function (e){
        alert('Error');
        Ti.API.info(e);
    }

无法加载响应直接收到错误

[INFO] {
    source = "[object TiNetworkClient]";
    type = error;
}

任何一条建议如何解决问题!

@提前致谢

1 个答案:

答案 0 :(得分:0)

在所有浏览器中它的说错误!但我发现了一些wsdl和soap请求,所以为了打开响应,我需要将方法名称传递给http请求!然后它工作