Consume SOAP web service with Angular app

10,846

ngx-soap is a great library which I have used in our one of the client project.

Here are steps to use this library.

Step 1: install ngx-soap and dependencies

npm install --save ngx-soap

npm install --save buffer concat-stream core-js crypto-js events lodash sax stream uuid

Step 2:

import { NgxSoapModule } from 'ngx-soap';
...
    @NgModule({
        imports: [ ..., NgxSoapModule, ... ]
    ...

Step 3: Inject NgxSoapService in your component

...
import { NgxSoapService, Client, ISoapMethodResponse } from 'ngx-soap';
...

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
    client: Client;

    constructor(private soap: NgxSoapService) {
        this.soap.createClient('http://123.618.196.10/WCFTicket/Service1.svc?wsdl').subscribe(client => this.client = client);
    }
 }

Hope this will help!

Share:
10,846
Sampath
Author by

Sampath

Angular, Ionic, Firestore, Typescript, PrimeNG Connect with ME : Twitter

Updated on June 17, 2022

Comments

  • Sampath
    Sampath almost 2 years

    I know that We can consume Restful services within our Angular apps. But one of my client gave me a web service like so http://123.618.196.10/WCFTicket/Service1.svc?wsdl. So my question is can I use this within an Angular app? I have never used it. Any clue?