admin管理员组

文章数量:1022804

I'm trying to use TypeScript to run a SOAP request, but I'm getting an error when I pile the code with "tsc myfile.ts". The code:

import Soap from 'soap';

function soapClientServer(){
    
const url = 'myurl'

Soap.createClient(url, function(err, client){
if(err){
    console.log(err)
}else{
    console.log('connection with SOAP OK')
    client.consultaNFSe({
      token: 'mytoken',
      cnpj: 'mydata',
      nrNota: '',
      nrPedido: 'mydata'
    }, (err, res) =>{
        return console.log(res)
    })
  }
})

}

export default soapClientServer()

The error:

index.ts:1:8 - error TS1192: Module '"/Users/vinicius.siqueira/Projects/MyPC/soap-typescript/node_modules/soap/lib/soap"' has no default export.

1 import Soap from 'soap';
         ~~~~


Found 1 error.

Any ideas? Thanks!

I'm trying to use TypeScript to run a SOAP request, but I'm getting an error when I pile the code with "tsc myfile.ts". The code:

import Soap from 'soap';

function soapClientServer(){
    
const url = 'myurl'

Soap.createClient(url, function(err, client){
if(err){
    console.log(err)
}else{
    console.log('connection with SOAP OK')
    client.consultaNFSe({
      token: 'mytoken',
      cnpj: 'mydata',
      nrNota: '',
      nrPedido: 'mydata'
    }, (err, res) =>{
        return console.log(res)
    })
  }
})

}

export default soapClientServer()

The error:

index.ts:1:8 - error TS1192: Module '"/Users/vinicius.siqueira/Projects/MyPC/soap-typescript/node_modules/soap/lib/soap"' has no default export.

1 import Soap from 'soap';
         ~~~~


Found 1 error.

Any ideas? Thanks!

Share Improve this question asked Jul 15, 2020 at 13:26 Vinicius MocciVinicius Mocci 991 gold badge3 silver badges12 bronze badges 1
  • I'm trying to use this: github./vpulim/node-soap But I'm new to TS, tryin to figure out how to create the same with TypeScript. I've tried with simple node code and worked. – Vinicius Mocci Commented Jul 15, 2020 at 13:43
Add a ment  | 

1 Answer 1

Reset to default 5
import {createClient} from 'soap';

I'm trying to use TypeScript to run a SOAP request, but I'm getting an error when I pile the code with "tsc myfile.ts". The code:

import Soap from 'soap';

function soapClientServer(){
    
const url = 'myurl'

Soap.createClient(url, function(err, client){
if(err){
    console.log(err)
}else{
    console.log('connection with SOAP OK')
    client.consultaNFSe({
      token: 'mytoken',
      cnpj: 'mydata',
      nrNota: '',
      nrPedido: 'mydata'
    }, (err, res) =>{
        return console.log(res)
    })
  }
})

}

export default soapClientServer()

The error:

index.ts:1:8 - error TS1192: Module '"/Users/vinicius.siqueira/Projects/MyPC/soap-typescript/node_modules/soap/lib/soap"' has no default export.

1 import Soap from 'soap';
         ~~~~


Found 1 error.

Any ideas? Thanks!

I'm trying to use TypeScript to run a SOAP request, but I'm getting an error when I pile the code with "tsc myfile.ts". The code:

import Soap from 'soap';

function soapClientServer(){
    
const url = 'myurl'

Soap.createClient(url, function(err, client){
if(err){
    console.log(err)
}else{
    console.log('connection with SOAP OK')
    client.consultaNFSe({
      token: 'mytoken',
      cnpj: 'mydata',
      nrNota: '',
      nrPedido: 'mydata'
    }, (err, res) =>{
        return console.log(res)
    })
  }
})

}

export default soapClientServer()

The error:

index.ts:1:8 - error TS1192: Module '"/Users/vinicius.siqueira/Projects/MyPC/soap-typescript/node_modules/soap/lib/soap"' has no default export.

1 import Soap from 'soap';
         ~~~~


Found 1 error.

Any ideas? Thanks!

Share Improve this question asked Jul 15, 2020 at 13:26 Vinicius MocciVinicius Mocci 991 gold badge3 silver badges12 bronze badges 1
  • I'm trying to use this: github./vpulim/node-soap But I'm new to TS, tryin to figure out how to create the same with TypeScript. I've tried with simple node code and worked. – Vinicius Mocci Commented Jul 15, 2020 at 13:43
Add a ment  | 

1 Answer 1

Reset to default 5
import {createClient} from 'soap';

本文标签: javascriptSoap request in TypeScriptStack Overflow