Subscribe Bookmark RSS Feed

How to invoke SOAP web service using JSL ?


Community Trekker


Mar 14, 2015

Hi everybody,

In order to import data from a distant server to JMP, I have to call a SOAP web service using JSL.

When dealing with RestFul web services, I used to do it with sockets, passing parameters of my request in the URI. But actually, I don't know how to do with SOA web service, as I have an XML to send to the server. I don't even know from where to start.

So please, if anyone could help me sharing a tip or trick about how to use SOAP web service with JMP scripting language, I would really appreciate.

Best reegards,




Mar 21, 2013

Not familiar with SOAP web services, beyond a quick google search...Someone else?

It sounds like there is XML you send to the server and XML you receive from the server.  I think both of these will be done with the sockets you are already familiar with.  Composing an XML file to send to the server means you make a JSL string with all the XML start tags, properly balanced with end tags.  I'd suggest writing your own JSL user functions to help construct the XML you send to the server.  The scripting index contains an example of the JSL ParseXML function that you can use to handle files received from the server.

makeTable = Function( {name, colnames, colmatrix}, {icol, result = ""},

    result = result || "<table name='" || name || "'>";

    For( icol = 1, icol <= N Items( colnames ), icol++,

        result = result || makeColumn( colnames[icol], colmatrix[0, icol] ); // 0 means all rows for column i


    result = result || "</table>";


makeColumn = Function( {name, data}, {irow, result = ""},

    result = result || "<col name='" || name || "'>"; // start tag

    result = result || "["; // start bracket (not XML, this is within the XML tag)

    For( irow = 1, irow <= N Rows( data ), irow++,

        result = result || Char( data[irow] ) || " "


    result = result || "]"; // matching end bracket

    result = result || "</col>"; // matching end tag

    result; // return the string for this column


ex = makeTable( "Flintstone", {"Fred", "Wilma", "Pebbles"}, [1 2 3, 11 12 13, 111 112 113, 99 99 99] );

// above this line: sample JSL for creating an XML string to send to a server.  THIS IS NOT SOAP, just

// an example of a way to make balanced XML tags.

// below this line, an example of a way to parse data received from a server.  Not SOAP.  I'm just

// passing the XML string built above as a demo.

// example taken from scripting index...parses TABLE and COL tags

Parse XML( ex,

    On Element( "table", Start Tag( New Table( XML Attr( "name" ) ) ) ),

    On Element( "col", End Tag( New Column( XML Attr( "name" ), Set Values( Parse( XML Text() ) ) ) ) )


Notice the makeTable function is balanced because it has the <table...> ... </table> tags and only calls another function, makeColumn, that is also balanced because it has the <col...> ... </col> tags.  You might need a deeper nesting for SOAP; add more functions and keep them balanced with start and end tags.

The Parse XML function has multiple OnElement clauses to specify JSL to execute to handle the various XML tags.  The hard work will be figuring out which OnElement tags you need and what to do with them.  Parse XML is a framework that understands how the XML tags nest; you fill in the details for the tags (elements).

This XML schema was made up just to support this example.  It does not represent any kind of standard (like SOAP does).


Microsoft document: Understanding SOAP