autopulous / angular2-soap

Angular 2 SOAP client service (supports Angular 2 rc 4)
30 stars 23 forks source link

Supplied parameters do not match any signature of call target. #3

Open Jellevanlith35 opened 7 years ago

Jellevanlith35 commented 7 years ago

Hello. I am trying to implement de the angular 2 soap in my ionic project. Unfortunality the compiler throws an error: Supplied parameters do not match any signature of call target.

In the tmp files the output is: get _SoapService_0_5():import4.SoapService { if ((this.SoapService_0_5 == (null as any))) { (this.SoapService_0_5 = new import4.SoapService()); } return this.__SoapService_0_5; }

this is my whole home.ts file:

import { Component } from '@angular/core'; import { NavController } from 'ionic-angular'; import {SoapService} from "autopulous-angular2-soap/soap.service";

@Component({ selector: 'page-home', templateUrl: 'home.html', providers: [SoapService] }) export class Home { private servicePort:string = 'http://172.16.62.111:8091'; private servicePath:string = '/your-application-ws/ws/'; private targetNamespace:string = '';

private responseJso:{} = null;

private soapService:SoapService;

constructor(public navCtrl: NavController) {

this.soapService = new SoapService(this.servicePort, this.servicePath, this.targetNamespace);
    this.soapService.envelopeBuilder = this.envelopeBuilder;
    this.soapService.jsoResponseHandler = (response:{}) => {this.responseJso = response};
    this.soapService.localNameMode = true;

}

private username:string = ''; private password:string = '';

public login(username:string, password:string) {
    var method:string = 'Login';
    var parameters:{}[] = [];

    this.username = username;
    this.password = password;

    parameters['LoginRequest xmlns="urn:application:security:messages:1:0"'] = Home.userLogin(username, password);

    this.soapService.post(method, parameters);
}

private static userLogin(username, password):{}[] {
    var parameters:{}[] = [];

    parameters["UserName"] = username;
    parameters['Password'] = password;

    return parameters;
}

private envelopeBuilder(requestBody:string):string {
    return "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
           "<SOAP-ENV:Header>" +
           "<wsse:Security SOAP-ENV:mustUnderstand=\"1\" xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" soapenv =\"http://schemas.xmlsoap.org/soap/envelope/\">" +
           "<wsse:UsernameToken wsu:ld=\"UsernameToken-104\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" >" +
            "<wsse:Username>" + this.username + "</wsse:Username>" +
            "<wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">" + this.password + "</wsse:Password>" +
            "</wsse:UsernameToken>" +
            "</wsse:Security>" +
            "</SOAP-ENV:Header>" +
            "<SOAP-ENV:Body>" +
            requestBody +
            "</SOAP-ENV:Body>" +
            "</SOAP-ENV:Envelope>";
}

}

Do you know how this error is caused?

Thank you in advance!

Jelle

autopulous commented 7 years ago

It looks like the constructor for the SoapService is not being passed any parameters - my suggestion would be to remove the SoapService from the providers metadata because the constructor needs to be explicitly invoked in you class (e.g. it doesn't already exist to be provided to your class)... if this works - I'm going to need to correct my readme file because it shows the SoapService in the providers.