MSMK Posted October 15, 2018 Share Posted October 15, 2018 Необходимо отправить запрос на сторонний сервис со стороны клиента, используя JavaScript. Использую UniSession.AddJS. Выдает ошибку.Код: soapRequest := '<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:WTOSignServiceIntf-IWTOSignService">'+ '<soapenv:Header/>'+ '<soapenv:Body>'+ '<urn:SignData soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'+ '<Value xsi:type="urn:TSignDataRequest" xmlns:urn="urn:WTOSignServiceIntf">'+ '<UID xsi:type="xsd:string">test</UID>'+ '<Data xsi:type="xsd:string">test</Data>' + '<Files xsi:type="xsd:string">test</Files>' + '<SignFiles xsi:type="xsd:string">test</SignFiles>' + '</Value>'+ '</urn:SignData>'+ '</soapenv:Body>'+ '</soapenv:Envelope>'; UniSession.AddJS('$.ajax({' + 'url: "' + 'http://localhost:7777/soap/IWTOSignService' + '",' +'contentType: "text/xml",' + 'type: "POST",' +'crossDomain: true,' + 'dataType: "xml",' + 'data: "' + soapRequest +'",' + 'success: function(data){' + ' alert("OK!"+data);' + ' },' + 'error: function(data){' + ' alert("Error!"+data.responseText);' + ' },' + '});'); Срочно нужна Ваша помощью. Возможно ли реализовать запросы на сторонние сервисы? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 15, 2018 Share Posted October 15, 2018 UniSession.AddJS('$.ajax({' + 'url: "' + 'http://localhost:7777/soap/IWTOSignService' + '",' + 'contentType: "text/xml",' + 'type: "POST",' + 'crossDomain: true,' + 'dataType: "xml",' + 'data: ''' + soapRequest +''',' //<-------------- + 'success: function(data){' + ' alert("OK!"+data);' + ' },' + 'error: function(data){' + ' alert("Error!"+data.responseText);' + ' }' //<-------------- + '});'); Quote Link to comment Share on other sites More sharing options...
MSMK Posted October 15, 2018 Author Share Posted October 15, 2018 4 minutes ago, Sherzod said: UniSession.AddJS('$.ajax({' + 'url: "' + 'http://localhost:7777/soap/IWTOSignService' + '",' + 'contentType: "text/xml",' + 'type: "POST",' + 'crossDomain: true,' + 'dataType: "xml",' + 'data: ''' + soapRequest +''',' //<-------------- + 'success: function(data){' + ' alert("OK!"+data);' + ' },' + 'error: function(data){' + ' alert("Error!"+data.responseText);' + ' }' //<-------------- + '});'); рахмет! Quote Link to comment Share on other sites More sharing options...
MSMK Posted October 16, 2018 Author Share Posted October 16, 2018 On 10/15/2018 at 3:56 PM, Sherzod said: UniSession.AddJS('$.ajax({' + 'url: "' + 'http://localhost:7777/soap/IWTOSignService' + '",' + 'contentType: "text/xml",' + 'type: "POST",' + 'crossDomain: true,' + 'dataType: "xml",' + 'data: ''' + soapRequest +''',' //<-------------- + 'success: function(data){' + ' alert("OK!"+data);' + ' },' + 'error: function(data){' + ' alert("Error!"+data.responseText);' + ' }' //<-------------- + '});'); Доброе время суток! Столкнулся с проблемой при отправке запроса со стороны клиента на SOAP сервис. Запрос приходит пустым на сервис и сервис ни как не отвечает на него. Пробовал отправлять используя SoapUI 5.2.1 (screen.png) - запрос приходит на сервис и сервис отправляет ответ. Возможно через unigui невозможно отправлять запросы на сторонние сервисы или необходимо дополнительно прописать какие то параметры в запросе???? Помогите с этой задачей. Проекты клиента и сервиса выложил в архив TestAjaxRequest.zip Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.