Re: Newbie: config file import, and http-request

I'm working toward a solution based on list responses. It appears to almost work: there is an error caused by the loaded config file; after I'm done with extracting its auth elements, I need to dump it (but can't figure out how to do that).

Other than that, Calabash's output seems to indicate that it has successfully populated the variables, created attributes, and built the c:request.

The reason for using auth.xml: this is going into an automated build process.  The process that will call this is unknown to me; could be Ant, could be command line, could be a Windows batch script.  The more it can stand alone, the better. A one-time config file edit is more trustworthy, IMO.

calabash fetch.xpl query="version.xml"

<?xml version="1.0"?>
<config name="server">

<?xml version="1.0"?>
 - log into server
 - issue query
 - return document -->
<p:declare-step xmlns:c="" xmlns:p="" name="fetch" version="1.0">
  <p:output port="result"/>
  <p:input port="parameters" kind="parameter"/>
  <p:option name="query" required="true"/>
  <!-- load login details  -->
  <p:load href="auth.xml"/>
  <!-- create a request template -->
  <p:group name="request">
    <p:variable name="uri" select="//uri"/>
    <p:variable name="username" select="//username"/>
    <p:variable name="password" select="//password"/>
    <p:wrap wrapper="c:request" match="/"/>
    <p:add-attribute match="c:request" attribute-name="href">
      <p:with-option name="attribute-value" select="concat($uri, $query)"/>
    <p:add-attribute match="c:request" attribute-name="username">
      <p:with-option name="attribute-value" select="$username"/>
    <p:add-attribute match="c:request" attribute-name="password">
      <p:with-option name="attribute-value" select="$password"/>
  <p:set-attributes match="/c:request">
    <p:input port="attributes">
        <c:request method="put" auth-method="Basic" send-authorization="true"/>
  <!-- send it via http-request -->

Received on Tuesday, 21 September 2010 20:12:28 UTC