Coder Social home page Coder Social logo

angular2-soap's Introduction

Angular2-soap

Angular2+ Service of the Javascript SOAP Client

Upgrade to version 2+ from the original angular-soap for Angular v1 created by Andrew Mcgivery

Usage

Installation

This example is based on the sidemenu template of Ionic:

there are two files:

soap.service.ts soapclient.js

On this example, the soapclient.js file is located on src. You can place it anywhere provided you reference it correctly at the top of soap.service.ts:

import SOAPClient from '../../soapclient.js';

Declarations:

Add the following lines to the declarations.d.ts file to avoid compilation errors

declare module '*';
declare var  SOAPClient: any;

Import the service and inject it as a provider for the component

import { SoapService } from './soap.service'
@Component({ 
selector: 'page-home', 
providers: [SoapService], 
templateUrl: 'home.html'
})

The post method accepts the following paramaters:

Parameter Description Example
url The base URL of the service "http://www.mydomain.com/webservices/demo.asmx"
action The Webservice Operation "GetUser"
params Parameters passed as an Object { id: "123" }

Example

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

@Component({
  selector: 'page-home',
  providers: [SoapService],
  templateUrl: 'home.html'  
})

export class HomePage {
  constructor(public navCtrl: NavController, public soapService: SoapService) {
    soapService.post('http://mydomain.com/webservices/sync.asmx', 'GetUser', {id: '1'})
    .then(result => {
      console.log(result);
    }).catch(error => {
        console.log(error);
    });
  }
}

License

MIT

angular2-soap's People

Contributors

infoxicator avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.