The service enables you to create a new external group based on an existing database connection.
The remote database must contain at least 2 columns with the names "Email" and "RemoteUserID". The column "RemoteUserID" must be of type int.
Java Code:
//get a reference to the service InwiseWebServices ws = new InwiseWebServices();
InwiseWebServicesSoap inwiseWebServicesSoap = ws.getInwiseWebServicesSoap();
//fill the security header
HeaderHandler hh = new HeaderHandler("myusername", "myPassword");
hh.setHeader(inwiseWebServicesSoap);
//the id of the database connection from our system
int dbid = 1;
//the display name for the new group
String groupName="external group 44";
//the name of the table in the remote database in the recipients are
String remoteTableName="tableName";
//the mapping between the remote table name and the custom fields of your recipients on our system
inwise.ArrayOfExternalFieldsMappings mappings=new ArrayOfExternalFieldsMappings();
mappings.externalFieldsMappings=new ArrayList<ExternalFieldsMappings>();
ExternalFieldsMappings map1=new ExternalFieldsMappings();
map1.setLocalFieldId(1);//string field
map1.setRemoteFieldName("first_name");//the name on the remote table
mappings.externalFieldsMappings.add(map1);
ExternalFieldsMappings map2=new ExternalFieldsMappings();
map2.setLocalFieldId(28);//int field
map2.setRemoteFieldName("age");//the name on the remote table
mappings.externalFieldsMappings.add(map2);
//call the operation
int newGroupID = inwiseWebServicesSoap.groupsExternalCreateGroup(dbid, groupName, remoteTableName, mappings);
C# Code:
//get a reference to the service
InwiseWebServices.InwiseWebServices ws = new InwiseWebServices.InwiseWebServices();
//fill the security header
InwiseWebServices.SecHeader header = new InwiseWebServices.SecHeader();
header.username = "username";
header.pass = "myPassword";
ws.SecHeaderValue = header;//set credentials
//the id of the database connection from our system
int dbid = 1;
//the display name for the new group
string groupName="external group 1";
//the name of the table in the remote database in the recipients are
string remoteTableName="tableName";
//the mapping between the remote table name and the custom fields of your recipients on our system
InwiseWebServices.ExternalFieldsMappings[] mappings=new InwiseWebServices.ExternalFieldsMappings[2];
mappings[0] = new InwiseWebServices.ExternalFieldsMappings();
mappings[0].LocalFieldId = 1;//string field
mappings[0].RemoteFieldName = "first_name";//the name on the remote table
mappings[1] = new InwiseWebServices.ExternalFieldsMappings();
mappings[1].LocalFieldId = 28;//int field
mappings[1].RemoteFieldName = "age";//the name on the remote table
//call the operation
int newGroupID = ws.Groups_External_CreateGroup(dbid, groupName, remoteTableName, mappings);
VB Code:
'get a reference to the service
Dim ws As InwiseWebServices.InwiseWebServices = New InwiseWebServices.InwiseWebServices()
'fill the security header
Dim header As InwiseWebServices.SecHeader = New InwiseWebServices.SecHeader()
header.username = "username"
header.pass = "myPassword"
ws.SecHeaderValue = header 'set credentials
'the id of the database connection from our system
Dim dbid As Integer = 1
'the display name for the new group
Dim groupName As String = "external group 1"
'the name of the table in the remote database in the recipients are
Dim remoteTableName As String = "tableName"
'the mapping between the remote table name and the custom fields of your recipients on our system
Dim mappings() As InwiseWebServices.ExternalFieldsMappings = New InwiseWebServices.ExternalFieldsMappings(2) {}
mappings(0) = New InwiseWebServices.ExternalFieldsMappings()
mappings(0).LocalFieldId = 1 'string field
mappings(0).RemoteFieldName = "first_name" 'the name on the remote table
mappings(1) = New InwiseWebServices.ExternalFieldsMappings()
mappings(1).LocalFieldId = 28 'int field
mappings(1).RemoteFieldName = "age" 'the name on the remote table
'call the operation
Dim newGroupID As Integer = ws.Groups_External_CreateGroup(dbid, groupName, remoteTableName, mappings)