Hi Dears,
I´ve implemented a Portal Component which contains a Portal Service that is responsable for connecting to our SAP SRM System. This Portal Service can be invoked through two different ways:
1 - The user Logs on our SAP Enterprise Portal and opens a custom Java IView which invokes the Portal Service.
2 - The user calls a Web Service available on the SAP WAS which invokes the Portal Service. This WebService has a Basic Authentication (Username/Password), which authenticates the user to the UME from the Enterprise Porta.l
The problem is that the RFC is working well only for the first scenario. The second scenario fails on command "IInteraction interaction = connection.createInteractionEx();"
See my code Below:
IConnection connection = null;
try {
IConnectorGatewayService cgService = (IConnectorGatewayService) PortalRuntime.getRuntimeResources().getService(IConnectorGatewayService.KEY);
ConnectionProperties prop = new ConnectionProperties(taxNumberBean.getLocale(), taxNumberBean.getPrincipal());
try {
connection = cgService.getConnection(ALIAS_SRM, prop);
} catch (ConnectorException e) {
taxNumberBean.setIsErro(true);
taxNumberBean.setDetalheErro("Erro ao pegar connection(1): " + e.getMessage());
taxNumberBean.setIsCnpj(false);
} catch (NoLogonDataAvailableException e) {
taxNumberBean.setIsErro(true);
taxNumberBean.setDetalheErro("Erro ao pegar connection(2): " + e.getMessage());
taxNumberBean.setIsCnpj(false);
}
try {
String fmName = "YPNFE_GET_TAXNUMBER_FROM_USER";
IInteraction interaction = connection.createInteractionEx();
IInteractionSpec interactionSpec = interaction.getInteractionSpec(); <<---Error occurs here
interactionSpec.setPropertyValue("Name", fmName);
IFunctionsMetaData functionsMetaData = connection.getFunctionsMetaData();
IFunction function = functionsMetaData.getFunction(fmName);
RecordFactory recordFactory = interaction.getRecordFactory();
MappedRecord importParams = recordFactory.createMappedRecord("input");
importParams.put("USERNAME", taxNumberBean.getUserName());
MappedRecord exportParams = (MappedRecord) interaction.execute(interactionSpec, importParams);
How can I solve this problem?
Best Regards,