0

I am replacing node-soap with strong-soap in an API I am developing. node-soap has a method called postProcess, which allows you to edit the XML request before it is sent.

It does not look like strong-soap has this method. Does it have an equivalent?

I found these event listeners which includes 'request' as an option, but setting result doesn't actually change it. Client.lastRequest shows the exact same XML

executeUpdateQuery(servicefunction: ServiceFunction, body: Object | Array<Object>, ignoreErrorHandling?: boolean): Promise<DataWriteServiceResponse> {
    return new Promise((resolve, reject) => {
      soap.createClient(this.WSDL_PATH +  servicefunction.wsdl,{handleNilAsNull: true},  (err, client) => {
        if (err) {
          reject(new HttpException(err.message, 500));
          return;
        }

        client.on('request', (result) => {
          result = this.fixTimestamps(result)
          
        });

        client[servicefunction.functionName](body, (err, result) => {

              let serviceResponse: DataWriteServiceResponse = new DataWriteServiceResponse(result[Object.keys(result)[0]]);

              if (serviceResponse.Success === false) {
                  reject(new BadRequestException('oops'));
              } else {
                resolve(serviceResponse);
              }
           
              console.log(client.lastRequest)
            }
        );
      });
    });
  }

The fixTimestamps function is working perfectly. I can set result to anything and it doesn't change. The documentation for strong-soap fails to explain how to use this event properly.

chxpel
  • 141
  • 2
  • 13

0 Answers0