Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
7 replies Latest Post - ‏2015-05-26T08:17:15Z by HermannSW
SystemAdmin
SystemAdmin
6772 Posts
ACCEPTED ANSWER

Pinned topic Access a file from datapower directory and send it to an external server?

‏2013-01-02T12:49:14Z |
is there any way to dynamically access a file stored a local directory in DataPower File Management and transport it via a protocol like ftp to external server??

Kindly advice a solution....tnx in adv.
Updated on 2013-01-07T15:36:18Z at 2013-01-07T15:36:18Z by swlinn
  • kenhygh
    kenhygh
    1475 Posts
    ACCEPTED ANSWER

    Re: Access a file from datapower directory and send it to an external server?

    ‏2013-01-02T13:42:02Z  in response to SystemAdmin
    well, I'd try something like the following (not tested)

    <xsl:variable name="FileContent">
    <dp:url-open target="'local://some-file'" response="binaryNode"/>
    </xsl:variable>

    <dp:url-open target="'ftp://my-server'" response="whateverResponseYouExpect">
    <xsl:copy-of select="$FileContent"/>
    </dp:url-open>
    • HermannSW
      HermannSW
      4512 Posts
      ACCEPTED ANSWER

      Re: Access a file from datapower directory and send it to an external server?

      ‏2013-01-02T14:45:12Z  in response to kenhygh
      > well, I'd try something like the following (not tested)
      >
      that is unlikely to work, because processing binaryNode data can only be done by
      • either "dp:binary-encode()"
      • or "dp:output-mapping"

      This should work (also untested, see slides 18 and 19 of this webcast, hear into audio recording for details):
      <xsl:variable name="FileContent">
        <dp:url-open target="'local://some-file'" response="binaryNode"/>
      </xsl:variable>
       
      <dp:url-open target="'ftp://my-server'" response="whateverResponseYouExpect" data-type="base64">
        <xsl:copy-of select="dp:binary-encode($FileContent/result/binary/node())"/>
      </dp:url-open>
      


      Hermann <myXsltBlog/> <myXsltTweets/>
      Updated on 2014-03-25T02:43:51Z at 2014-03-25T02:43:51Z by iron-man
      • SystemAdmin
        SystemAdmin
        6772 Posts
        ACCEPTED ANSWER

        Re: Access a file from datapower directory and send it to an external server?

        ‏2013-01-07T12:56:02Z  in response to HermannSW
        Tnx for the response!!!!!!

        I am able to move a file from local box to externall server as follows...

        <xsl:variable name="sftp-put-url" 
        select="'sftp://username:password@**.**.**:**/~/FileSource/export.xml'" /> 
        <dp:url-open target="{$sftp-put-url}" data-type="filename" response="ignore">local:///Order.xml</dp:url-open>
        


        but now i am trying to move entire directory to server...could any one help on same!!!!

        i tried with following but no luck...... was saying unsupported urlopen URL...........
        <xsl:variable name="FileContent">
          <dp:url-open target="'local://some-file'" response="binaryNode"/>
        </xsl:variable>
        


        tnx in adv....
        Updated on 2014-03-25T02:43:10Z at 2014-03-25T02:43:10Z by iron-man
        • Daviiid
          Daviiid
          282 Posts
          ACCEPTED ANSWER

          Re: Access a file from datapower directory and send it to an external server?

          ‏2013-01-07T14:58:07Z  in response to SystemAdmin
          Hello

          Maybe you can have to use a SOMA call

          <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
                  <env:Body>
                          <dp:request domain="{$YourDomain}" xmlns:dp="http://www.datapower.com/schemas/management">
                                  <dp:get-filestore location="local:"/>
                          </dp:request>
                  </env:Body>
          </env:Envelope>
          
          Updated on 2014-03-25T02:43:06Z at 2014-03-25T02:43:06Z by iron-man