Guest User

Untitled

a guest
Nov 27th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. ppmRouter.get("/get_time_sheet",(req,res,next) => {
  2.  
  3. var resourceid = req.query.param_resourceid
  4. var soap = require('soap');
  5. var url = config.wsdlObjectPath + "TimePeriods"
  6. var sheader = { "Auth": {Username: config.xog_user, Password: config.password}}
  7.  
  8. var args = {
  9. ":NikuDataBus": {
  10. ":Header":{
  11. attributes: {
  12. version: "6.0.11",
  13. action: "read",
  14. objectType: "timeperiod",
  15. externalSource: "NIKU"
  16. }
  17. },
  18. ":Query": {
  19. ":Filter": {
  20. attributes: {
  21. name: "resourceID",
  22. criteria: "EQUALS"
  23. },
  24. $value: resourceid
  25. }
  26. }
  27. }
  28. };
  29.  
  30. var wsdlOptions = {
  31. overrideRootElement: {
  32. namespace: 'tns',
  33. xmlnsAttributes: []
  34. }
  35. };
  36.  
  37. soap.createClient(url, wsdlOptions, function(err, client) {
  38. client.addSoapHeader(sheader,"","","");
  39. client.setEndpoint(config.xog_url)
  40. client.ReadTimeperiod(args,(error,result)=>{
  41. console.log(client.lastRequest)
  42. if (error) throw error;
  43. console.log(result)
  44. res.send(result)
  45. })
  46. });
  47. })
Add Comment
Please, Sign In to add comment