on 2006 Mar 14 8:27 PM
Hi Everybody,
I just wanna publish in a quick form my experiences about calling a webservice on a WebAS 6.20 via Pear SOAP 0.9.3. We have our own RFC enabled function module with this interface:
*" IMPORTING
*" VALUE(PARTNER) LIKE BUT000-PARTNER
*" VALUE(PLZ) TYPE PSTLZ_BAS
*" VALUE(CAMPAIGN) TYPE CGPL_EXTID
*" EXPORTING
*" VALUE(E_GREETING_LINE) TYPE ADRS_PRINT-LINE0
*" VALUE(SURVEYURL) TYPE BSP_URL
*" VALUE(RETURN) TYPE BAPIRET2
*" TABLES
*" SALESREPS STRUCTURE ZBP_NAME_ATTR
Before I came to this interface I had the RETURN Parameter also as a table. The problem was that if I had more than one table I didn't get any data of the second table. So I've tried around and found that with only one table it works. Perhaps someone had already the same problem and found another solution?
Regards
Gregor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gregor,
are you sure you mean Rel. 6.20??
to my knowledge SOAP support in 6.20 was not really mature and only some extension to the CL_HTTP_.. classes (no soap runtime at all).
Courious I just opened a 6.20(wow, they seem to be at SP56 already ) system and didn't find anything of the stuff used for webservices today, no wsconfig, no wsadmin, no lpconfig...only some old example of mine where i 'manually' filled a httpclient object with soap stuff.
regards,
anton
Hi Craig,
the exact Service Packs are:
SAP_BASIS 620 0047 SAPKB62047
SAP_ABA 620 0043 SAPKA62043
BBPCRM 400 0007 SAPKU40007
PI_BASIS 2003_1_620 0007 SAPKIPYH57
WP-PI 600_620 0000 -
BP-BLCR 400V3 0000 -
SAP_WPDRMD 620 0002 SAPKQDR902
I will post tomorrow the WSDL, Request and Response.
Regards
Gregor
hi Gregor,
I am a bit puzzled. I'm playing around a lot with webservices on ABAP but i don't understand how it should work (out of the box) on 6.20. On the system I have available (which is properly set up) I don't find any known stuff. I did look for the WEBSERVICEBROWSER and was surprised to fond it too(btw it's been created in 2001 already). But it doesn't show a single webservice to me (or a webservice-o-fied RFC).
Sorry that i can't help,
anton
Hello Anton,
try to write a simple RFC Enabled Function Module i.e. Z_HELLO with a Input parameter NAME and a Output parameter GEETING. Activate this module and open the Webservice Browser. Click on the Letter Z and you will see that function module in the list. On the right hand side you find a link to the WSDL which you can open and save to disk.
Regards
Gregor
hi there,
set up a little test scenario using
- WAS 6.40
- PHP 5.1.1, standard soap library
to demonstrate a service having
- an input string
- an output string
- two TABLES tables
- one EXPORTING table
Here are the codings in ABAP for the service and in PHP for the client respectively:
*"----
-
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(INSTRING) TYPE STRING
*" EXPORTING
*" VALUE(OUTSTRING) TYPE STRING
*" VALUE(TABLENO3) TYPE BAPIRET2_T
*" TABLES
*" TABLENO1 TYPE BAPIRET2_T
*" TABLENO2 TYPE ZTW_TABLE_OF_STRINGS
*"----
-
data: lt_errors type bapiret2_t,
ls_error like line of lt_errors,
lt_strings type ztw_table_of_strings,
ls_string like line of lt_strings.
ls_error-type = 'I'.
ls_error-ID = 'TEST'.
ls_error-number = '815'.
ls_error-message = 'This is an info returned!'.
append ls_error to tableno1.
ls_error-type = 'E'.
ls_error-ID = 'TEST'.
ls_error-number = '711'.
ls_error-message = 'This is an error returned!'.
append ls_error to tableno1.
ls_string-sometext = 'Some string'.
append ls_string to tableno2.
ls_error-type = 'E'.
ls_error-ID = 'TEST'.
ls_error-number = '555'.
ls_error-message = 'This is an error returned!'.
append ls_error to tableno3.
concatenate 'ECHO: ' instring into outstring.
ENDFUNCTION.[/code]
$wsdlurl ="http://tonysub:8000/sap/bc/srt/rfc/sap/ZTW_TABLES2?sap-client=100&wsdl=1.1";
$login = "bcuser";
$password = "minisap";
function maketable($node) {
echo '';
foreach($node as $key0 => $ra1) {
foreach($ra1 as $key1 => $ra2) {
if (is_array($ra1)) {
if ($key1 == 0) {
echo '';
foreach($ra2 as $key => $ra3) {
echo '';
}
echo '';
}
echo '';
foreach($ra2 as $key => $ra3) {
if ($ra3 == "") $ra3=" ";
echo "";
}
echo '';
}
else {
if ($key0 == 0) {
echo '';
foreach($ra1 as $key => $ra2) {
echo '';
}
echo '';
}
echo '';
foreach($ra1 as $key => $ra2) {
if ($ra2 == "") $ra2=" ";
echo "";
}
echo '';
}
}
}
echo '
' . $key . ' |
" . $ra3 . " |
' . $key . ' |
" . $ra2 . " |
';
return;
}
$client = new SoapClient($wsdlurl,
array('login' => $login,
'password' => $password,
'trace' => true,
'exceptions' => true));
try {
$ra = $client->ZtwTables2(array(
'Tableno1' => array(
'item' => array(
'Type' => 'I',
'Id' => 'REMOTE',
'Number' => '999',
'Message' => 'Tables Test No.2',
'LogNo' => '',
'LogMsgNo' => '',
'MessageV1' => '',
'MessageV2' => '',
'MessageV3' => '',
'MessageV4' => '',
'Parameter' => '',
'Row' => '',
'Field' => '',
'System' => ''
)),
// 'Tableno2' => array(
// 'item' => array(
// 'Sometext' => 'Input String'))
'Tableno2' => array(),
'Instring' => 'Hello World!'
));
maketable($ra->Tableno1);
echo '
';
maketable($ra->Tableno2);
echo '
';
maketable($ra->Tableno3);
echo '
';
echo $ra->Outstring;
}
catch (SoapFault $e) {
echo 'Caught an Error: - ' . $e->faultstring;
}
echo "
";
echo "Request :
".htmlspecialchars($client->__getLastRequest()) ."
";
echo "Response:
".htmlspecialchars($client->__getLastResponse())."
";
echo "
";
?>[/code]
Everything works like a charm.
I have explicitely created a webservice instead of using the automatic webservice exposure of RFC FMs. Maybe latter is causing an insufficient or wrong WSDL.
Haven't checked that yet since I cant get BSP running on my home NW installation due to the well-known but nevertheless stupid FQDN problem.
I'll try to test this same scenarion on a 6.20 system later.
BTW, this post might help a newbie to get familiar with how to use arrays('tables') in PHP )
regards,
anton
Message was edited by: Anton Wenzelhuemer reformatting
Message was edited by: Anton Wenzelhuemer
Hi Anton,
can you tell me how you defined your Table Type ZTW_TABLE_OF_STRINGS? When I use my own line type structure ZSTRING_STUCTURE with component TEXT from type string I can't activate my RFC enabled function module because I got the error "Only tables with simple line structure are allowed in RFC".
Regards
Gregor
User | Count |
---|---|
98 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.