Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Steve Lambe
    @firrae
    Is it not possible to use import soap from 'soap';? When I try to use it that way it comes back undefined, but require seems fine.
    Néstor Hernández Ojeda
    @nesheroj

    Is it not possible to use import soap from 'soap';? When I try to use it that way it comes back undefined, but require seems fine.

    I think the package might not have a default export, in that case you would need to import specifically what you want like: import { BearerSecurity, Client, createClient } from 'soap';

    image.png
    Does anybody know any reason why the events wouldn't trigger? I'm registering handlers for logging purposes and making some calls that are getting successful responses, but events seem to not be triggering.
    Antoine Poliakov
    @antoinep92

    Hi everyone, I'm using soap client. It generates request xml like this:

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:tns="http://myapi.com/webservice"
        xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/">
        <soap:Body>
            <MethodName xmlns="http://myapi.com/webservice">
            .......
            </MethodName>
        </soap:Body>
    </soap:Envelope>

    The xmlns attribute in the MethodName tag apparently breaks the request (at least on the webservice I'm using). Is there a way to remove the attribute through some options , and juste have <MethodName> instead of <MethodName xmlns="..."> ?

    1 reply
    Steve Lambe
    @firrae

    Is it not possible to use import soap from 'soap';? When I try to use it that way it comes back undefined, but require seems fine.

    I think the package might not have a default export, in that case you would need to import specifically what you want like: import { BearerSecurity, Client, createClient } from 'soap';

    Ah, thanks

    wellá
    @lostdesign

    Hi everyone, i am trying to make a soap call

    const gradeDeleteResult = await gradeClient.deleteGradeAsync({
          deleteGradeRequest: {
            id: Number(gradeId),
            profileBookingId: Number(bookingId)
          }
        })

    But it seems like that the JSON is creating the xml falsy.

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tnsSimoGrade="http://XXXXXXXXXX.de/grade/" xmlns:tnsSimoBase="http://XXXXXXXX.de/base/" xmlns:xsdSimoGrade="http://XXXXXX.de/grade/schema" xmlns:xsdSimo="http://XXXXXXXX.de/core/schema">
      <soap:Body>
        <tnsSimoBase:deleteGrade>
          <deleteGradeRequest>
            <id>11764173</id>
            <profileBookingId>10634046</profileBookingId>
          </deleteGradeRequest>
        </tnsSimoBase:deleteGrade>
      </soap:Body>
    </soap:Envelope>

    the expected xml should be

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:grad="http://XXXXXX.de/grade/">
      <soapenv:Header />
      <soapenv:Body>
        <grad:deleteGrade>
          <deleteGradeRequest id="11764173" profileBookingId="10634046" />
        </grad:deleteGrade>
      </soapenv:Body>
    </soapenv:Envelope>

    I have tried passing the XML as per https://github.com/vpulim/node-soap#example-with-xml-string-for-the-args

    const gradeDeleteResult = await gradeClient.deleteGradeAsync({
          _xml: `
        <grad:deleteGrade>
          <deleteGradeRequest id="${gradeId}" profileBookingId="${bookingId}" />
        </grad:deleteGrade>
        `
        })

    but that leaves me with a encoded xml payload

    <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:tnsSimoGrade="http://XXXXXXX/grade/" xmlns:tnsSimoBase="http://XXXXXXX/base/" xmlns:xsdSimoGrade="http://XXXXXXXXXX/grade/schema" xmlns:xsdSimo="http://XXXXXXXXX/core/schema"><soap:Body><tnsSimoBase:deleteGrade><xml>
        &lt;grad:deleteGrade&gt;
          &lt;deleteGradeRequest id=&quot;11764174&quot; profileBookingId=&quot;10634046&quot; /&gt;
        &lt;/grad:deleteGrade&gt;
        </xml></tnsSimoBase:deleteGrade></soap:Body></soap:Envelope>

    I'd appreciate any hints or help! Many thanks in advance

    2 replies
    merrittc
    @merrittc
    I'm trying to create a client for an older WCF service. Are there any tips others can provide to assist in setting this up? The service I'm using has a Ping operation and when It ry to create the client to call it, I get soap envelope like this...
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
        xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
        xmlns:tns="http://www.CooperativeTechnologies.com/CT1035YellowPagesWS/v20800"
        xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
        xmlns:q1="http://www.CooperativeTechnologies.com/Schemas/CT1035YellowPagesWS/v20800"
        <!-- and 106 others... xmlns:q2, q3, q4, etc. -->
        xmlns:q108="http://www.CooperativeTechnologies.com/Schemas/CT1035YellowPagesWS/v20800">
        <soap:Header></soap:Header>
        <soap:Body></soap:Body>
    </soap:Envelope>
    1 reply
    Bernhard Posselt
    @BernhardPosselt
    hi I'm looking for documentation
    I want to create a soap client but the README doesn't contain an example of how this thing actually works
    kinda hard to figure out what args actually is if no TS types are generated
    ericpan17
    @ericpan17
    Anybody have any ideas why I am getting the following errors(from the soap server)
    2 replies
    Cannot read property 'description' of undefined
    at SAXParser.p.onopentag (~/lb/node_modules/soap/lib/wsdl/index.js:238:37)
    at emit (~/lb/node_modules/sax/lib/sax.js:624:35)
    at emitNode (~/lb/node_modules/sax/lib/sax.js:629:5)
    at openTag (~/lb/node_modules/sax/lib/sax.js:827:5)
    at SAXParser.write (~/lb/node_modules/sax/lib/sax.js:1280:15)
    at WSDL.xmlToObject (~/lb/node_modules/soap/lib/wsdl/index.js:443:11)
    at Server._process (~/lb/node_modules/soap/lib/server.js:244:29)
    at Server._processRequestXml (~/lb/node_modules/soap/lib/server.js:166:18)
    at IncomingMessage.<anonymous> (~/lb/node_modules/soap/lib/server.js:234:25)
    at IncomingMessage.clsBind (~/lb/node_modules/cls-hooked/context.js:172:17)
    at IncomingMessage.emit (events.js:387:35)
    at IncomingMessage.emit (domain.js:532:15)
    at IncomingMessage.emitted (~/lb/node_modules/cls-hooked/node_modules/emitter-listener/listener.js:134:21)
    at endReadableNT (internal/streams/readable.js:1317:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
    doktr
    @doktr
    Good evening, i m currently trying to send requests to a soap service in one of my projects and trying to use node-soap for that in a typescript express environment running in a docker container. Unfortunety the service requires a ntlm authentication and that is my big problem. I thought it is easy by adding client.setSecurity(new soap.NTLMSecurity(credentials)); but right now i have doubts that this is the only thing i have to do. My ntlm user - which is working via soapui/postman - got immediately blocked on first request, cause as the sys admin said, 10 failed authentications have been catched. Should it work out of the box on a linux docker instance? Do i need CNTLM or a windows server image?
    1 reply
    dursk
    @dursk
    Hello, I'm working on a feature right now that requires downloading MTOM attachments. I see that support was added in this PR https://github.com/vpulim/node-soap/pull/1148/files, and have been developing locally against that commit and everything is working great. Is there a plan or timeline to get this into an official release soon?
    Adish Upadhyay
    @adishupadhyay
    Hi All , If there is big amount of data in search response , its taking almost 25 minutes to return the response.. can anyone please suggest fix for this?
    data response of size ~3mb
    wagnerch
    @wagnerch
    Noticing with soap 0.40.0 that SOAP faults are no longer being included in the error exception via Async method calls. Just a generic "500" error. Reverting to 0.39.0 seems to fix this. Any one else have this problem?
    wagnerch
    @wagnerch
    Here is a reproducer of the 0.40.0 bug with SOAP faults:
    const soap = require("soap");
    
    (async () => {
        const client = await soap.createClientAsync("http://www.dneonline.com/calculator.asmx?wsdl");
    
        try {
            const res = await client.AddAsync ({
                "intA": "1",
                "intB": "a"
            });
            console.log(res[0]?.AddResult);
        } catch (error) {
            console.log("ERROR:", error?.message);
        }
    }) ();
    
    
    C:> npm install soap@0.40.0
    C:> node .\soap.js
    ERROR: Request failed with status code 500
    
    C:> npm install soap@0.39.0
    C:> node .\soap.js
    ERROR: soap:Client: System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (1, 326). ---> System.FormatException: Input string was not in a correct format.
       at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
       at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
       at System.Xml.XmlConvert.ToInt32(String s)
       at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read1_Add()
       at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer.Deserialize(XmlSerializationReader reader)
       at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
       --- End of inner exception stack trace ---
       at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
       at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
       at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
       --- End of inner exception stack trace ---
       at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
       at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
    Andrey Popov
    @somalil
    Hi, All! I'm a newbie in soap. Please write an example of a request with authorization(Basic). Thanks!!!
    Halvor Lyche Strandvoll
    @halvors

    Hi! I saw that it is possible to add attachments to a client for sending files with a soap request using multipart/related.

    Is this possible for the soap.listen() to parse? How can i read out attachments in listen() ?

    victorgsp
    @victorgsp

    I have the following error in my log:

    2021-08-25T08:13:59.074-03:00    Error: Error http status codes
    2021-08-25T08:13:59.074-03:00    at finish (/appserver/server/node_modules/soap/lib/client.js:256:33)
    2021-08-25T08:13:59.074-03:00    at parseSync (/appserver/server/node_modules/soap/lib/client.js:307:20)
    2021-08-25T08:13:59.074-03:00    at /appserver/server/node_modules/soap/lib/client.js:466:24
    2021-08-25T08:13:59.074-03:00    at Request._callback (/appserver/server/node_modules/soap/lib/http.js:171:17)
    2021-08-25T08:13:59.074-03:00    at Request.self.callback (/appserver/server/node_modules/request/request.js:185:22)
    2021-08-25T08:13:59.074-03:00    at Request.emit (events.js:314:20)
    2021-08-25T08:13:59.074-03:00    at Request.EventEmitter.emit (domain.js:483:12)
    2021-08-25T08:13:59.074-03:00    at Request.<anonymous> (/appserver/server/node_modules/request/request.js:1154:10)
    2021-08-25T08:13:59.074-03:00    at Request.emit (events.js:314:20)
    2021-08-25T08:13:59.074-03:00    at Request.EventEmitter.emit (domain.js:483:12)

    Which can cause the error: "Error http status codes"?

    Thanks!

    2 replies
    Joffrey Da Rocha
    @SteakdeNiche

    Hi people ! client.setSecurity using NTLMSecurity doesn't seems to work.
    I've tested my authentication using SOAPUI and it's going fine.
    Writing these code result each time in a 401 Unauthorized response from my WS. (My .wsdl file is correct and here)

    soap.createClient("file.wsdl", (err, client) => {
     client.setSecurity(new soap.NTLMSecurity(username, password, domain))
     client.MyFunction({}, (err, result) => {
       if (err) {
        console.log(err.response.status)
       }
       res.json(result)
      })
    })

    No Authorization Headers are set to my HTTP Request this way, I think that's the problem because using an old library "soap-ntlm" https://github.com/piotr-gawlowski/node-soap, there are Headers. Any ideas ?

    Halvor Lyche Strandvoll
    @halvors
    Is this channel inactive?
    Halvor Lyche Strandvoll
    @halvors
    Is there any way i can force content length to be set for a soap server?
    It is currently using chunked encoding and that is not supported by the client i need to serve.
    Andrew Brown
    @Andrew4041_gitlab
    Hello, everyone.
    Is it possible to get a session when making requests to the soap-server?
    app.listen(8001, function(){
    soapServer.listen(app, '/wsdl', myService, xml, function(){
    console.log('server initialized');
    });
    });
    How do I configure middleware for the soapServer object here?
    sm2017
    @sm2017
    There is a bug in version Version 0.41.0, I am using Version 0.39.0 and it works well today I upgraded to latest version and found that there is a bug in my app, after inspecting I figured out that vpulim/node-soap#1154 is a bad PR, I am using https-proxy-agent package to send requests via a http proxy, the code works with proxy in version 0.39.0 but not latest (I am not testing 0.41.0 but I think the issue is here)
    eldonzo
    @eldonzo

    Hi all, I upgraded from v 0.37.0 to 0.40.0 and I noticed a change in how errors are returned.
    I'm using a WSDL instance and the same request with 0.37.0 returns an error like this:

    {
       "root":{
          "Envelope":{
             "Body":{
                "Fault":{
                   "faultcode":"soap:Server",
                   "faultstring":"Il codice fiscale non e' nel formato corretto di 16 caratteri",
                   "detail":{
                      "WSException":{
                         "error":"3",
                         "message":"Il codice fiscale non e' nel formato corretto di 16 caratteri"
                      }
                   }
                }
             }
          }
       }
    }

    With 0.40.0 I get this (I replaced some informations with ...):

    {
       "message":"Request failed with status code 500",
       "name":"Error",
       "stack":"Error: Request failed with status code 500\n at createError (/usr/local/src/liveid/api/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/usr/local/src/liveid/api/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/usr/local/src/liveid/api/node_modules/axios/lib/adapters/http.js:260:11)\n at IncomingMessage.emit (events.js:326:22)\n at IncomingMessage.EventEmitter.emit (domain.js:483:12)\n at endReadableNT (_stream_readable.js:1241:12)\n at /usr/local/src/liveid/api/node_modules/async-listener/glue.js:188:31\n at processTicksAndRejections (internal/process/task_queues.js:84:21)",
       "config":{
          "url": ...,
          "method":"post",
          "data":"<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:tns=\"http://service.ws.nam/\">...</soap:Envelope>",
          "headers":{
             "Accept":"text/html,application/xhtml+xml,application/xml,text/xml;q=0.9,*/*;q=0.8",
             "Content-Type":"text/xml; charset=utf-8",
             "User-Agent":"node-soap/0.40.0",
             "Accept-Encoding":"none",
             "Accept-Charset":"utf-8",
             "Connection":"close",
             "Host": ...,
             "Content-Length":1529,
             "SOAPAction":"\"\"",
             "Authorization":"Basic ..."
          },
          "transformRequest":[
             null
          ],
          "transformResponse":[
             null
          ],
          "timeout":0,
          "xsrfCookieName":"XSRF-TOKEN",
          "xsrfHeaderName":"X-XSRF-TOKEN",
          "maxContentLength":-1,
          "maxBodyLength":-1
       }
    }

    Does anybody have some ideas of why this happens and how to restore an error like the one I get with 0.37.0 (beside from downgrading to 0.37.0 :P)?

    haribaskarvr
    @haribaskarvr
    Hi All, I have an issue with SOAP response.
    1. When the database contains records it is working fine, but when the records not present it is not returning null response or throwing error. If anyone has any suggestion please let me know.
    Deepak Rawat
    @DeepakR-28

    hello i recently started working on soap request because of a requirement in our org.

      var soap = require('soap');
      var url = 'http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso';
      var args = {sCountryISOCode: 'IN'};
      soap.createClient(url, function(err, client) {
          client.MyFunction(args, function(err, result) {
              console.log(result);
          });
      });

    i used that endpoint for testing purposes, which returns the capital of any country
    I am not sure what will go in the args,
    I made the same request from postman as you can see in the image

    with the library i get this error

    TypeError: Cannot read property 'MyFunction' of undefined
    1 reply
    image.png
    i apologize if this is a stupid question, but i am relatively new to this, haven't worked much with soap requests
    Deepak Rawat
    @DeepakR-28
    i tried this url too
    http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL
    Dario Di Palma
    @DarioDiPalma98
    Hi, I have a problem, when i use node-soap, in the url i define the https, but when i lunch the code, i receive an error , and in the header is used the http version
    Dario Di Palma
    @DarioDiPalma98
    Nobady know how to solve this problem ? :(
    amalashenok
    @amalashenok
    Hello is there a way to remove empty soap:Header from soap:Envelope?
    like it's done in java
    SOAPHeader header = env.getHeader();
    header.detachNode();
    i tried clearSoapHeaders but <soap:Header></soap:Header> is not being removed
    marcosjara
    @marcosjara

    Hello group

    How could I overwrite the request to inform the certificate before creating the client?

    The server that has the WSDL requests mutual authentication by certificate

        const options : any = {
                url: `${url}`,
                cert: Buffer.from(this.cert, 'utf8'),
                key: Buffer.from(this.key, 'utf8'),
            };
            //const req = request.defaults(options);
            const req = request.defaults(options);
    
            return soap.createClient(`${url}`, {request: req}, (err: any, client: any) => {
            });

    But I got an error:

    error ->  TypeError: req.then is not a function
        at HttpClient.request (C:\Users\marco\git\facturacionelectronicapy-setapi\node_modules\soap\src\http.ts:184:9)
        at Object.open_wsdl (C:\Users\marco\git\facturacionelectronicapy-setapi\node_modules\soap\src\wsdl\index.ts:1414:16)
        at openWsdl (C:\Users\marco\git\facturacionelectronicapy-setapi\node_modules\soap\src\soap.ts:55:5)
        at C:\Users\marco\git\facturacionelectronicapy-setapi\node_modules\soap\src\soap.ts:32:7
        at _requestWSDL (C:\Users\marco\git\facturacionelectronicapy-setapi\node_modules\soap\src\soap.ts:61:5)
        at Object.createClient (C:\Users\marco\git\facturacionelectronicapy-setapi\node_modules\soap\src\soap.ts:83:3)

    Thanks

    Juan Sebastian Goldberg
    @sebasgoldberg
    Hi,
    How can I use this library in the browser? There exists a minified version?
    Bart Smets
    @b-smets
    Is there a way to provide a namespace mapping when generating a client based on a WSDL file? I am working against a WSDL whose schema declares elements with the same namespace, however the namespace is repeated on every element definition with a different prefix so my final resulting SOAP XML ends up with tons of duplicated namespaces with different prefixes.
    Mahdi Karami
    @MKdir98
    Hi All.
    I search in file of project for xenc:EncryptedData or something like this but I can not find anything.
    Mahdi Karami
    @MKdir98
    something like this:
    <soap:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="_30d88595-86e5-446e-b779-60b13612fe62"> <xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Id="ED-9cacd30b-e921-4f12-b13c-66618fd704b3" Type="http://www.w3.org/2001/04/xmlenc#Content"> <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc" /> <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <wsse:SecurityTokenReference xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd" wsse11:TokenType="http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKey"> <wsse:Reference URI="#EK-e9aa9c0a-28cf-487a-81e9-a38f1e4079db" /> </wsse:SecurityTokenReference> </ds:KeyInfo> <xenc:CipherData> <xenc:CipherValue>ghu/wEcFEkun4tImo++HWo3rpXU9jPw9qSA/uGhrqqAAR/LuE+6G8aFPNZ/QLDnocxvfAicieWoTlmJ5kpitjmJHW3lv95PKPyMoE/GymNVicG6qCp/HARBbk0uY+SkkSS91n7AOyGARO80aa4npggbUFdzaZlywKOMFZ6tSTDC/+0YZAfQTjecSm3xSl5C3zFX5fPgvXuVRT4AEeFnjwvja2lbJFOLc2Vhpd0tG3LGkKA111q99Qkt/o3S7/GUfimbZKQhInXioCw+t73PpKPu0JtG5YOdCuHBoJJUhW/T6DKcYdFx0exWxz7EFfa2RMK5emB9bJplPKS4fflMDpA==</xenc:CipherValue> </xenc:CipherData> </xenc:EncryptedData> </soap:Body>
    Rangarajan Kesavan
    @rangarajan-k

    Hey everyone I am trying to create a soap server in my local that listens on https.

    let key = fs.readFileSync('key.pem'); 
                    let cert = fs.readFileSync('cert.pem')
    
                    let soapServer = soap.listen(httpServer, {
                        path: urlPath,
                        services: processorService,
                        xml: xmlPath,
    
                        key : key,
                        cert : cert
                    });

    When i am trying to make a request, I am always getting secure connection could not be established error. I have all the WSDL files and the server works properly without https ( i.e http ) .

    Any pointers to help ?

    Anders Wasen
    @QAnders
    Looking for some advice initially as I noticed you offer consulting so want to verify if it can be done... We have the need to migrate an older Java based solution which runs a standard called Peppol which in turn is ebMS/AS4 based. The requests are MIME based with SOAP envelope that references the payload in a second mime part. The payload is encrypted and compressed (gzip). Would node-soap be able to handle ebMS/AS4 based messages?
    kp
    @krle031_twitter

    hi everyone, does anybody have experience with using async with postProcess option?
    i need to modify XML in postProcess, but first need to pull it through async method. postProcess just goes on without waiting.

    example:
    postProcess: async (_xml) => { _xml = await someMethod(_xml); return _xml; }