cancel
Showing results for 
Search instead for 
Did you mean: 

crypted data while reading communication channel

Former Member
0 Kudos

Hi All,

I am trying to read communication channel values using communication channel webservice. The program works fine, however the adapter specific values that I receive from the program are unreadable.

Program:

public static void main(String[] args) {
 
  DirApiReadCommChannel directory = new DirApiReadCommChannel();
  List<CommunicationChannelType> cc = directory.readCommunicationChannelIn(directory.queryCommunicationChannelIn());
 
 
  System.out.println("CommunicationChannels:");

  for (int i = 0; i < cc.size(); i++) {
   // display id
   System.out.println(i);
   System.out.println(cc.get(i));
   System.out.println(cc.get(i).getAdministrativeData());
   System.out.println(cc.get(i).getDescription());
   System.out.println(cc.get(i).getDirection());
   System.out.println(cc.get(i).getAdapterSpecificAttribute());
   System.out.println(cc.get(i).getAdapterSpecificTableAttribute());
   System.out.println(cc.get(i).getModuleProcess());
   System.out.println(cc.get(i).getTransportProtocol());
   System.out.println(cc.get(i).getAdapterMetadata());
   System.out.println("-----------------------------------------------------------------------------------");
  }

Output:

-----------------------------------------------------------------------------------

1

com.sap.xi.basis.CommunicationChannelType@18a9fc8

com.sap.xi.basis.ObjectAdministrativeDataType@197436b

[com.sap.xi.basis.global.LONG_DescriptionType@1cb5cfc]

RECEIVER

[com.sap.xi.basis.GenericPropertyType@45b098, com.sap.xi.basis.GenericPropertyType@14cdfcf]

com.sap.xi.basis.ModuleProcessType@8f474f

HTTP

com.sap.xi.basis.DesignObjectIDType@92b39f

-----------------------------------------------------------------------------------

2

com.sap.xi.basis.CommunicationChannelType@9bad5a

com.sap.xi.basis.ObjectAdministrativeDataType@18a577d

RECEIVER

[com.sap.xi.basis.GenericPropertyType@175deb1, com.sap.xi.basis.GenericPropertyType@16f6a81]

[com.sap.xi.basis.GenericPropertyTableType@1ebec47, com.sap.xi.basis.GenericPropertyTableType@1e5348f, com.sap.xi.basis.GenericPropertyTableType@ddb2e7]

com.sap.xi.basis.ModuleProcessType@10c624a

File

com.sap.xi.basis.DesignObjectIDType@90067

Please Advice.

Accepted Solutions (1)

Accepted Solutions (1)

anandvithal
Active Participant
0 Kudos

Hi Vicky,

Your for loop should look like this

for (int i = 0; i < cc.size(); i++)

{
   // display id
   //System.out.println(i);
   //System.out.println(cc.get(i));
   System.out.println("Responsible = "+cc.get(i).getAdministrativeData().getValue().getResponsibleUserAccountID().getValue());

   System.out.println("Changed by = "+cc.get(i).getAdministrativeData().getValue().getLastChangeUserAccountID().getValue());


   System.out.println("Description = "cc.get(i).getDescription().get(0).getValue().getValue());


   System.out.println("Direction = "+cc.get(i).getDirection().getValue());


    for(int j=0;j<cc.get(i).getAdapterSpecificAttribute().size();j++)

     {

          System.out.println("Name="+cc.get(i).getAdapterSpecificAttribute().get(j).getName().getValue();

          System.out.println("Value="+cc.get(i).getAdapterSpecificAttribute().get(j).getValue().getValue();

     }

  

   System.out.println("TP="+cc.get(i).getTransportProtocol().getValue());
   System.out.println("Adapter type= "+cc.get(i).getAdapterMetadata().getValue().getName().getValue());
   System.out.println("-----------------------------------------------------------------------------------");
}

Message was edited by: Anand V D

Former Member
0 Kudos

Thanks Anand. I was able to pull all the required values following your suggestion.

Next thing if you could guide me is how to write all these values to an excel.

what files do i need to import. I have imported:

/*import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Map;
import java.lang.Object;
import java.util.Set;
import java.io.File;
import java.util.Date;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;*/

When I try to populate the excel cells with:  cell.setCellValue((String) cc.get(i)). I get an error saying cannot convert List<CommunicationChannelType> to String.

Thanks.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Vicky,

you print the internal object reference, not the text value of the objects. Anand's approach is the way to go.

Regards,

Jörg

Former Member
0 Kudos


Thanks Jorg,

any suggestions on how to update adapter specific table attributes from excel to PI. Though I do see methods for other features in PI like setadaptermetadata, set direction. I do not see any method for setting adapter specific table attributes.

Please advice.