Hi everybody,
does anyone of you succeed to setup a SOAP XML integration with other system using Ionic 2 and Angular 2?
Is it possible?
Kind regards,
Francesco
Hi everybody,
does anyone of you succeed to setup a SOAP XML integration with other system using Ionic 2 and Angular 2?
Is it possible?
Kind regards,
Francesco
Hello @feda889, I have same problem, Can u try this link = https://github.com/autopulous/angular2-soap.
if above link has given a module for it, If u successfully integrate with ionic v2 Please share the steps with me. Thank you !!
Hi guys, any update regarding this soap xml webservice & ionic2? im still looking for solution as well. I have gone through the github by autopulous but still having issues.
En el provider es una simple llamada http.get();
Este codigo esta funcionando perfectamente
------------- Provider -------------------
import { Injectable } from ‘@angular/core’;
import { Http } from ‘@angular/http’;
import ‘rxjs/add/operator/map’;
@Injectable()
export class WebServiceProvider {
constructor(public http: Http) {
console.log(‘Hello WebServiceProvider Provider’);
}
getDatos(){
return this.http.get(‘http://URL/file.asmx/getdata’)
.map( r => r.json());
}
}
-------------------------- Home.ts --------------------------------
import { Component } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;
import { WebServiceProvider } from ‘…/…/providers/web-service/web-service’;
@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’,
providers: [WebServiceProvider]
})
export class HomePage {
public getData:any;
constructor(
public navCtrl: NavController,
public ws: WebServiceProvider
) {}
public getIdiomas(){
this.ws.getDatos().subscribe(
data =>{
console.log(data);
}
);
}
}
_______________ WEB Service ASPX _________________
using System.Web.Services;
using System.Runtime.Serialization.Json;
using System.Web.Script.Serialization;
using System.Web.Script.Services;
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void getdata()
{
List<itemPais> lst = new List<itemPais>();
lst = new PaicesNegocios().GetPaicesAll_ISO();
this.GetSerializedJson(lst);
}
private void GetSerializedJson(object obj)
{
JavaScriptSerializer js = new JavaScriptSerializer();
Context.Response.Write(js.Serialize(obj));
}
The previous post contains a few things that should not be emulated:
providers
in pages unless you are absolutely certain that you want per-page instances of themgetData
any
Its Simple…,
Below code for how to call Soap Web Service from IONIC 2/3
Input:
<?xml version="1.0" encoding="utf-8"?> \
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \
xmlns:xsd="http://www.w3.org/2001/XMLSchema" \
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> \
<soap:Body> \
<**WebMethodName** xmlns="http://tempuri.org/"> \
<_Param1_>test</_Param1_> \
<_Param2_>test2</_Param2_> \
</**WebMethodName** > \
</soap:Body> \
</soap:Envelope>
Header:
this.headers = {
responseType: "text",
headers: new HttpHeaders()
.set('Content-Type', 'text/xml; charset=utf-8')
};
Http Call:
use http client
this.http.post('http://localhost/yourwebservice.asmx', input, this.headers)
.subscribe((response) => {
let result = new DOMParser().parseFromString(res,"text/xml").getElementsByTagName("**WebMethodName**Result")[0].innerHTML;
}, (error) => {
\\Error Block
});
This works fine for me
Hi, the input variable is what type, i try in ionic4 and in input send xml in string and get an error?
HI,
I am implementing the soap api in ionic and passing the parameter user name and password.
every time login we need to send the xml/txt file so how we can achieve it.