Integrate Software AG Products Using Digital Event Services 10.4 | Integrate Software AG Products Using Digital Event Services | MashZone NextGen Help | Appendix | Legacy Presto components | Mashables and Mashups | Mashups in EMML | Advanced Mashup Techniques | Wrapping WSDL Web Services That Return HTML Results
 
Wrapping WSDL Web Services That Return HTML Results
MashZone NextGen currently does not support HTML within mashable responses unless it is enclosed in a CDATA section or explicitly defined as XML content for the response. Some RSS web feeds, for example, embed HTML inside the <description> element for each item, such as:
<description>
<![CDATA[<p>some HTML here to display</p>]]>
</description>
For SOAP web services that return HTML without a CDATA section, you can wrap them in mashup scripts to successfully handle the response. This wrapper mashup uses the sample mashup SOAPService in MashZone NextGen to invoke the actual SOAP web service.
* To wrap a web service in a mashup script
1. If you have not already published the MashZone NextGen sample mashups, publish the sample SOAPService mashup script to make this service available. You can open the SOAPService mashup script in Mashup Editor and save it.
The SOAPService mashup is a generic mashup script that can invoke a SOAP service that you specify as input to the mashup. You must also construct the body of the message and any headers needed.
2. Create a new mashup script as the wrapper for this web service and add <output> to the script.
<mashup name="WrapMyWSDL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openmashup.org/schemas/v1.0/EMML/
../xsd/schemas/EMMLPrestoSpec.xsd"
xmlns="http://www.openmashup.org/schemas/v1.0/EMML">
<output name="result" type="document"/>
</mashup>
3. Define variables for these input parameters:
*soapEndpoint: the URL to the endpoint for this SOAP web service.
*soapAction: the URL or other name for the operation you want to invoke in this SOAP web service.
*soapHeader: if there are no SOAP headers needed, you define an empty variable. If you need to send SOAP headers in the request, use <constructor> to create the appropriate headers instead.
The mashup script should now look something like this:
...
<output name="result" type="document"/>
<variables>
<variable name="soapEndpoint" type="string"
default="http://www.serviceProvider.com/someService/"/>
<variable name="soapAction" type="string"
default="http://www.serviceProvider.com/someService/ActorQuery"/>
<variable name="soapHeader" type="document"/>
</variables>
</mashup>
4. Construct the body of the SOAP request using <constructor>.
Add the literal XML for the body of the request and fill in values with literals or use dynamic mashup expressions.
The <constructor> statement would look something like this:
...
<constructor outputvariable="$soapPayload">
<someService xmlns="http://serviceProvider.com/WebServices">
<ActorQuery>Meg Ryan</ActorQuery>
</someService>
</constructor>
</mashup>
5. Invoke SOAPService using the variables to complete these input parameters in order:
*soapEndpoint: the URL of the SOAP web service to invoke.
*soapHeader: any SOAP headers to include in the request.
*soapBody: the payload of the request.
*soapAction: the operation to invoke in this SOAP web service.
The <invoke> statement should look something like this:
...
<invoke service="SOAPService" operation="Invoke" inputvariables="soapEndpoint, soapHeader, soapPayload, soapAction" outputvariable="$result"/>
</mashup>
6. If needed, extract the HTML from the results using <assign>.
If you want only the HTML from the web service response, you must extract those nodes from the service result. The HTML from the response must be well-formed and fully enclosed in one root node if you are going to use it as the output from the mashup script.
Note: The HTML in the service response is treated as XML. Any XML delimiter characters that are in the HTML content, such as &, will use XML escape entities, such as &amp;.
The complete wrapper mashup script would look something like this:
<mashup name="WrapMyWSDL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openmashup.org/schemas/v1.0/EMML/
../xsd/EMMLPrstoSpec.xsd"
xmlns="http://www.openmashup.org/schemas/v1.0/EMML">

<output name="result" type="document"/>
<variables>
<variable name="soapEndpoint" type="string"
default="http://www.serviceProvider.com/someService/"/>
<variable name="soapAction" type="string"
default="http://www.serviceProvider.com/someService/ActorQuery"/>
<variable name="soapHeader" type="document"/>
</variables>
<constructor outputvariable="$soapPayload">
<someService xmlns="http://serviceProvider.com/WebServices">
<ActorQuery>Meg Ryan</ActorQuery>
</someService>
</constructor>
<invoke service="SOAPService" operation="Invoke" inputvariables="soapEndpoint, soapHeader, soapPayload, soapAction" outputvariable="$result"/>
<assign outputvariable="$result" fromexpr="$result//*:ActorQueryResponse"/>
</mashup>

Copyright © 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release