byteme has asked for the wisdom of the Perl Monks concerning the following question:
This produced a 500 internal server error but with just#!/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>
I can print the contents so the data is there.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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: need to post a string without user intervention
by jhourcle (Prior) on Jun 01, 2009 at 19:38 UTC | |
by byteme (Novice) on Jun 02, 2009 at 07:36 UTC | |
by dpetrov (Acolyte) on Jun 03, 2009 at 07:39 UTC | |
|
Re: need to post a string without user intervention
by arc_of_descent (Hermit) on Jun 01, 2009 at 17:51 UTC | |
by byteme (Novice) on Jun 02, 2009 at 15:59 UTC |