cancel
Showing results for 
Search instead for 
Did you mean: 

RFCLookup in Java Mapping

Former Member
0 Kudos

Hello Gurus,

I'm performing a RFCLookUp in Java Mapping with PI 7.1 (I can't use a Message Mapping), the XML I use to do the request is:

<n:ZHRBAPINOMINA xmlns:n="urn:sap-com:document:sap:rfc:functions">

<PERNR>30</PERNR>

</n:ZHRBAPINOMINA>

The error i'm getting is:

error while processing the request to rfc-client: com.sap.aii.adapter.rfc.afcommunication.RfcAFWException:

error while processing message to remote system:com.sap.aii.adapter.rfc.core.client.RfcClientException: could not get functionname from XML requst:

com.sap.aii.adapter.rfc.RfcAdapterException: failed to read funtionname from XML document:

missing namespace declaration(2)

What could cause this error?

Thanks in advance.

Xavi.

Accepted Solutions (1)

Accepted Solutions (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

Fist my question to you why you are doing RFC Lookup using JAVA Mapping??PI7.1 we can peform using Graphical Function only,better to use built in future.Think about your design once again.

If you decided to use Java map only then how your calling RFC??,betetr to create receiver communication channel to make connection to the SAP System.call the receiver communication channel in JAVA Code.

Regards,

Raj

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Xavi,

The error which you r facing might come due to namespace conflict i.e The namespace used in the Integration repository(IR) may be different from the default value which comes while importing the RFC metadata to IR.Please use the dafulat namespace for RFCs and Idocs. Secondly if you r calling a BAPI or Function module then ensure that it is always Remote enabled .in R3 you can check whether it is remote enabled or not ?

Regards,

Saurabh

VijayKonam
Active Contributor
0 Kudos

How many times do you need to do this RFC look up? Just once? In that case, you can look at having 2 mapping programs. One for executing the RFC look up in the Graphical Mapping and then passing the actuall message and the RFC looked up value to the Java mapping.

Does that make any sense and applicable?

VJ

Former Member
0 Kudos

Hello Raj,

we are using a java mapping because we have to encript a pdf file with a password.

We are calling the adapter in the java mapping, see wha we are doing:

public static String RFCLookup( String sTabla , String sValue , String sName )

{

String sAux1;

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

DocumentBuilder builder;

factory.setNamespaceAware( false );

factory.setValidating( false );

XmlUtil xuUtil = new XmlUtil();

try

{

builder = factory.newDocumentBuilder();

}

catch( Exception e )

{

return "1";

}

Document docReq;

try

{

// Building up RFC Request Document

docReq = builder.newDocument();

//Element eOutputRoot = xuUtil.createNode( docReq, "ZHRBAPINOMINA" );

Node eOutputRoot = docReq.createElementNS("urn:sap-com:document:sap:rfc:functions", "ns:ZHRBAPINOMINA");

//eOutputRoot.setAttribute( "xmlns:ns1" , "urn:sap-com:document:sap:rfc:functions" );

eOutputRoot.appendChild( xuUtil.createNode( docReq , sValue , sName ) );

//eOutputRoot.appendChild( xuUtil.createNode( docReq , "TABLE_NAME" , sTabla ) );

docReq.appendChild( eOutputRoot );

}

catch( Exception e )

{

return "2";

}

// Lookup the

Payload result;

try

{

InputStream is = new ByteArrayInputStream( docReq.toString().getBytes() );

XmlPayload payload = LookupService.getXmlPayload( is );

trace.addWarning("traza 1 ");

result = accessor.call( payload );

trace.addWarning("traza 2 ");

if (result == null)

{

trace.addWarning("result of RFC call is null");

return "2.5";

}

}

catch( LookupException e )

{

//Close accessor

if( accessor != null )

{

try

{

accessor.close();

}

catch( LookupException ex )

{

trace.addWarning("Error during lookup1 - " + e);

return "3";

}

}

trace.addWarning("Error during lookup2 - " + e);

return "4";

}

// Parsing RFC Response Document

Document docRsp;

try

{

docRsp = builder.parse( result.getContent() );

}

catch( Exception e )

{

return "5";

}

return "6";

//return docRsp;

}

In the execute method we are claling the RFC adapter:

Channel channel = LookupService.getChannel( service, channelName );

accessor = LookupService.getRfcAccessor( channel );

We don't know why we have these errors, with old versions like XI 3.0 we didn't have errors.

Do you know what could be?

Many thanks.

Xavi.

Former Member
0 Kudos

Hello Neetesh,

the namespace we put at the RFCLookup is the same we can see at the RFC imported: urn:sap-com:document:sap:rfc:functions

Is a strange think, we tried to tes the RFC with a message mapping and runs successfully but when we do the RFCLookup we are obtaining this error.

Anybody knows what could be the error?

Many thanks.

Xavi.

Former Member
0 Kudos

HI Xavi,

com.sap.aii.adapter.rfc.RfcAdapterException: failed to read funtionname from XML document: missing namespace declaration(2)

Please make sure that the namespace defined in the IR is same as the default NS in the imported RFC.

Hope this helps.

Regards,

Neetesh