jquery - SOAP Service fails with AJAX call but works fine in SOAPUI -


invoking soap service throws 404 error works fine in soap ui. somewhere found due cors problem set header 'access-control-allow-origin': '*' no luck

below how calling service

let _this=this;   var webserviceurl = 'http://localhost:8082/ode/processes/ws_invocation.ws_invocationport';   var soapmessage = '<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.invocation.tps"><soapenv:header/><soapenv:body><ws:ws_invocationrequest><ws:input>1</ws:input><ws:input1>mohan</ws:input1></ws:ws_invocationrequest></soapenv:body></soapenv:envelope>'    $.ajax({         url: _this.webserviceurl,          type: "post",         datatype: "xml",          crossdomain: true,         headers: {                 'access-control-allow-origin': '*'             },         data: _this.soapmessage,          contenttype: "text/xml; charset=\"utf-8\"",         success: _this.onsuccess,          error: _this.onerror     }); 

below successful response soap ui enter image description here

it cors problem should enable cors in api service, every platform have different config in nodejs, apache, nginx or etc.

you may documentation how activating cors in web service here https://enable-cors.org/index.html

for request doing this

//jquery <= 1.12.x  $.get(api_url)  .success(function(response) {      var res = $(response).find('your_node');  })  .error(function(err) {    });    //jquery > 1.12.x  $.get(api_url)  .then(function(response) {    var res = $(response).find('your_node');  })  .catch(function(err) {    });

regards.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -