lula / ngx-soap

Simple SOAP client for Angular
MIT License
66 stars 61 forks source link

How To Call With This SOAP envelope #79

Open sonnyariady opened 4 years ago

sonnyariady commented 4 years ago

I have a problem to call SOAP with these following envelope header and body, on the tutor, it doesn't include SoapEnvelope Header. I will create this api call in the class .Service.TS For example, these statements are called in the constructor

var requrl = environment.baseWSAddress + 'WS_serviceku.asmx?wsdl'; this.soap.createClient(requrl).then(client => {

  client.addSoapHeader({
    'api:UserCredential': {

      Username: environment.App_UserName,
      Password: environment.App_Password,
      App_Name: environment.App_Name

    }
  });

the XML SOAP envelope are like these:

useranu Passwordnganu appnganu sujono Password123 I create mthod call in service class like this. For Example, this is "Login" method on WS_serviceku.asmx DoLogin3() : Observable { const body = { 'api:Login': { Username: this.formData.Username, Password: this.formData.Password } }; this.client.addHttpHeader('Content-Type', 'application/soap+xml; charset=utf-8'); console.log("Sebelum panggil method login"); console.log("Dapatkan httpheader: " + this.client.getHttpHeaders()); console.log("Dapatkan getSoapHeaders: " + this.client.getSoapHeaders()); return this.client.call('Login',body, this.httpOptions ); } Then on component.ts I call this: this.service.DoLogin3().subscribe(res => { // console.log("Has passed api call"); // console.log("Is Success: " + res.IsSuccess); }); The error occured on the picture, on environment.baseWSAddress I use debug address, It did't enter the breakpoint for debugging. What's wrong and missing on my statement? ![image](https://user-images.githubusercontent.com/35548456/83626192-4567f980-a5bf-11ea-802a-da79ebee4553.png)