Debug of SOAP Requests

546 views
Skip to first unread message

James Records

unread,
Nov 19, 2014, 12:25:29 AM11/19/14
to loopb...@googlegroups.com
Hi,

I just stumbled upon the strongloop soap connector and am attempting to play with it. 

I am attempting to use the following WSDL:


I have the following soap request that works fine when using a chrome extension "wizdler" to post the following (userid/passwords replaced with xxxxxxxxx)

    <Body>
        <GetSemesters xmlns="http://clients.mindbodyonline.com/api/0_5">
            <!-- Optional -->
            <Request>
                <!-- Optional -->
                <SourceCredentials>
                    <SourceName>xxxxxxxxxxxxxxx</SourceName>
                    <Password>xxxxxxxxxxxxxxx</Password>
                    <!-- Optional -->
                    <SiteIDs>
                        <int>xxxxx</int>
                    </SiteIDs>
                </SourceCredentials>      
            </Request>
        </GetSemesters>
    </Body>
</Envelope>

Now I've attempted to create a very basic example by simply switching the wsdl parameter in the examples/weather-rest.js file, here are my changes:


var loopback = require('loopback');
//var path = require('path');

var app = module.exports = loopback();

app.set('restApiRoot', '/api');

var ds = loopback.createDataSource('soap',
  {
    connector: require('../index'),
    remotingEnabled: true,
    debug: true
  });

// Unfortunately, the methods from the connector are mixed in asynchronously
// This is a hack to wait for the methods to be injected
ds.once('connected', function () {

  // Create the model
  var ClientService = ds.createModel('ClientService', {});

  // Expose to REST
  app.model(ClientService);

  // LoopBack REST interface
  app.use(app.get('restApiRoot'), loopback.rest());
// API explorer (if present)
  try {
    var explorer = require('loopback-explorer')(app);
    app.use('/explorer', explorer);
    app.once('started', function (baseUrl) {
      console.log('Browse your REST API at %s%s', baseUrl, explorer.route);
    });
  } catch (e) {
    console.log(
      'Run `npm install loopback-explorer` to enable the LoopBack explorer'
    );
  }

  //app.use(loopback.urlNotFound());
  app.use(loopback.errorHandler());

  if (require.main === module) {
    app.start();
  }

});

app.start = function () {
  return app.listen(3000, function () {
    var baseUrl = 'http://127.0.0.1:3000';
    app.emit('started', baseUrl);
    console.log('LoopBack server listening @ %s%s', baseUrl, '/');
  });
};


This actually works great, browsing to http://webserver:3000/explorer shows all the methods i'd like to expose

But for the life of me I can't figure out how to get the json formated in a workable way.  I enabled debug but still didn't see what I wanted.  Is there a way to enable debugging so i can see the soap request the connector is making?  This would really help me with the formatting I believe.  All I see at this point is server errors back from the soap service.

Thanks in advance, 

James

Raymond Feng

unread,
Nov 19, 2014, 1:10:08 AM11/19/14
to James Records, loopb...@googlegroups.com
There are a few options:

2. Turn on debugging for request module - https://github.com/request/request#debugging

Thanks,

---
Raymond Feng
Co-Founder and Architect @ StrongLoop, Inc.

StrongLoop makes it easy to develop APIs in Node, plus get DevOps capabilities like monitoring, debugging and clustering.

--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Records

unread,
Nov 20, 2014, 2:37:45 AM11/20/14
to loopb...@googlegroups.com, james....@gmail.com
Frank,

Thanks, I was able to get it to work, the debug didn't show me what I wanted, but a packet capture got me there.

So with this example I can expose a single WSDL, do you have any examples of exposing multiples, I can't seem to loop through them because of the .on function, any pointers?

Thanks Again,
James

Nicholas Duffy

unread,
Mar 14, 2015, 11:48:11 AM3/14/15
to loopb...@googlegroups.com, james....@gmail.com
James,

Here's a gist that appears to loop through multiple WSDLs as requested: https://gist.github.com/lancehudson/bfd25d7931cc17a90707

Can you also share your format for input for the MINDBODY API? I'm attempting the same.

Thanks,
Nick
Reply all
Reply to author
Forward
0 new messages