Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. request.log.setActionStart(request.requestID, "FINPT-WEBSERVICE", "webservice");
  2. var options = {
  3. hostname: "servicos.portaldasfinancas.gov.pt",
  4. port: 701,
  5. path: "/sgdtws/documentosTransporte",
  6. method: "POST",
  7. pfx: fs.readFileSync('keys/TesteWebService.pfx'),
  8. cert: fs.readFileSync('keys/ChavePublicaAT.cer'),
  9. passphrase: "TESTEwebservice",
  10. agent: false,
  11. rejectUnauthorized: false,
  12. secureProtocol: 'SSLv3_method',
  13. headers: {
  14. "Content-Type": "text/xml;charset=UTF-8",
  15. "SOAPAction": "https://servicos.portaldasfinancas.gov.pt:701/sgdtws/documentosTransporte/",
  16. }
  17. };
  18. //options.agent = new https.Agent(options);
  19. var reqFinWebs = https.request(options, function(resFinWebs) {
  20. console.log(resFinWebs.statusCode);
  21. if(resFinWebs.statusCode==200){
  22. //....
  23. });
  24. reqFinWebs.end(soapXML);
  25. console.log(soapXML);
  26.  
  27. 500
  28. 500 '<?xml version='1.0' ?>n<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>n<env:Body>n<env:Fault>n<faultcode>env:Client</faultcode>n<faultstring>InternalError</faultstring>n</env:Fault>n</env:Body>n</env:Envelope>n'
  29. <?xml version='1.0' ?>
  30. <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
  31. <env:Body>
  32. <env:Fault>
  33. <faultcode>env:Client</faultcode>
  34. <faultstring>Internal Error</faultstring>
  35. </env:Fault>
  36. </env:Body>
  37. </env:Envelope>
  38.  
  39. headers: {
  40. "Accept": "text/xml",
  41. "Content-length": soapXML.length,
  42. "Content-Type": "text/xml;charset=UTF-8",
  43. "SOAPAction": "https://servicos.portaldasfinancas.gov.pt/sgdtws/documentosTransporte/",
  44. }
  45.  
  46. var ctx = { request: request
  47. , url: "https://servicios.pami.org.ar/trazamed.WebServiceSDRN"
  48. , action: "http://localhost:59051/trazamed.WebServiceSDRN"
  49. , contentType: "text/xml"
  50. ,location: "http://localhost:59051/trazamed.WebServiceSDRN"
  51.  
  52. }
  53.  
  54.  
  55. var handlers = [ new Security({}, [new UsernameToken({username:"testwservice", password:"testwservicepsw"})])
  56. , new Http()
  57. ]
  58.  
  59. ws.send(handlers, ctx, function(ctx) {
  60. console.log("response:" + ctx.response);
  61.  
  62. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement