How can I display the SOAP envelope in XML format in nodejs?










0















I have a simple SOAP service working using nodejs but I am having trouble figuring out how to build the correct envelope structure that is required for my project.



Is there a way to display the SOAP envelope in XML format that is sent to the server?



I also tried forceSoap12Headers:true` but it did not call v12 methods in my server. Any hints here would be great.



SERVER



 "use strict";
var soap = require('soap');
var http = require('http');
var myService =
ACME:
ACMESoap:
CalcFee: function(args, callback)
callback(
"ns1:barcodeReceive": args.cardNumber,
"ns1:requestId": args.requestId,
"ns1:calculatedFee": 0.15
);
,
LoadCard: function(args, callback)
callback(
"ns1:barcodeReceived": args.cardNumber,
"ns1:requestId": args.requestId,
"ns1:transactionAmount": '100.00',
"ns1:currency": 'EUR'
);

,
ACMESoap12:
CalcFee: function(args, callback)
callback(
"ns1:barcodeReceived": args.cardNumber,
"ns1:calculatedFee": 0.15
);
,
LoadCard: function(args, callback)
callback(
"ns1:barcodeReceived": args.cardNumber,
"ns1:transactionAmount": '100.00',
"ns1:currency": 'EUR'
);



;
var port = 7777;
var xml = require('fs').readFileSync('ACMEService.wsdl','utf8');
var server = http.createServer(function(request,response)
response.end("404: Not Found: " + request.url);
);
console.log('Started server on port ' + port);
server.listen(port);

soap.listen(server,'/wsdl',myService, xml);


CLIENT



 "use strict";
console.log('Started Client...');
const util = require('util')
var soap = require('soap');
var url = 'http://ACME.net:7777/wsdl?wsdl';
var args =
requestId: '2833007',
cardNumber: '3452345234'
;
var args2 =
requestId: '2833008',
cardNumber: '56345634563'
;
var options =
forceSoap12Headers: true
;
soap.createClient(url, options, function(err,client)
client.CalcFee(args,function(err, result, rawResponse)
console.log(rawResponse);
// console.log(client.describe());
);
client.LoadCard(args2,function(err,result, rawResponse)
console.log(rawResponse);
);
);









share|improve this question


























    0















    I have a simple SOAP service working using nodejs but I am having trouble figuring out how to build the correct envelope structure that is required for my project.



    Is there a way to display the SOAP envelope in XML format that is sent to the server?



    I also tried forceSoap12Headers:true` but it did not call v12 methods in my server. Any hints here would be great.



    SERVER



     "use strict";
    var soap = require('soap');
    var http = require('http');
    var myService =
    ACME:
    ACMESoap:
    CalcFee: function(args, callback)
    callback(
    "ns1:barcodeReceive": args.cardNumber,
    "ns1:requestId": args.requestId,
    "ns1:calculatedFee": 0.15
    );
    ,
    LoadCard: function(args, callback)
    callback(
    "ns1:barcodeReceived": args.cardNumber,
    "ns1:requestId": args.requestId,
    "ns1:transactionAmount": '100.00',
    "ns1:currency": 'EUR'
    );

    ,
    ACMESoap12:
    CalcFee: function(args, callback)
    callback(
    "ns1:barcodeReceived": args.cardNumber,
    "ns1:calculatedFee": 0.15
    );
    ,
    LoadCard: function(args, callback)
    callback(
    "ns1:barcodeReceived": args.cardNumber,
    "ns1:transactionAmount": '100.00',
    "ns1:currency": 'EUR'
    );



    ;
    var port = 7777;
    var xml = require('fs').readFileSync('ACMEService.wsdl','utf8');
    var server = http.createServer(function(request,response)
    response.end("404: Not Found: " + request.url);
    );
    console.log('Started server on port ' + port);
    server.listen(port);

    soap.listen(server,'/wsdl',myService, xml);


    CLIENT



     "use strict";
    console.log('Started Client...');
    const util = require('util')
    var soap = require('soap');
    var url = 'http://ACME.net:7777/wsdl?wsdl';
    var args =
    requestId: '2833007',
    cardNumber: '3452345234'
    ;
    var args2 =
    requestId: '2833008',
    cardNumber: '56345634563'
    ;
    var options =
    forceSoap12Headers: true
    ;
    soap.createClient(url, options, function(err,client)
    client.CalcFee(args,function(err, result, rawResponse)
    console.log(rawResponse);
    // console.log(client.describe());
    );
    client.LoadCard(args2,function(err,result, rawResponse)
    console.log(rawResponse);
    );
    );









    share|improve this question
























      0












      0








      0








      I have a simple SOAP service working using nodejs but I am having trouble figuring out how to build the correct envelope structure that is required for my project.



      Is there a way to display the SOAP envelope in XML format that is sent to the server?



      I also tried forceSoap12Headers:true` but it did not call v12 methods in my server. Any hints here would be great.



      SERVER



       "use strict";
      var soap = require('soap');
      var http = require('http');
      var myService =
      ACME:
      ACMESoap:
      CalcFee: function(args, callback)
      callback(
      "ns1:barcodeReceive": args.cardNumber,
      "ns1:requestId": args.requestId,
      "ns1:calculatedFee": 0.15
      );
      ,
      LoadCard: function(args, callback)
      callback(
      "ns1:barcodeReceived": args.cardNumber,
      "ns1:requestId": args.requestId,
      "ns1:transactionAmount": '100.00',
      "ns1:currency": 'EUR'
      );

      ,
      ACMESoap12:
      CalcFee: function(args, callback)
      callback(
      "ns1:barcodeReceived": args.cardNumber,
      "ns1:calculatedFee": 0.15
      );
      ,
      LoadCard: function(args, callback)
      callback(
      "ns1:barcodeReceived": args.cardNumber,
      "ns1:transactionAmount": '100.00',
      "ns1:currency": 'EUR'
      );



      ;
      var port = 7777;
      var xml = require('fs').readFileSync('ACMEService.wsdl','utf8');
      var server = http.createServer(function(request,response)
      response.end("404: Not Found: " + request.url);
      );
      console.log('Started server on port ' + port);
      server.listen(port);

      soap.listen(server,'/wsdl',myService, xml);


      CLIENT



       "use strict";
      console.log('Started Client...');
      const util = require('util')
      var soap = require('soap');
      var url = 'http://ACME.net:7777/wsdl?wsdl';
      var args =
      requestId: '2833007',
      cardNumber: '3452345234'
      ;
      var args2 =
      requestId: '2833008',
      cardNumber: '56345634563'
      ;
      var options =
      forceSoap12Headers: true
      ;
      soap.createClient(url, options, function(err,client)
      client.CalcFee(args,function(err, result, rawResponse)
      console.log(rawResponse);
      // console.log(client.describe());
      );
      client.LoadCard(args2,function(err,result, rawResponse)
      console.log(rawResponse);
      );
      );









      share|improve this question














      I have a simple SOAP service working using nodejs but I am having trouble figuring out how to build the correct envelope structure that is required for my project.



      Is there a way to display the SOAP envelope in XML format that is sent to the server?



      I also tried forceSoap12Headers:true` but it did not call v12 methods in my server. Any hints here would be great.



      SERVER



       "use strict";
      var soap = require('soap');
      var http = require('http');
      var myService =
      ACME:
      ACMESoap:
      CalcFee: function(args, callback)
      callback(
      "ns1:barcodeReceive": args.cardNumber,
      "ns1:requestId": args.requestId,
      "ns1:calculatedFee": 0.15
      );
      ,
      LoadCard: function(args, callback)
      callback(
      "ns1:barcodeReceived": args.cardNumber,
      "ns1:requestId": args.requestId,
      "ns1:transactionAmount": '100.00',
      "ns1:currency": 'EUR'
      );

      ,
      ACMESoap12:
      CalcFee: function(args, callback)
      callback(
      "ns1:barcodeReceived": args.cardNumber,
      "ns1:calculatedFee": 0.15
      );
      ,
      LoadCard: function(args, callback)
      callback(
      "ns1:barcodeReceived": args.cardNumber,
      "ns1:transactionAmount": '100.00',
      "ns1:currency": 'EUR'
      );



      ;
      var port = 7777;
      var xml = require('fs').readFileSync('ACMEService.wsdl','utf8');
      var server = http.createServer(function(request,response)
      response.end("404: Not Found: " + request.url);
      );
      console.log('Started server on port ' + port);
      server.listen(port);

      soap.listen(server,'/wsdl',myService, xml);


      CLIENT



       "use strict";
      console.log('Started Client...');
      const util = require('util')
      var soap = require('soap');
      var url = 'http://ACME.net:7777/wsdl?wsdl';
      var args =
      requestId: '2833007',
      cardNumber: '3452345234'
      ;
      var args2 =
      requestId: '2833008',
      cardNumber: '56345634563'
      ;
      var options =
      forceSoap12Headers: true
      ;
      soap.createClient(url, options, function(err,client)
      client.CalcFee(args,function(err, result, rawResponse)
      console.log(rawResponse);
      // console.log(client.describe());
      );
      client.LoadCard(args2,function(err,result, rawResponse)
      console.log(rawResponse);
      );
      );






      node.js xml soap






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 16:57









      chris loughnanechris loughnane

      1,31232042




      1,31232042






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I figured out I can send the request back to the client to display.



          SERVER



          ...
          callback(
          "tns:RECEIVED_ENVELOPE": args
          );
          ...





          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305247%2fhow-can-i-display-the-soap-envelope-in-xml-format-in-nodejs%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I figured out I can send the request back to the client to display.



            SERVER



            ...
            callback(
            "tns:RECEIVED_ENVELOPE": args
            );
            ...





            share|improve this answer



























              0














              I figured out I can send the request back to the client to display.



              SERVER



              ...
              callback(
              "tns:RECEIVED_ENVELOPE": args
              );
              ...





              share|improve this answer

























                0












                0








                0







                I figured out I can send the request back to the client to display.



                SERVER



                ...
                callback(
                "tns:RECEIVED_ENVELOPE": args
                );
                ...





                share|improve this answer













                I figured out I can send the request back to the client to display.



                SERVER



                ...
                callback(
                "tns:RECEIVED_ENVELOPE": args
                );
                ...






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 14 '18 at 17:27









                chris loughnanechris loughnane

                1,31232042




                1,31232042





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305247%2fhow-can-i-display-the-soap-envelope-in-xml-format-in-nodejs%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    How to read a connectionString WITH PROVIDER in .NET Core?

                    Node.js Script on GitHub Pages or Amazon S3

                    Museum of Modern and Contemporary Art of Trento and Rovereto