Help with async and sync behaviour

17 views
Skip to first unread message

Miha Zoubek

unread,
Mar 13, 2019, 6:18:38 AM3/13/19
to nodejs
Hi

I have this part of code:

  xmlenc.encrypt(message, options509, function(err, result) {
    message
= result
    console
.log("asdsadasdasdasdsa",result)
})

and then I have this part of code:

 xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
     
"<" + envelopeKey + ":Envelope " +
      xmlnsSoap
+ " " +
     
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
      encoding
+
     
this.wsdl.xmlnsInEnvelope + '>' +
     
((self.soapHeaders || self.security) ?
       
(
         
"<" + envelopeKey + ":Header>" +
         
(self.soapHeaders ? self.soapHeaders.join("\n") : "") +
         
(self.security && !self.security.postProcess ? self.security.toXML() : "") +
         
"</" + envelopeKey + ":Header>"
       
)
       
:
         
''
       
) +
     
"<" + envelopeKey + ":Body" +
     
(self.bodyAttributes ? self.bodyAttributes.join(' ') : '') +
     
(self.security && self.security.postProcess ? ' Id="_0"' : '') +
     
">" +
      message
+
     
"</" + envelopeKey + ":Body>" +
     
"</" + envelopeKey + ":Envelope>";

Isse is that the second part execute before first part. I need somehow block first part so that program will continue with first part of code gets result. Other way is to put second part of code in first part of code but then I get error as  
this.wsdl.xmlnsInEnvelope

does not set.

How can I block first part of code or how to achive that "this.wsdl.xmlnsInEnvelope" will be set

Reply all
Reply to author
Forward
0 new messages