Hi all,
Started reading up on Meteor and an app I would like to build would need to make SOAP web service calls to a third party system. I can’t find any samples anywhere. REST is not an option with this system.
Thanks
Hi all,
Started reading up on Meteor and an app I would like to build would need to make SOAP web service calls to a third party system. I can’t find any samples anywhere. REST is not an option with this system.
Thanks
hey @heckler,
I’d look at it as more of a nodejs question, as the integration is not unique to a Meteor server
So, I suggest this:
also, someone has already written a wrapper pacakge for Meteor:
I personally haven’t tried the Meteor package, but by reading the source I can tell it’s quite a transparent wrapper
Thanks @chenroth I guess I need to look deeper at how to integrate NPM packages. I did stumble upon that wrapper package but couldn’t tell if it would do or not.
Wrapping Npm packages on your own is very simple. I can write you a sample
package if you like
Awesome! I’d love to see a sample if it’s not too much of a bother
ok, i’ll create a repo for you soon
You rock!
That doesn’t look horribly hard, I feel a little better now
The easiest way to add meteor-soap to your project is to do “meteor add zardak:soap”
OK - did this - appeared to run fine and when I call ‘meteor list’ I can see soap listed. However, I still can’t make a soap call because any mention of ‘Soap’ in my code results in:
Cannot find name 'Soap'
Frustratingly there are no examples anywhere of all of the code I need. Using:
import { Soap } from 'meteor/soap';
…just results in even more errors.
I’ve not used this package, but this statement should be:
import { Soap } from 'meteor/zardak:soap';
However, have you considered just using the most recent npm module directly?
meteor npm install --save soap
and then, wherever you need it:
import Soap from 'soap';
Note, that it doesn’t use ES2015 module syntax, so not { Soap }
.
I got it to work with zardak:soap package eventually a little after I posted the original post. I poked and prodded and cursed until it just gave up and started doing what I wanted it.
I’ll post a full (but sanitized) example here of what did the trick for me once I get off work.
ok here we go, here is what did the trick for me on meteor version 1.2. with zardak:soap
var myUser = blah;
var myPass = blah;
var url = ‘https://someWSDL_URL_or_localfile?wsdl’; //local file, could also be a remote http url
var pageCount = ‘1’;
var args ={
Request_Criteria:{
Some_Request_Criteria1: ‘true’,
Some_Request_Criteria2: ‘false’
},
Response_Group:{
Some_Response_Group1:‘true’,
Some_Response_Group2:‘true’,
Some_Response_Group3:‘false’,
},
Response_Filter:{
Page: pageCount
}
};try { var client = Soap.createClient(url); client.setSecurity(new Soap.WSSecurity(myUser, myPass));
var result = client.drilling.into.theWebService(args); Meteor.call('doSomethingWithResults',result); var resultPages = result.Response_Results.Total_Pages; for (var i = 2; i <= resultPages; i++) { args.Response_Filter.Page = i; //iterate through the rest of the pages of results result = client.drillinto.webservice.Get_MyObject(args); Meteor.call('doSomethingWithResults',result); }
} catch (err) { if(err.error === 'soap-creation') { console.log('SOAP Client creation failed'); console.log(err); });
} else if (err.error === 'soap-method') { console.log('SOAP Method call failed'); console.log(err); }); } } doSomethingWithResults: function(result) { var eventsJson = JSON.stringify(result, null, 2);
rslt = JSON.parse(eventsJson).Response_Data.MyObject;
for(var j in rslt) {
try { DO STUFF WITH RESULTS........
Have you succeeded also using Meteor 1.4?