Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How To Call With This SOAP envelope #79

Open
sonnyariady opened this issue Jun 3, 2020 · 0 comments
Open

How To Call With This SOAP envelope #79

sonnyariady opened this issue Jun 3, 2020 · 0 comments

Comments

@sonnyariady
Copy link

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:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://aplikasinganu.com/">
soapenv:Header
api:UserCredential

api:Usernameuseranu</api:Username>

api:PasswordPasswordnganu</api:Password>

api:App_Nameappnganu</api:App_Name>
</api:UserCredential>
</soapenv:Header>
soapenv:Body
api:Login

api:loginVM

api:Usernamesujono</api:Username>

api:PasswordPassword123</api:Password>
</api:loginVM>
</api:Login>
</soapenv:Body>
</soapenv:Envelope>

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant