on 11-01-2016 6:02 PM
I tried to implement a (now simplified) version of the Netweaver sdk rfc server example.
But I don't even get the error messages right, and no connect. Something must be fundamentally wrong, but I'm stumped. On that system, some components using the sdk work, so it's not impossible...
Here's my source:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sapnwrfc.h>
#include <sapuc.h>
#include <sapucx.h>
static int listening = 1;
int mainU(int argc, SAP_UC** argv){
RFC_RC rc;
RFC_FUNCTION_DESC_HANDLE UcTestDesc;
RFC_CONNECTION_PARAMETER repoCon[8], serverCon[3];
RFC_CONNECTION_HANDLE repoHandle, serverHandle;
RFC_ERROR_INFO errorInfo;
serverCon[0].name = cU("program_id");
serverCon[0].value = cU("UCTEST");
serverCon[1].name = cU("gwhost");
serverCon[1].value = cU("hostname");
serverCon[2].name = cU("gwserv");
serverCon[2].value = cU("3303");
repoCon[0].name = cU("client"); repoCon[0].value = cU("100");
repoCon[1].name = cU("user"); repoCon[1].value = cU("username");
repoCon[2].name = cU("password"); repoCon[2].value = cU("password");
repoCon[3].name = cU("lang"); repoCon[3].value = cU("DE");
repoCon[4].name = cU("ashost"); repoCon[4].value = cU("hostname");
repoCon[5].name = cU("sysnr"); repoCon[5].value = cU("03");
printfU(cU("Logging in..."));
repoHandle = RfcOpenConnection (repoCon, 6, &errorInfo);
if (repoHandle == NULL) {
printfU(cU("Code: %d\n"), errorInfo.code);
printfU(cU("Key: %s\n"), errorInfo.key);
printfU(cU("Msg: %s\n"), errorInfo.message);
} else {
RfcCloseConnection(repoHandle, &errorInfo);
}
printfU(cU(" ...done\n"));
return 0;
}
Here's the result:
Logging in...Code: 20
Key: R
Msg:
...done
Segmentation fault
So I don't even get the error messages output... then a segfault...
Here's how I compile:
gcc -v -I/usr/sap/nwrfcsdk/include -o minitest mini.c -L/usr/sap/nwrfcsdk/lib -lsapnwrfc -lsapucum && ./minitest
This is NW RFC Library Version: 721 Patch 39.
I tried under Debian 8.5 Kernel 3.16.0-4-amd64 and SLES 11 Kernel 3.0.101-0.7.17-default x86_64.
I tried with and without including the two unicode headers. Anyone an idea what goes wrong? (I still think the R might be the beginning of RFC_sth and this might be a unicode issue, but I didn't find any info on how this can be handled).
(Hm, previous answer missing, tagged code gets garbled on edit or new code insert, could it be this forum software isn't quite up to the task?)
So it was a unicode issue; helpful hints here: https://archive.sap.com/discussions/thread/68890
Would be nice to have a working unicode example somewhere. (Also would be nice if the docs could decide if the param's name was password or passwd). Anyhow, this problem is solved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.