IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Upload XML with _process in perl

    Posted Tue August 12, 2003 05:00 PM

    Hello,

    I hope this is the right forum for my question…

    I’m writing a perl API for accessing Tamino. One method named load is already able
    to load nonxml data without any problems, but it has persitent problems with xml data.

    With LWP::UserAgent from libwww-perl-5.69 the code for uploading test.xml into
    database ben and collection test looks like this:

    $url = “http://pink/tamino/ben/test”;
    $file = “test.xml”;
    my $agent = LWP::UserAgent->new();
    my $response = $agent->post($url,
    Content_Type => ‘multipart/form-data’,
    Content => [_process => [$file]]);

    There’s a correct schema and the doctype fits as well, but I always end up with
    INOXDE7935 Schema not found.

    Then, I had a look at how the Tamino Interaktive Interface does it and I replicated
    the method in a simple html form, that works flawlessly with my test.xml:


    Choose File:



    I have no idea, how these methods differ, and I would really appreciate if some one could
    give me a hint!

    Thank you very much,

    Ben


    #API-Management
    #Tamino
    #webMethods


  • 2.  RE: Upload XML with _process in perl

    Posted Tue August 12, 2003 06:35 PM

    Hi Ben,

    When LWP builds the POST request it associates the content of the file with a MIME type. Unless you’ve changed this the file ending with .xml is associated with “text/plain”. So when it posted to Tamino it cannot find a nonxml schema to store it againest. So what you need to do is to associate .xml files with text/xml. You should be able to do this with LWP::MediaTypes. I must admit I couldn’t get this to work but this is probably something I am doing wrong. As an alternative you can edit the file “media.types” under the \site\lib\lwp directory to add an association between “text/xml” and the “xml” file extension. That worked for me :wink:

    Hope this helps.

    Stuart Fyffe-Collins
    Software AG (UK) Ltd.


    #Tamino
    #API-Management
    #webMethods


  • 3.  RE: Upload XML with _process in perl

    Posted Wed August 13, 2003 11:03 AM

    Hi Ben,

    Rather than editing the media.types the following change to your perl program will solve the problem:-

    # 
    use LWP::MediaTypes qw(add_type);
    
    # associate xml files with the correct mime type
    add_type("text/xml", xml);
    # then do the update
    $url = ....



    Regards,

    Stuart Fyffe-Collins
    Software AG (UK) Ltd.


    #API-Management
    #Tamino
    #webMethods


  • 4.  RE: Upload XML with _process in perl

    Posted Wed August 13, 2003 02:21 PM

    Hi Stuart,

    Thanks very much, everything works as expected now!

    Regards,

    Ben


    #API-Management
    #Tamino
    #webMethods