All Projects → RobinBuschmann → soap-typescript

RobinBuschmann / soap-typescript

Licence: other
SOAP decorators for creating wsdl's and annotating services to provide metadata for node-soap

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to soap-typescript

Sequelize Typescript
Decorators and some other features for sequelize
Stars: ✭ 2,200 (+10900%)
Mutual labels:  decorators, annotations
xsdata
Naive XML & JSON Bindings for python
Stars: ✭ 144 (+620%)
Mutual labels:  schema, soap
Graphql Typescript
Define and build GraphQL Schemas using typed classes
Stars: ✭ 67 (+235%)
Mutual labels:  decorators, annotations
React Decoration
A collection of decorators for React Components
Stars: ✭ 641 (+3105%)
Mutual labels:  decorators, annotations
Joiful
TypeScript Declarative Validation for Joi
Stars: ✭ 177 (+785%)
Mutual labels:  schema, decorators
the schema is
ActiveRecord schema annotations done right
Stars: ✭ 44 (+120%)
Mutual labels:  schema, annotations
Wsdl Creator
PHP WSDL Creator using PHPdoc (annotations, reflections).
Stars: ✭ 79 (+295%)
Mutual labels:  soap, annotations
xml-core
xml-core is a set of classes that make it easier to work with XML within the browser and node.
Stars: ✭ 18 (-10%)
Mutual labels:  schema, decorators
Type Graphql
Create GraphQL schema and resolvers with TypeScript, using classes and decorators!
Stars: ✭ 6,864 (+34220%)
Mutual labels:  schema, decorators
Typegql
Create GraphQL schema with TypeScript classes.
Stars: ✭ 415 (+1975%)
Mutual labels:  schema, decorators
decapi
Create GraphQL API by decorating TypeScript classes
Stars: ✭ 81 (+305%)
Mutual labels:  schema, decorators
twc
TypeScript based, boilerplate-less, Polymer toolbox friendly Polymer Modules
Stars: ✭ 33 (+65%)
Mutual labels:  decorators, annotations
schemarkdown
The core library for generate Markdown document from database schema.
Stars: ✭ 4 (-80%)
Mutual labels:  schema
laravel-soap
Laravel Soap Client
Stars: ✭ 140 (+600%)
Mutual labels:  soap
annotated
Schema generation using annotated entities and mappers
Stars: ✭ 19 (-5%)
Mutual labels:  annotations
migrana
Migrana is a Datomic migration tool that gives you the control over how your Datomic database evolves.
Stars: ✭ 22 (+10%)
Mutual labels:  schema
schemaglue
Naturally breaks down your monolithic graphql schema into bits and pieces and then glue them back together.
Stars: ✭ 117 (+485%)
Mutual labels:  schema
api-router
👨 RESTful router for your API in Nette Framework (@nette). Created either directly or via annotation.
Stars: ✭ 18 (-10%)
Mutual labels:  annotations
aspecio
Aspecio, AOP Proxies for OSGi services
Stars: ✭ 14 (-30%)
Mutual labels:  annotations
volder
volder is powerful Object schema validation lets you describe your data using a simple and readable schema and transform a value to match the requirements
Stars: ✭ 106 (+430%)
Mutual labels:  schema

Build Status

soap-decorators

SOAP decorators for creating wsdl's and annotating services to provide metadata for node-soap.

Installation

npm install soap-decorators --save

Usage

Input and output messages

Define input and output message interfaces for a soap service.

import {XSDComplexType, XSDElement} from 'soap-decorators';

@XSDComplexType
export class CalculatorInput {

  @XSDElement
  a: number;

  @XSDElement
  b: number;
}

@XSDComplexType
export class CalculatorResult {

  @XSDElement
  value: number;
}

For a more advanced usage of creating xsd schemas with decorators see xsd-decorators.

Soap service and operations

Define soap service, its operations and specify input and output messages via the previously defined classes.

import {SoapService, SoapOperation} from 'soap-decorators';

@SoapService({
  portName: 'CalculatorPort',
  serviceName: 'CalculatorService'
})
export class CalculatorController {

  @SoapOperation(CalculatorResult)
  add(data: CalculatorInput) {

    return {
      value: data.a + data.b
    };
  }

  @SoapOperation(CalculatorResult)
  subtract(data: CalculatorInput) {

    return Promise.resolve({
      value: data.a - data.b
    });
  }
}

Use soap service with express.js

soap-decorators provides a middleware for express, which does all the magic for you. The wsdl will be resolved and the location address and tns will be set automatically.

import {soap} from 'soap-decorators';

const app = express();
const calculatorController = new CalculatorController();

// resolves wsdl for you and sets location address and tns to current requested url
app.use('/soap/calculation', soap(calculatorController));

Requesting WSDL

Now you can ask for the wsdl by requesting against the defined endpoint.

GET /soap/calculation?wsdl

Response

<?xml version='1.0' encoding='UTF-8'?>
<wsdl:definitions xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' 
                  xmlns:xsd='http://www.w3.org/2001/XMLSchema' 
                  xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' 
                  name='CalculatorService' 
                  targetNamespace='https://calculation.example.com'
                  xmlns:tns='https://calculation.example.com'>
    <wsdl:types>
        <xsd:schema attributeFormDefault='unqualified' elementFormDefault='unqualified' xmlns:xsd='http://www.w3.org/2001/XMLSchema' targetNamespace='https://calculation.example.com'>
            <xsd:element name='add' type='tns:CalculatorInput'/>
            <xsd:element name='CalculatorResult' type='tns:CalculatorResult'/>
            <xsd:element name='subtract' type='tns:CalculatorInput'/>
            <xsd:complexType name='CalculatorInput'>
                <xsd:sequence>
                    <xsd:element name='a' type='xsd:int'/>
                    <xsd:element name='b' type='xsd:int'/>
                </xsd:sequence>
            </xsd:complexType>
            <xsd:complexType name='CalculatorResult'>
                <xsd:sequence>
                    <xsd:element name='value' type='xsd:int'/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name='addMessage'>
        <wsdl:part name='add' element='tns:add'/>
    </wsdl:message>
    <wsdl:message name='CalculatorResultMessage'>
        <wsdl:part name='CalculatorResult' element='tns:CalculatorResult'/>
    </wsdl:message>
    <wsdl:message name='subtractMessage'>
        <wsdl:part name='subtract' element='tns:subtract'/>
    </wsdl:message>
    <wsdl:portType name='CalculatorPortType'>
        <wsdl:operation name='add'>
            <wsdl:input message='tns:addMessage'/>
            <wsdl:output message='tns:CalculatorResultMessage'/>
        </wsdl:operation>
        <wsdl:operation name='subtract'>
            <wsdl:input message='tns:subtractMessage'/>
            <wsdl:output message='tns:CalculatorResultMessage'/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name='CalculatorServiceBinding' type='tns:CalculatorPortType'>
        <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
        <wsdl:operation name='add'>
            <wsdl:input>
                <soap:body use='literal' parts='add'/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use='literal' parts='CalculatorResult'/>
            </wsdl:output>
            <soap:operation soapAction='add'/>
        </wsdl:operation>
        <wsdl:operation name='subtract'>
            <wsdl:input>
                <soap:body use='literal' parts='subtract'/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use='literal' parts='CalculatorResult'/>
            </wsdl:output>
            <soap:operation soapAction='subtract'/>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name='CalculatorService'>
        <wsdl:port name='CalculatorPort' binding='tns:CalculatorServiceBinding'>
            <soap:address location='https://calculation.example.com/soap/v1'/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

Using operations

POST /soap/calculation

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cal="https://calculation.example.com">
   <soapenv:Header/>
   <soapenv:Body>
      <cal:add>
         <a>3</a>
         <b>1</b>
      </cal:add>
   </soapenv:Body>
</soapenv:Envelope>
POST /soap/calculation

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cal="https://calculation.example.com">
   <soapenv:Header/>
   <soapenv:Body>
      <cal:subtract>
         <a>8</a>
         <b>4</b>
      </cal:subtract>
   </soapenv:Body>
</soapenv:Envelope>

Response

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://localhost:3000/calculation">
   <soap:Body>
      <CalculatorResult>
         <value>4</value>
      </CalculatorResult>
   </soap:Body>
</soap:Envelope>

Retrieving WSDL from class or instance

import {createWsdl} from 'soap-decorators';

const instance = new CalculatorController();

createWsdl(instance) === createWsdl(CalculatorController);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].