Jump to content

запросы со стороны клиента на стороние сервисы


MSMK

Recommended Posts

Необходимо отправить запрос на сторонний сервис со стороны клиента, используя 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);'
    + '  },'
    + '});');

 

Срочно нужна Ваша помощью. Возможно ли реализовать запросы на сторонние сервисы?

scrin.jpg

Link to comment
Share on other sites

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);'
    + '  }'                           //<--------------  
    + '});');

 

Link to comment
Share on other sites

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);'
    + '  }'                           //<--------------  
    + '});');

 

рахмет!

Link to comment
Share on other sites

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

screen.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...