How to expose a Soap (XML based) service in the portal

Not applicable

Is it possible to expose a soap service from the portal? The service has already been created in management UI, it just needs to be discoverable from the portal. The "Create Model" function doesn't consume WSDLs and schemas (XSD files) like it would a smartdoc. Please keep in mind that a custom solution is not ideal, since this process may need to be repeated several times. So creating a view using a basic page with 100+ lines of code is not practical nor efficient.

Solved Solved
1 4 823
1 ACCEPTED SOLUTION

Hi Mitchel, can you elaborate on what you mean by "Expose in the developer portal"?

The main functions of the Edge developer portal are:

  1. allow developers to provision keys in a self-service manner
  2. allow developers to view documentation for APIs

With a SOAP pass-through proxy in Apigee Edge, there is nothing special about keys/credentials. So that will just work.

With regards to documentation - there is no easy or standard way to produce auto-generated documentation for a SOAP system, in the same way you would use an API model for a RESTful interface. It may be necessary to construct a custom documentation experience. This shouldn't be too difficult though.

Example:

View solution in original post

4 REPLIES 4

Hi Mitchel, can you elaborate on what you mean by "Expose in the developer portal"?

The main functions of the Edge developer portal are:

  1. allow developers to provision keys in a self-service manner
  2. allow developers to view documentation for APIs

With a SOAP pass-through proxy in Apigee Edge, there is nothing special about keys/credentials. So that will just work.

With regards to documentation - there is no easy or standard way to produce auto-generated documentation for a SOAP system, in the same way you would use an API model for a RESTful interface. It may be necessary to construct a custom documentation experience. This shouldn't be too difficult though.

Example:

Hey @Dino

Your answer was what I expected but did not want to hear. By expose, I simply meant creating test payloads and file hosting so the user would have an example payload for testing.

Referencing the video example you posted (0:24/0:43), how did you send a test request and capture the response? Is there a tutorial on creating one?

Thank you for your time,

Mitchel

Hi Mitchel - I wrote code to send out the SOAP requests. It kinda looks like this:

    function findByTitle(evt) {
        var  payloadTemplate = soapWrap(
                "<ns1:findEntriesByTitle  xmlns:ns1='" + ns.ns1 + "'>" +
                "  <ns1:title>@TITLE</ns1:title>" +
                "</ns1:findEntriesByTitle>"),
            idButton = '#' + evt.currentTarget.id,
            idTextbox = idButton.split('_')[0] + '_tb',
            $textbox = $(idTextbox),
            v = $textbox.val(),
               payload = payloadTemplate
              .replace('@TITLE', $textbox.val());


        function onSuccess(xmldoc, status, jqxhr, $status){
            var listNode, bookCount = -1;
            log('findByTytle done');
            listNode = XPath.getNode(xmldoc,
                                     "/s:Envelope/s:Body/ns1:findEntriesByTitleResponse/ns1:books",
                                     ns);
            if (listNode !== null) {
                bookCount = listNode.childNodes.length;
                $status.html("Done. (count: " + bookCount +")");
            }
        }


        invokeSoapCallManually(evt, soapEndpoint, payload, onSuccess);
    }

But you can grab it all, by visiting that website. It's all just JS code and it's available for you to examine as an example, and maybe re-use. http://library-soap.herokuapp.com/

There may be popular modules or libraries that do this sort of thing, but I don't know of any. So I wrote some code to do it.

Awesome! Thank you, @Dino, for the example.

I found the code in the page.js file very useful! I forgot all about ajax calls!

$.ajax({
            type: "post",
            url: "//" + window.location.host + soapEndpoint,
            contentType: "text/xml",  // Content-Type header
            dataType: "xml",          // accepts
            data: payload1,           // actual payload
            success: function(xmldoc, status, jqxhr){
                var countNode;
                log('countAll' + entity + ' done');
                countNode = XPath.getNode(xmldoc,
                                          "/s:Envelope/s:Body/ns1:" +
                                          "countAll" + entity + "Response/ns1:count",
                                          ns);
                if (countNode !== null) {
                    eCount = parseInt(countNode.textContent, 10);
                    $countElt.html(eCount);
                    if (entity == 'Books'){ gBookCount = eCount;}
                }
            },
            error: function(jqXHR, textStatus, errorThrown){
                log('countAll' + entity + ' failed: ' + textStatus);
                $countElt.html('failed');
            },
            complete: function() {
                next();
            }
        });