Best way to send xml file from one existdb to another existdb

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Best way to send xml file from one existdb to another existdb

Agustin Cabral
Wich is the best way to perform a xml transference between 2 different exist databases in different servers?

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Best way to send xml file from one existdb to another existdb

Joe Wicentowski
Hi Agustin,

Have you considered using the XQuery doc() function to retrieve the document from the remote server?

Joe

On Wed, Mar 15, 2017 at 11:02 AM, Agustin Cabral <[hidden email]> wrote:
Wich is the best way to perform a xml transference between 2 different exist databases in different servers?

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Best way to send xml file from one existdb to another existdb

Agustin Cabral
Im looking for something to send the document from exist in server A to exist in server B, right now im trying to do it by using  httpclient:post()  and using the exist rest API, i have a xquery in the server B that will recieve the http request and then store the file where i want to, but im having authentication problems.

This is my xquery in exist from server A

httpclient:post(xs:anyURI("http://server:port/exist/rest/db/transferTest/publish-manager.xquery"), 
                     doc("/db/test/local-catalog.xml"),
                     true(),
                      <headers>                       
                        <header name="name" value="test.xml"/>
                        <header name="target" value="/db/transferTest"/>
                     </headers>
               )


And this the xquery in server B


let $name := request:get-parameter("name",()) 
let $target := request:get-parameter("target",()) 
let $data := request:get-data()

return xmldb:store($target, $name, $data)


the result i get from calling xquery in server A is this 


<httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="401">
    <httpclient:headers>
        <httpclient:header name="Date" value="Wed, 15 Mar 2017 17:21:28 GMT"/>
        <httpclient:header name="Set-Cookie" value="JSESSIONID=1td9q1jp8aykby3zn3in7vnl2;Path=/exist"/>
        <httpclient:header name="Expires" value="Thu, 01 Jan 1970 00:00:00 GMT"/>
        <httpclient:header name="X-XQuery-Cached" value="false"/>
        <httpclient:header name="WWW-Authenticate" value="Basic realm=&#34;exist&#34;"/>
        <httpclient:header name="Content-Length" value="0"/>
        <httpclient:header name="Server" value="Jetty(8.1.9.v20130131)"/>
    </httpclient:headers>
    <httpclient:body type="binary" encoding="Base64Encoded"/>
</httpclient:response


Is this a good way to do this?

2017-03-15 13:19 GMT-03:00 Joe Wicentowski <[hidden email]>:
Hi Agustin,

Have you considered using the XQuery doc() function to retrieve the document from the remote server?

Joe

On Wed, Mar 15, 2017 at 11:02 AM, Agustin Cabral <[hidden email]> wrote:
Wich is the best way to perform a xml transference between 2 different exist databases in different servers?

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Loading...