Socket
Socket
Sign inDemoInstall

soap

Package Overview
Dependencies
Maintainers
0
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

soap

A minimal node SOAP client


Version published
Weekly downloads
410K
decreased by-2.89%
Maintainers
0
Weekly downloads
 
Created

What is soap?

The 'soap' npm package is a SOAP client and server library for Node.js. It allows you to create SOAP clients to consume web services and also create SOAP servers to expose your own web services.

What are soap's main functionalities?

Create a SOAP Client

This feature allows you to create a SOAP client that can consume a SOAP web service. You provide the WSDL URL, and the client can then call the web service methods.

const soap = require('soap');
const url = 'http://example.com/wsdl?wsdl';
soap.createClient(url, function(err, client) {
  if (err) throw err;
  client.MyFunction({name: 'value'}, function(err, result) {
    if (err) throw err;
    console.log(result);
  });
});

Create a SOAP Server

This feature allows you to create a SOAP server that exposes your own web service. You define the service and its methods, and provide the WSDL file.

const soap = require('soap');
const express = require('express');
const app = express();
const myService = {
  MyService: {
    MyPort: {
      MyFunction: function(args) {
        return { name: args.name };
      }
    }
  }
};
const xml = require('fs').readFileSync('myservice.wsdl', 'utf8');
soap.listen(app, '/wsdl', myService, xml);
app.listen(8000);

Handle SOAP Headers

This feature allows you to add custom SOAP headers to your SOAP client requests. This can be useful for authentication or other custom header requirements.

const soap = require('soap');
const url = 'http://example.com/wsdl?wsdl';
soap.createClient(url, function(err, client) {
  if (err) throw err;
  const soapHeader = { 'MyHeader': 'value' };
  client.addSoapHeader(soapHeader);
  client.MyFunction({name: 'value'}, function(err, result) {
    if (err) throw err;
    console.log(result);
  });
});

Other packages similar to soap

Keywords

FAQs

Package last updated on 04 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc