Nimish,
1) If a webservice supports https endpoint, you can register the service using that endpoint. The Invoke statement will now use SSL encryption to communicate with the registered service, thus encrypting username/password during communication.
2) Also, note that username/password may also be discretely stored as user or global parameter. They can subsequently be retrieved in EMML using $user or $ global prefix i.e.
<username>{$user.username}</username>Refer to globalparams.emml sample in Presto for using user/global parameters.
hth
raj. chief masher @ jackbe
John, Thanks for the code snippet.
This has piqued my interest. I am off to look at some of the other macro videos because I am wondering how it might be possible to set this up so that it takes a WSDL as input and wraps the httpBasicAuth header around the WSDL to make a call.
Since we use BasicAuth frequently it would mean I could use wires to link a WSDL service with a BasicAuth wrapper function and add the appropriate userid and password as inputs.
This is my first ever attempt at a macro thanks to Americo's samples.
I am attempting to wrap the HTTP BasicAuth header around a WSDL.
I am not sure it is working but may be the code will be enough to help somebody finish the job. After all I am not a developer - but know enough hacking to be dangerous! :)
At some point I may need to read some documentation!
<!--
ABSTRACT: This Mashup is an attempt to add HTTP BasicAuth authentication to a
WSDL call using Emml macros
@Author: Mark Scrimshire - inspired by Americo Savinon and John Crupi
@date: 10/30/08
-->
<mashup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jackbe.com/2008-03-01/EMMLSchema../src/schemas/EMMLSpec.xsd"
xmlns="http://www.jackbe.com/2008-03-01/EMMLSchema"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:macro = "http://www.jackbe.com/2008-03-01/EMMLMacro"
name="MacrosSample">
<emml-meta name="author">Mark Scrimshire(mscrimshire@gmail.com) aka ekivemark</emml-meta>
<variable name="mydoc" type="document">
<items>
<item>foo1</item>
<item>foo2</item>
<item>foo3</item>
</items>
</variable>
<macro name="addHttpBasicAuth">
<input name="xmlSource" type="document" />
<input name="user" type="string"></input>
<input name="password" type="string"></input>
<output name="result" type="document" />
<presto-meta name="macrotype">user</presto-meta>
<presto-meta name="help">
<description>This macro adds userid and password to the WSDL as a http header in a selected xml file.</description>
<parameters>
<parameter name="xmlSource">XML Source that will be used for this macro</parameter>
<parameter name="userid">This is the userid for Basic Authentication</parameter>
<parameter name="password">This is the password for Basic Authentication</parameter>
</parameters>
</presto-meta>
<presto-meta name="type" reference="xmlSource">datapath</presto-meta>
<variables>
<variable name="user" type="string" default="OpenID-Rocks" />
<variable name="password" type="string" default="OAuth-Rocks-Too" />
</variables>
<constructor outputvariable="requestheader">
<header>
<httpBasicAuth>
<user>{$user}</user>
<password>{$password}</password>
</httpBasicAuth>
</header>
</constructor>
<assign fromvariable="$xmlSource" header="requestheader" outputvariable="result"> </assign>
</macro>
<macro:addHttpBasicAuth xmlSource="$mydoc" userid="JackBe" password="Mashups" />
<display message="xmlSource = " expr="$xmlSource" />
<display message="Result = " expr="$result" />
</mashup>




If your service requires HTTP BasicAuth, you will manually create the header and propagate it to the invoke call.
Here is an example EMML:
<mashup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="MyHTTPBasicAuthExample">
<output name="result" type="document"/>
<variables>
<variable name="user" type="string" default="johnny"/>
<variable name="password" type="string" default="crupi"/>
</variables>
<constructor outputvariable="requestheader">
<header>
<httpBasicAuth>
<user>{$user}</user>
<password>{$password}</password>
</httpBasicAuth>
</header>
</constructor>
<invoke service="Customers" operation="getAllCustomers" header="requestheader" outputvariable="result"/>
</mashup>
Notice, the outputvariable="requestheader" section. That constructs the httpBasicAuth that gets fed into the "invoke" call using the "header" input.