autopulous / angular2-soap

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

How i can use this module with ionic framework 2? #5

Open DipakMahapurkar opened 7 years ago

DipakMahapurkar commented 7 years ago

Hello @autopulous, I want to use this module with ionic framework 2. How i can integrate or install in my ionic v2 project. Thanks in advance.

autopulous commented 7 years ago

I do not know iconic, so it would take me some effort to research how to do this. At this time, I'm not in a position to dig into this - but perhaps someone else who comes along might have some suggestions - I'll leave this issue open for awhile just in case.

DipakMahapurkar commented 7 years ago

Hey @autopulous, Thanks for reply, If i got solution on it i will share with u.

HuberStefan commented 7 years ago

Hey @inceptiveDipak did you already get a solution?

WorldSeso7 commented 7 years ago

@inceptiveDipak @HuberStefan @autopulous +1 for solutions needed!

slax0r commented 7 years ago

Ionic 2 is coupled with Angular 2 so it should drop in like any other service module.

install it with npm:

cd YOUR_PROJECT_DIR npm install --save https://github.com/autopulous/angular2-soap

imort it like: import {SoapService} from "autopulous-angular2-soap/src/soap.service"; dont forget to add it to your providers in add.module.ts and in your page ts

then follow the read me: https://github.com/autopulous/angular2-soap/blob/master/README.md

danielantoniobs commented 7 years ago

@slax0r Please, can you help me ? I follow your instructions, but I get the following error:

[09:55:34] typescript: node_modules/autopulous-angular2-soap/src/soap.service.ts, line: 1 Cannot find name 'xdom2jso'. L1: import convert = xdom2jso.convert; [09:55:34] typescript: node_modules/autopulous-angular2-soap/src/soap.service.ts, line: 1 Cannot find namespace 'xdom2jso'. L1: import convert = xdom2jso.convert; [09:55:34] transpile failed

Thanks!

gallotti commented 7 years ago

Hello, has anyone managed to configure this module with Ionic 2?

charlie-fisher commented 6 years ago

Hello @autopulous . I'm hoping you can give me a little help and advise here I am learning angular2 at the moment and trying to build an app to consume some of our soap services (unfortunately moving them over to REST isnt an option for us just yet :( ) I'm using rxjs 5.5.6 and typescript 2.5.3 but when trying to import the angular2-soap library I'm getting a lot of webpack compile errors. (I've atached a text file with my errors) . I have googled around and i think it could well be the versions of rxjs & typescript Im using. can you offer any advise if im correct and if so are there better versions i should consider using ?

thank you for your help and guidance

Charlie

Error.txt

AnandKumar2610 commented 6 years ago

Its Simple...,:grinning: Below code for how to call Soap Web Service from IONIC 2/3

Input:

let 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', this.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 :sunglasses:

5hivams commented 5 years ago

Hi @AnandKumar2610 , Can you please share your full class for this ? I am looking for type of this.headers. It should as RequestOptions.

AnandKumar2610 commented 5 years ago

Hi @5hivams this.header is optional. Try this. this.http.post('http://localhost/yourwebservice.asmx', this.input, { responseType: "text", headers: new HttpHeaders() .set('Content-Type', 'text/xml; charset=utf-8') }) .subscribe((response) => { let result = new DOMParser().parseFromString(res,"text/xml").getElementsByTagName("**WebMethodName**Result")[0].innerHTML; }, (error) => { //Error Block });