Closed ghost closed 7 years ago
You can surely replicate such a request with $.soap. I think your best shot would be to use the option to specify the full payload (aka the soap envelope in this case) as a string. For instance you could do:
var header = "<soap:Header><wsse:Security> .... </wsse:Security></soap:Header>";
var body = "<soap:Body><com:VendorSearch>12345</com:VendorSearch></soap:Body>";
var envelope = "<soap:Envelope xmlns:com="http://com.voith.e1.bssv.JP58010V/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> + header + body + "</soap:Envelope>";
$.soap({
url: "https://172.21.45.230:7581/DV910/",
method: "VendorSearchManager",
data: envelope
});
Just a couple of notes to make implementing this simpler:
1) Make sure you read about same origin policy, you will probably need something to bypass this
2) Read about all the options of $.soap, you can do a lot of tweaking with it (note that when you do specify data
as a xml string, most of the tweaking is not needed/does not work).
Also keep in mind that $.soap is not doing anything too magical. You can easily do the exact same thing using jquery's ajax
function. $.soap is mostly a wrapper function to make things easier when your soap-calls are relatively easy (as was the case in our business).
Thank you Remy for getting back to me so quickly and for the excellent advice . I will take all your points on board and will get studying . thank you again for all your help and advice its very much appreciated in deed . I will get beavering away and learning
thank you again
Charlie
happy beavering! feel free to get back with any questions as they arise!
Hi Remy, I hit an issue last week where i was getting a corect SOAP envelope created but also geting an error SCRIPT5022:Unexpected Content: Undefined File jquery.soap.js . I sent an email over to remy.blom@hku.nl with a load of findings and screen shots . please accept my apollogese if ive snet it to the wrong address and if there is a better one I can send to. I'm not sure if its down to me needing to wrap some of my code in a try catch or if its somethign deeper. would you be able to help me investigate please when you have a little time and understand whats up
thank you for your awesome guidance and support
best regards
Charlie
Hello All Please for give for this post , I am fairly new to Javascript & Jquery primerily coming from a .net and java background and I am learning on my feet .
I Came across Jquery Soap while trying to resolve a particular issue I have at the moment and I have a few fairly basic questions Please for give me if these are a little low level , as I'm a learner and I am trying to get my self up to speed.
I should say I am not after spoon feeding here just a little guidance to get me on the right Path.
I am trying to use Javascript and / or Jquery to consume a web service that we have developed at work and I am trying to re create the following request which was generated using SOAP UI. unfortunatley we cant switch to REST or any alternatives and are stuck with the web service format
my question is Can I re create this soap Call using Jquery.soap or should I consider other solutions ? my confusion comes mainly from the header section , adding attributes to the header tags is whats mystifying me at the moment that nd and adding extra fields for the Nonce etc its typical that our web services are a bit of standard when it comes to tags. if I can do this with JQuery.Soap I'll cary on my studdies . and if not then I will try and find any alternatives out there . again any advice you may have on where I could start to look would be very gratefully received
here is an example request that I am hoping to replicate
POST https://172.21.45.230:7581/DV910/VendorSearchManager HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: text/xml;charset=UTF-8 SOAPAction: "" Content-Length: 1250 Host: 172.21.45.230:7581 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5)