cancel
Showing results for 
Search instead for 
Did you mean: 

RFC problem: could not get functionname from XML requst (sic)

Former Member
0 Kudos

I'm developing an interface that attempts to call a receiver RFC on an SAP 4.6c system. It's a very small simple interface, and it's all working until it tries to call the RFC. The error is

Exception caught by adapter framework: error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: could not get functionname from XML requst: com.sap.aii.af.rfc.RfcAdapterException: failed to read funtionname from XML document: missing namespace declara

I've created an RFC channel, which is green in the adapter monitoring. The RFC imports without a problem, and appears in my interface mapping. My mapping program converts to the RFC message type (as evidenced in sxmb_moni. I have a receiver agreement referencing the interface mapping, which must be working as the mapping is called.

Could anyone point me to what else I could check? I saw a post about the same error message, where the respondent found something in the logs which helped them Could you expand on what you found, and in which log please? Any pointers as to which logging options I could switch on and check would be gratefully received.

Regards

Alan Graham

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

This is for the benifit of users who are doing RFC Lookup via the mapping lookup API and are getting the below error then check that the XML string for the RFC XML is created in one line in the UDF.

If not then you will get the error as below.

Error in processing caused by: com.sap.aii.af.rfc.afcommunication.RfcAFWException: error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: could not get functionname from XML requst: com.sap.aii.af.rfc.RfcAdapterException: failed to read funtionname from XML document: missing namespace declaration(1)

Former Member
0 Kudos

Thanks for the responses.

I set up a communications channel of type RFC, which is

showing green in the adapter monitor. If I deliberately

break it, eg by changing the password, the adapter shows

as red in the monitor. I assume therefore that the

adaptor settings are correct.

The XML going to the adapter looks correct AFAIK. My problem is that I don't know enough about the requied XML to know if what I'm seeing in the logs is sufficient. In SXMB_MONI, in the 'call adapter' section of a failed message, the outbound binding includes

<SAP:ToInterfaceNamespace>urn:sap-com:document:sap:rfc:functions</SAP:ToInterfaceNamespace>/code]

Also, the interface determination SOAP header, in the MAIN section includes
[code]<SAP:Receiver>
  <SAP:Party agency="" scheme="" /> 
  <SAP:Service>D04</SAP:Service> 
  <SAP:Interface namespace="urn:sap-com:document:sap:rfc:functions">Z_MPU_3PSCE_FREIGHT_UPLOAD</SAP:Interface> 
  </SAP:Receiver>

These are the correct values for the RFC name and the namespace, AFAIK.

I'm using an interface mapping (which uses and ABAP class as the mapping program) which references the interface of the RFC. The logs tell me this works, ie, the class is called and the resulting XML appears in the payload of the response.

Alan

Former Member
0 Kudos

Hi,

Can you please post your Message Payload what is sending to the RFC- Communication Channel.

it has to look like this (example):

<ns0:<i>Z_TESTFUNCTION</i> xmlns:ns0="urn:sap-com:document:sap:rfc:functions">
<I_DATA1>TEST<I_DATA1>
<I_DATA2>My Data<I_DATA2>
</ns0:<i>Z_TESTFUNCTION</i>>

in this example the I_DATA1 and I_DATA2 are the input parameters of the RFC Function Z_TESTFUNCTION.

Regards,

Robin

Former Member
0 Kudos

That's interesting. Are you saying that the mapping program

has to add the function name?? I ask that because the payload

of all of the messages shown in SXMB_MONI, after the mapping,

have the same content, as follows;

  <?xml version="1.0" encoding="utf-8" ?> 
- <invoice number="HON0514782">
  <ebeln>4500139285</ebeln> 
  <ebelp>00000</ebelp> 
  <kawrt>35.4</kawrt> 
  <wmwst>1.77</wmwst> 
  <lfsnr>HON0514782</lfsnr> 
  <sgtxt>PO#: 4500139285</sgtxt> 
  <budat>2006-01-05</budat> 
  <tr_num>139285</tr_num> 
  </invoice>

This is exactly what my ABAP class produces. The particular

example above I cut and pasted from the 'Call Adapter' message

in SXMB_MONI, payload section.

What should be providing the "<ns0:" declaration? I assumed

it would be derived by XI from the fact that the interface

is an RFC?

Thanks for your help Robin

Alan

Former Member
0 Kudos

Robin, you solved it! I hadn't realised that the XMl payload from my mapping program

had to reference the RFC directly. I changed the simple transform that my abap class was

using to produce XML like the sample you posted, and voila!

I still think there must be a better way, it seems crazy to tightly couple the mapping program

to the RFC like this. However, there's a number of things in XI that seem crazy to me.

I'm trying to allocate the points to you now

Former Member
0 Kudos

Hi Alan,

Normally you have as Target Interface the Imported Structure of the RFC/BAPI.

And you have to map you Content in this Structure.

Than you have always the right Structure.

But its also possible to map for RFC Adapter without importing the RFC... but than you have to take care that you map your Structure correct.

I always try to be helpfull

Regards,

Robin

Former Member
0 Kudos

Hi Alan,

How looks the XML Messages what goes to the Adapter?

Do you use a Mapping ?

Take a look of the root tag of the XML Message if you set the namespace correctly.

for example:

<ns0:Z_TEST_INPUT xmlns:ns0="urn:sap-com:document:sap:rfc:functions">

Regards,

Robin

Former Member
0 Kudos

Hi,

Check the RFC destination between the two systems. Also in the receiver adapter parameters like

App server

System Number

System ID...

etc..

Regards,

Sudharshan