How can I consume a WCF SOAP service from Angular 6?

0

I tried to do it with two libraries: ngx-soap and soap, so far I could not.

This is a service that tries with the ngx-soap library.

import { Injectable } from '@angular/core';
import { NgxSoapService, ISoapMethod, Client, ISoapMethodResponse } from
'ngx-soap';
@Injectable({
providedIn: 'root'
})
export class SoapService {
  client: Client;
  private pin: 314;
  private token: 4268;
  public message: string;
  public empresa: void;
  public url: 'http://tbonline-webapp.azurewebsites.net/WebService.svc?wsdl';

constructor(private soap:NgxSoapService) {
  this.soap.createClient(this.url).then(client => {
    console.log('Cliente', client);
    this.client = client;
  })
   .catch(err => console.log('Error', err));
}

obtenerLogin(){
  const body = {
    pin: this.pin,
    token: this.token
  };
  (<any>this.client).GetLicenciaByPin(body).subscribe(res => {
    console.log('method response', res);
    this.xmlResponse = res.xml;
    this.message = res.result.SubtractResult;
    this.loading = false;
  })
 }
}
    
asked by Sebastian Rico 23.08.2018 в 03:09
source

0 answers