#!/usr/bin/perl -w use strict; use LWP::UserAgent; use HTTP::Request::Common; use SOAP::Lite ( +trace => 'all', readable => 1, outputxml => 1, ); ##use XML ::Simple; use CGI::Carp qw/fatalsToBrowser/; use warnings; print "Content-Type: text/xml; charset=utf-8"; my $fieldsearch = 0; my $fieldvalue = "cats"; my $message = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/enve +lope/\" xmlns:xsd=\"http://babel.webservices.book.nielsen.com/xsd\"> <soapenv:Header/> <soapenv:Body> <xsd:getSearchService> <xsd:param0> <xsd:clientId>BookmarcusBDWS01</xsd:clientId> <!--Optional:--> <xsd:currency>GBP</xsd:currency> <xsd:format>7</xsd:format> <xsd:from>0</xsd:from> <xsd:indexType>0</xsd:indexType> <!--Optional:--> <xsd:marketSegment>UK</xsd:marketSegment> <!--1 or more repetitions:--> <xsd:params> <!--Optional:--> <xsd:fieldLogic> <xsd:fieldLogic>0</xsd:fieldLogic> </xsd:fieldLogic> <xsd:fieldSearch>"; my $FS = "</xsd:fieldSearch> <xsd:fieldValue>"; my $FV = "</xsd:fieldValue></xsd:params> <xsd:password>mc709cpq264i</xsd:password> <xsd:requestId>TestSearch</xsd:requestId> <xsd:resultView>2</xsd:resultView> <!--1 or more repetitions:--> <xsd:sortField> <xsd:sortField>1</xsd:sortField> <xsd:sortOrder>1</xsd:sortOrder> </xsd:sortField> <!--Optional:--> <xsd:territory>UK</xsd:territory> <xsd:to>4</xsd:to> </xsd:param0> </xsd:getSearchService> </soapenv:Body> </soapenv:Envelope>"; my $sendit= $message.$fieldsearch.$FS.$fieldvalue.$FV; my $userAgent = LWP::UserAgent->new(); my $request = HTTP::Request->new(POST => 'http://wsqa.nielsenbookdatao +nline.com/webservices/services/BDOLWebService?wsdl'); $request->header(SOAPAction => '"http://babel.webservices.book.nielsen +.com/xsd"'); $request->content($sendit); $request->content_type("text/xml; charset=utf-8"); my $response = $userAgent->request($request); if($response->code == 200) { my $last=""; $last = $response->as_string; <b>my $ua = LWP::UserAgent->new; my $action = 'http://www.booksforeducation.com/testbed/fred.php'; my $form = {xml => $last}; my $response = $ua->post($action, $form);</b>
This produced a 500 internal server error but with just
my $userAgent = LWP::UserAgent->new(); my $request = HTTP::Request->new(POST => 'http://wsqa.nielsenbookdatao +nline.com/webservices/services/BDOLWebService?wsdl'); $request->header(SOAPAction => '"http://babel.webservices.book.nielsen +.com/xsd"'); $request->content($sendit); $request->content_type("text/xml; charset=utf-8"); my $response = $userAgent->request($request); if($response->code == 200) { my $last=""; $last = $response->as_string;
I can print the contents so the data is there.

In reply to need to post a string without user intervention by byteme

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.