Interchange has built-in support for SOAP, the Simple Object Access Protocol defined originally by Microsoft and embraced and extended in an open fashion by the W3 standards organzation. It is based on XML and is the leading e-commerce communication mechanism, supported by every major company involved in e-commerce.
SOAP allows you to write programs in any language which can directly access functions on Interchange. It is possible to order an item, enter address/shipping information, and trigger an order via remote procedure call. And much more.
In addition, Interchange provides a SOAP client that allows you to do the same with other XML-based SOAP servers.
It is beyond the scope of this document to describe exactly how SOAP works. For more information about SOAP, see the following:
http://www.w3.org/TR/SOAP/
All of Interchange's SOAP functions are based on Paul Kulchenko's excellent SOAP::Lite module set for Perl. See information about it at:
http://www.soaplite.com/
There are many other sources of information about SOAP. Check your neighborhood search engine.
WARNING: The SOAP server is in an alpha state. This means that the interface may change at any time, and that all features are not fully tested.
use SOAP::Lite; my $cat = 'found'; my $id = 'ABCDEFGH:soap';
my $Tag = SOAP::Lite -> uri('http://developer.akopia.com/Vend/SOAP') -> proxy("http://localhost:7780/$cat/$id");
my $login_opt = { username => 'test', password => 'test', function => 'login' }; my $ok = $Tag->userdb( $login_opt )->result;
if($ok) { print "Successful login.\n"; } else { print "FAILED login.\n"; }
print "First name is " . $Tag->value('fname')->result;
The set of allowed tags can be set in the catalog directive SOAP_Enable.
use SOAP::Lite;
my $cat = 'found';
my $ic = SOAP::Lite -> uri('http://bill.minivend.com/Vend/SOAP') -> proxy("http://localhost:7780/$cat"); my $id = $ic -> session_name ()->result;
my $proxy = "http://localhost:7780/$cat/$id"; $ic->proxy($proxy);
$id = $ic->session_name()->result(); $id = defined $id ? $id : 'undef'; print "id=$id\n";
use SOAP::Lite; use Data::Dumper; my $id = 'ABCDEFGH';
my $cat = 'found';
my $ic = SOAP::Lite -> uri('http://bill.minivend.com/Vend/SOAP') -> proxy("http://localhost:7780/$cat/$id");
my $vref = $ic -> Values ()->result;
print "Original name is '$vref->{fname}' '$vref->{lname}'\n";
# Set first name and last name $vref->{fname} = 'Foo'; $vref->{lname} = 'Bar';
print "Local name is $vref->{fname} $vref->{lname}\n";
# Save entire Values hash, which returns new structure my $nref = $ic -> Values ($vref)->result;
my $fname = $ic->value('fname')->result; my $lname = $ic->value('lname')->result; print "Interchange name is $fname $lname\n";
print "Name returned from save is $nref->{fname} $nref->{lname}\n";
[calc] my $next_order = q{[soap uri="http://localhost/Vend/SOAP" proxy="http://localhost:7780/other_cat" call="counter" param.file="etc/order.number" ]}; if(! $next_order) { # Alternatively you could die if this was in an order profile Log("Failed to get order number from SOAP! Using temporary number."); $next_order = q{[counter file=etc/emergency.number]}; } $Session->{mv_order_number} = $next_order; return; [/calc]
SOAP Yes
Default is No
.
SOAP_StartServers 5
Default is 1.
socket(s)
that should be enabled to receive SOAP calls. This
is an array -- if you wish to have multiple sockets monitored specify
them.
SOAP_Socket 7780 7781
Default is 7780. If you want to monitor only a certain IP address, instead of all attached interfaces (the default), specify the port like:
SOAP_Socket 127.0.0.1:7780 127.0.0.1:7781
If your transport software supports it, you may use UNIX-domain sockets by specifying them as an absolute file path:
SOAP_Socket 7780 /var/run/interchange/socket.soap
As shown above, you can monitor both INET and UNIX domain sockets.
SOAP_Perms 0660
Default is 0600
.
SOAP_MaxRequests 100
Default is 50
.
SOAP_Host 127.0.0.1 10.* 205.133.134.19
Wildcards can be used. Default is localhost 127.0.0.1
.
SOAP Yes
Default is No
.
SOAP_Enable interpolate 1
The above would allow embedded Perl code to be interpreted as a part of a SOAP RPC call.