Skip to content

nfedyk/soapjs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 

Repository files navigation

soapjs - A client to interact with soap web services in node.js

Info

  • LETS BE CLEAR: soap is lame and the antithesis of node. However, sometimes you've got what you've got.
  • Create functions at runtime with optional param checking
  • Contact: [email protected]
  • Adding incremental support for complex types. Still untested: datetimes, deeply nested complex types
  • TODO:
    1. local file caching for wsdl,
    2. loading wsdl from fs,
    3. support per operation soapAction,
    4. http basic auth, CHECK
    5. printing the signature of a given method after parse, CHECK
    6. testing on a wsdl other than the one I'm using, CHECK

API Goals

// Download the wsdl, and create your functions at runtime
// Using optional http auth. WSDL address and endpoints can be https
var c = soap.createClient(wsdl, {
    username: 'username',
    password: 'password'
});

// Emit when we're done with instantiation from wsdl
c.on( "ready", function(){

    // Call a method from the wsdl, which is created at runtime
    // It will be optionally typed (using the wsdl as the basis)
    var request = c.GetSUID({
        "userid": "[email protected]"
    })
    
    request.on("end", function( data ){
        console.log( "JSON formatted data from server:" );
        console.log( data );
        console.log( "Actual xml request body generated by invoking runtime method:" );
        console.log( request.requestBody );
        console.log( request.responseBody );
    });
});

WSDL Introspection

For instance, consuming a jBilling soap wsdl gives us the following using repl tab complete:

c._events                     c.applyPayment                c.authenticate                c.complexTypeCache            c.create
c.createInvoice               c.createItem                  c.createOrder                 c.createOrderAndInvoice       c.createOrderPreAuthorize
c.createUser                  c.deleteInvoice               c.deleteOrder                 c.deleteUser                  c.functions
c.getAllItemCategories        c.getAllItems                 c.getCurrentOrder             c.getInvoiceWS                c.getInvoicesByDate
c.getItem                     c.getItemByCategory           c.getLastInvoices             c.getLastInvoicesByItemType   c.getLastOrders
c.getLastOrdersByItemType     c.getLastPayments             c.getLatestInvoice            c.getLatestInvoiceByItemType  c.getLatestOrder
c.getLatestOrderByItemType    c.getLatestPayment            c.getOrder                    c.getOrderByPeriod            c.getOrderLine
c.getPayment                  c.getUserContactsWS           c.getUserId                   c.getUserInvoicesByDate       c.getUserItemsByCategory
c.getUserTransitions          c.getUserTransitionsAfterId   c.getUserWS                   c.getUsersByCreditCard        c.getUsersByCustomField
c.getUsersByStatus            c.getUsersInStatus            c.getUsersNotInStatus         c.isUserSubscribedTo          c.location
c.namespace                   c.options                     c.password                    c.payInvoice                  c.processPayment
c.rateOrder                   c.rateOrders                  c.simpleTypes                 c.updateCreditCard            c.updateCurrentOrder
c.updateItem                  c.updateOrder                 c.updateOrderLine             c.updateUser                  c.updateUserContact
c.username                    c.validateMultiPurchase       c.validatePurchase            c.wsdl                        c.wsdlContent

> c.describe( c.createUser );
{ name: 'createUser',
  vars: 
   { arg0: 
      { autoRecharge: [Object],
        balanceType: [Object],
        blacklistMatches: [Object],
        childIds: [Object],
        contact: [Object],
        createDatetime: [Object],
        creditCard: [Object],
        creditLimit: [Object],
        currencyId: [Object],
        deleted: [Object],
        dynamicBalance: [Object],
        failedAttempts: [Object],
        invoiceChild: [Object],
        isParent: [Object],
        language: [Object],
        languageId: [Object],
        lastLogin: [Object],
        lastStatusChange: [Object],
        mainOrderId: [Object],
        mainRoleId: [Object],
        owingBalance: [Object],
        parentId: [Object],
        partnerId: [Object],
        password: [Object],
        role: [Object],
        status: [Object],
        statusId: [Object],
        subscriberStatusId: [Object],
        userId: [Object],
        userIdBlacklisted: [Object],
        userName: [Object] } } }
>

Dependencies

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%