[ic] HTTP POSTing to another server from IC

Grant listbox at email.com
Thu Aug 21 16:30:49 EDT 2003


> > *snip*
> >
> > > How about running your sub through perl to check the syntax
> > (perl -cw
> > > perl_script, for example) before trying to get Interchange to cope
> > > with it? :)
> > >
> > > Good luck,
> > >
> > > John
> >
> > Sorry about that.  I've cleaned that up and I still get the
> > same error when restarting IC.  Running it through perl -cw I
> > get the following:
> >
> > Number found where operator expected at posttourl.tag line 2,
> > near "Interpolate 1"
> >         (Do you need to predeclare Interpolate?)
> > syntax error at posttourl.tag line 2, near "Interpolate 1"
> > Semicolon seems to be missing at posttourl.tag line 2. syntax
> > error at posttourl.tag line 33, near "}" posttourl.tag had
> > compilation errors.
> >
> > *more snip*
> >
> > - Grant
> >
> Hi Grant,
>
> Sorry, I could have been more clear. Just put the part from
> the sub { to the final closing } (inclusive) in a separate text file,
> or comment out all of the lines outside the sub with # at the start
> of each line.
>
> You might find perl -c a better check, as it's less verbose. From a
> quick check, what you've got should now be OK into Interchange -- can't
> help you much as to whether it will actually do what you want,
> though.
>
> John.

IC still spits out that same error during a restart though.  It's:

Calling UI...UserTag 'posttourl' code is not a subroutine reference
In line 34 of the configuration file
'/mystore/ic493/code/UserTag/posttourl.tag':

So something must not be right, right?

- Grant

P.S. Here's the tag again:

Usertag posttourl Order url params apicall
Usertag posttourl Interpolate 1
Usertag posttourl Routine <<EOR
sub {
require HTTP::Request;
require HTTP::Headers;
require LWP::UserAgent; # SSL cabable if Crypt::SSLeay installed
        my $url=shift; my $params=shift;
        $ENV{'HTTPS_VERSION'} = '3';
        $ENV{'HTTPS_CERT_FILE'}='xxx.pem';
	$ENV{'HTTPS_KEY_FILE'}='xxx.key';

        my $page="";
        my $request=new HTTP::Request 'POST' => $url;
        $request->Content-Type('text/xml');
        $request->Content($params);
        $request->Content-Length(length($params));
        $request->X-API-COMPATIBILITY-LEVEL(305);
        $request->X-API-SESSION-CERTIFICATE('staticinfo');
        $request->X-API-DEV-NAME(staticinfo);
        $request->X-API-APP-NAME(staticinfo);
        $request->X-API-CERT-NAME('staticinfo');
        $request->X-API-CALL-NAME($apicall);
        $request->X-API-SITEID(0);
        $request->X-API-DETAIL-LEVEL(0);

        my $ua=LWP::UserAgent->new;
        my $response = $ua->request($request);
        $page.=$response->as_string,"\n\n\n";
        $page.=$response->code,"\n";
        $page.=$response->message,"\n";
        return $page;
}
EOR



More information about the interchange-users mailing list