Set up SOAP client using @vtex/api ExternalClient

Hi, trying to set up an External Client to post to a SOAP endpoint but I keep getting a 400 Error Invalid WSDL URL. It’s a public url so requires no authentication and the endpoint is active.

I have a feeling this error is from the npm package I’m using but would like to sanity check that I’ve set the basics of my Client up correctly:

constructor(cxt: IOContext, options?: InstanceOptions) {
    let instanceHeaders = options ? options.headers : {}
    super(url, cxt, {
      ...options,
      retries: 2,
      baseURL: url,
      headers: {
        ...instanceHeaders,
        'X-VTEX-Use-Https': 'true',
        'Proxy-Authorization': cxt.authToken,
        'X-Vtex-Proxy-To': url
      }
    })
  }

  public async initClient() {
    let soapOptions = {
      wsdl_options: {
        forever: true,
        rejectUnauthorized: false,
        strictSSL: false,
        disableCache: true
      },
      wsdl_headers: {
        'Content-Type': 'application/json; charset=utf-8',
        'Content-Length': 'length'
      }
    }

    let countryArgument = {
      sCountryName: 'Ireland'
    }
    
    createClientAsync(wsdlUrl, soapOptions)
    .then((client) => {
      return client.CountryISOCode(countryArgument)
    })
    .then((resp) => {
      return resp
    })
    .catch((err) => {
      console.log(err)
      return err
    })

I believe I need to add the url after the wsdlUrl on this line createClientAsync(wsdlUrl, soapOptions) but I get an error Argument of type '"http://yourUrl"' is not assignable to parameter of type 'IOptions | undefined'

Any advice or direction would be appreciated!

Below is an example of an External Client connection with REST APIs, Could you try to create the connection using this structure? I see that you get a Typescript error, try using the example passing the URL as a string and importing headers from a private function.

constructor(context: IOContext, options?: InstanceOptions) {
    super('', context, { ...options, headers: {} })

    this.settings = {}
    this.vtexClient = new VtexClient(context)
  }

private async getSettings() {
    this.settings = await helpers.getAppSettings(this.context)
  }

private async getFullHeaders(): Promise<Record<string, string>> {
    return {
      Accept: 'application/json',
      'Content-Type': 'application/json',
'x-smrs-lang': `${this.settings.apiSmrsLang}`,
    }
  }

  private getApiFullUrl(endpoint: string) {
    return `${this.settings.host}${endpoint}`
  }

  public async userCheck(
    userId: string
  ): Promise<IOResponse<Record<string, any>>> {
    await this.getSettings()

    return this.http.getRaw(
      this.getApiFullUrl(`/users/${userId}/check`),
      {
        metric: 'users-check',
        headers: await this.getFullHeaders(),
      }
    )
  }

Ps: I´m using this template: GitHub - vtex-apps/service-example: A reference app implementing a VTEX IO service with http route handlers