Last active
May 16, 2016 07:04
-
-
Save cankemik/64a95d972b37cd01620d7db06b13eb8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xml2js from 'xml2js'; | |
import soap from 'soap'; | |
import js2xmlparser from 'js2xmlparser'; | |
import Future from 'fibers/future'; | |
Meteor.methods({ | |
addToList: function () { | |
let envelope = { | |
'DemograficData': [ | |
{ | |
'EmKeyValue': { | |
'KEY': 'EMAIL', | |
'VALUE': 'mail@cankemik.com' | |
} | |
} | |
], | |
'ForceUpdate': false | |
}; | |
let options = { | |
declaration: { | |
'include': false | |
}, | |
prettyPrinting: { | |
'enabled': true | |
} | |
}; | |
let path = Npm.require('path'); | |
let future = new Future(); | |
var url = "https://ws.euromsg.com/max/member.asmx?WSDL"; | |
soap.createClient("https://ws.euromsg.com/max/auth.asmx?WSDL", function (err, client) { | |
if (!err) { | |
let args = {Username: "hititcomp_test_wsuser", Password: "!h1t1tc0mput3r!"}; | |
client.Login(args, function (err, result, body) { | |
if (!err) { | |
console.log("--"); | |
console.log(result); | |
ticket = result.LoginResult.ServiceTicket; | |
console.log(ticket); | |
soap.createClient("https://ws.euromsg.com/max/member.asmx?WSDL", function (err, client) { | |
if (!err) { | |
let args2 = { | |
ServiceTicket: ticket, | |
Key: "EMAIL", | |
Value: "mail@cankemik.com", | |
DemograficData: { | |
EmKeyValue: [ | |
{ | |
Key: "STATUS", | |
Value: "A", | |
targetNSAlias: "tns", | |
targetNamespace: "http://ws.euromsg.com/member" | |
}, | |
{ | |
Key: "EMAIL_PERMIT", | |
Value: "Y", | |
targetNSAlias: "tns", | |
targetNamespace: "http://ws.euromsg.com/member" | |
}, | |
{ | |
Key: "Adınız", | |
Value: "Can", | |
targetNSAlias: "tns", | |
targetNamespace: "http://ws.euromsg.com/member" | |
}, { | |
Key: "Soyadınız", | |
Value: "Kemik", | |
targetNSAlias: "tns", | |
targetNamespace: "http://ws.euromsg.com/member" | |
}], | |
targetNSAlias: "tns", | |
targetNamespace: "http://ws.euromsg.com/member" | |
}, | |
ForceUpdate: false | |
} | |
client.InsertMemberDemography(args2, function (err, result, body) { | |
console.log(result); | |
member_id = result.MemberID; | |
console.log(ticket); | |
console.log(member_id); | |
let args3 = { | |
ServiceTicket: ticket, | |
Key: "EMAIL", | |
Value: "mail@cankemik.com", | |
}; | |
console.log(args3); | |
client.AddToAllLists(args3, function (err, result, body) { | |
console.log("---err ---"); | |
console.log(err); | |
console.log("---err ---"); | |
console.log("--- result ---"); | |
console.log(result); | |
console.log("--- result ---"); | |
console.log("--- body ---"); | |
console.log(body); | |
console.log("--- body ---"); | |
}) | |
}) | |
} | |
}); | |
console.log("--"); | |
} else { | |
console.log(err); | |
} | |
}) | |
} | |
}) | |
//return future.wait(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment