<!--
.code {
background-color: #E4E5E8 ;
margin-left: 0pt;
}
-->
You've got a problem...
You need RFC access to R/3, but your requirement won't allow you to use
the RFC protocol, so what do you do? Well, one thing you could do is to
use the SOAP-based RFC interface to the Web Application Server, that
comes as standard since 6.10.
This is a great little generic interface for performing RFCs via an HTTP-based SOAP interface.
The handler is found as part of the SOAP service configuration, as
defined in transaction SICF. The ICF path is:
/default_host/sap/bc/soap/rfc.
The service definition then translates into the URL
http://seahorse.local.net:8000/sap/bc/soap/rfc (for my system - insert
your own host name).
Within this, the defined handler list is CL_HTTP_EXT_SOAPHANDLER_RFC.
This class is a native ICF handler that pulls an HTTP request off the
wire, and converts it into a SOAP request, parses it, performs the
associated RFC call, and then parcels up the result as a SOAP Response,
back on to the wire.
Perl, and SOAP::Lite
I have built up a little example here of how you can use Perl, and a
module called SOAP::Lite to create a simple SOAP client. SOAP::Lite is
the Swiss Army Chainsaw of the SOAP interface world - it has features
for just about anything you can think of from debugging/tracing through
to WSDL, and UDDI. Because of this, it is not only a great tool for
binding to R/3, but it is invaluable for debugging SOAP implementations.
Example
The example below shows how to build up a request, and make a call to the
RFC_READ_REPORT function module. I ran this against my NW4 vanilla
implementation - you may need to alter things like the User, and
Password values, as well as the hostname of the HTTP call.
What you need:
Perl - for this example, even win32 should work :wink:
The environment I used for this was:
- RedHat 9
- Perl 5.8.0
- SOAP::Lite 0.60, and tested with 0.55
- SAP NetWeaver 4 evaluation system, should work with R/3 6.x+
Figure 1. Service configuration in SICF <br/>
The complete example:
#!/usr/bin/perl
use Data::Dumper;
#use SOAP::Lite +debug;
#use SOAP::Lite +trace;
use SOAP::Lite;
my $user = 'developer';
my $pass = 'developer';
my $hostname = 'seahorse.local.net'; # change this to your target
my $sr = "";
my $namespace = "rfc:";
my $muri = "urn:sap-com:document:sap:rfc:functions";
my $mn = "RFC_READ_REPORT";- setup the namespace
my $s = new SOAP::Lite->uri( $muri );- define the encoding
$s->encoding('ISO-8859-1');- this is the helper routine for constructing the document
import SOAP::Data 'name';- build up the request document
my @parms = ( name( 'PROGRAM'=> "SAPLGRAP" ), name( 'QTAB'=> \name(item => \name( LINE => ""))) );
my $methname = 'RFC_READ_REPORT';
my $meth = $namespace.$methname;
my $element = $methname.'.Response';- show the serialized document
$sr = $s->serializer->autotype(0)->readable(1)->method( $namespace.'RFC_READ_REPORT' => @parms );
print "RFC_READ_REPORT SOAP: $sr\n";- do the call
my $som = $s->uri($muri)->proxy("http://$user:$pass\@$hostname:8000/sap/bc/soap/rfc")->$meth( @parms );- show the contents of QTAB
print "//Envelope/Body/$element/QTAB \n";
print Dumper($som->valueof("//Envelope/Body/$element/QTAB/item/*"));
</pre>
<br/>
The output produced is:
RFC_READ_REPORT SOAP:
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"