[ic] Using Interchange as a SOAP server - order/process
Chris Sendall
cjs2 at admin.cam.ac.uk
Thu Apr 14 11:55:20 EDT 2005
Mike Heins: wrote
>>
>>
>> Chris Sendall wrote:
>>
>>> I can successfully log on to the SOAP server provided by
>>> Interchange and I am now trying to order an item and checkout the
>>> shopping cart.
>>>
>>> My initial instinct was:
>>> my $order_opt = {
>>> code => 'os90001',
>>> quantity => '2',
>>> };
>>> $ok = $Tag->order( $order_opt )->result;
>>>
>>> if($ok) {
>>> print "Successful order.\n";
>>> }
>>> else {
>>> print "FAILED order.\n";
>>> }
>>>
>>> but this returns the html to order the item (missing "session"?) <a
>>>
href="http://milton.internal.admin.cam.ac.uk:81/cgi-bin/foundcscp/ord/basket.htm
>>> l?mv_action=refresh&mv_order_item=os90001&mv_order_quantity=2&=MErpPqPA">
>>>
>>> I suspect I need to call a SOAP_Action but the information on how
>>> to do this is fairly sketchy, can anyone help please?
>>>
>>> Chris
>>>
>>>
>>
>> Example:
>> In your catalog conf, something like
>>
>> SOAP_Action soap_time <<EOR
>> sub {
>> my $locale = @_;
>> return $Tag->time($locale);
>> }
>> EOR
>>
>> SOAP_Control Action/soap_time always
>>
>>
>> Now you can query the SOAP server according to
>>
>> my $soap_response = SOAP::Lite
>> -> proxy('http://localhost:7780/yourCat/')
>> -> uri('http://yourserver/Vend/SOAP')
>> -> soap_time($locale)
>> ;
>>
>> But once again: Do the right thing in the global conf! (Whatever
>> that is).
>
> I think it would be
>
> SOAP_Control Action/soap_time always
>
> or the promiscuous
>
> SOAP_Control Action always
>
> WRT an action that would order something:
>
> SOAP_Action order <<EOR
> sub {
> my $opt = shift;
> $CGI->{mv_order_item} = $opt->{code};
> $CGI->{mv_order_quantity} = $opt->{quantity};
> $CGI->{mv_todo} = 'refresh';
> return $Tag->update( { function => 'process' });
> }
> EOR
Mike
Thanks very much for the order action - that worked fine, presumably a similar
example for checkout would be:
SOAP_Action checkout <<EOR
sub {
my $opt = shift;
$CGI->{mv_credit_card_number} = $opt->{credit_card_number};
$CGI->{mv_todo} = 'submit';
return $Tag->update( { function => 'process' });
}
EOR
SOAP_Control Action/checkout always
Thanks
Chris
--
Chris Sendall
MISD, First Floor, Greenwich House, Madingley Rise, Madingley Road,
Cambridge, CB3 0TX. Telephone: +44 1223 339653 Fax: +44 1223 339003
e-mail:cjs2 at admin.cam.ac.uk
More information about the interchange-users
mailing list