cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI empty file to proxy scenario

Former Member
0 Kudos

Hi experts,

I have to build an empty file to proxy scenario.

in my CC Sender File I use 'File Content Conversion' as message protocol. But my inbound file is empty, so I have an error in sxi_monitor :

Problem while determining receivers using interface mapping: Error while determining root tag of XML: BOM / charset detection failed


I want change my CC SenderFile and use 'File' as message protocole, but i don't how define receiver determination without interface determination.


Is it possible ?


Thanks

Accepted Solutions (1)

Accepted Solutions (1)

engswee
Active Contributor
0 Kudos

I'm a little late to this conversation but here are my thoughts. But before that, it would be useful if you specify your PI version and whether it is on single stack or dual in your queries - it affects the solution that others offer.

Note that you will need ESR objects for this, so here it goes (take particular note those items highlighted in red):-

i) Define source data type (for sender file) with single dummy field occurrence 0-1

ii) Define target data type (for receiver proxy) with single dummy field occurrence 1-1

iii) Create all the necessary Message Type, Service interface for sender and receiver

iv) Create message mapping - Map a constant of any value to the target dummy field

v) Create operation mapping

vi) Configure all the necessary objects in Integration Directory (either classical scenario or ICO/iFlow)

- Make sure for your sender agreement, receiver determination that you do not specify the SWCV for the sender interface (this is to prevent it from performing XML parsing on the empty file)

viii) For your sender File comm channel, make sure Empty File Handling = Process Empty File

That is it. The source system can give you an empty file and you don't need a UDF to write the filename.

I have something like this that works, but on a slightly different scenario - on the response portion of an outbound sync interface, the response payload is empty but I have to return a status field to the calling proxy. So I just created a mapping with a constant mapped to the status field.

Rgds

Eng Swee

Former Member
0 Kudos

Hi,

Yes that's what i've done.

It's OK when my communication sender file uses NFS protocol.

But when my communication sender file uses FTP protocol, I have this error in the monitor :

Error when determining the receiver: Problem while determining receivers using interface mapping: Error while determining root tag of XML: BOM / charset detection failed


my CC sender file is defined like this :


Any ideas ? What if I change the file type (ASCII or UTF...)

Former Member
0 Kudos

Sorry it's OK now.

I have made a new export from dev to qual (where I have my problem) and finally it's OK.

Thanks all for your help !

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

I have tested this solution.

Problem is my inbound file is empty, so proxy doesn't accept empty XML.

I can't change inbound file, it come's from an external service.

How can I call proxy with a value (constant or anything else) with an empty inbound file ?

Former Member
0 Kudos

Hi Guz,

Just add another field to your proxy structure may be file name and use the file name from source. That should help in calling the proxy

Regards,

Sriram

Former Member
0 Kudos

OK but in this case I have to use a message mapping no ?

But in my message mapping  my inbound file will be empty so I will have an error in monitor

Former Member
0 Kudos

Hi Guz,

The empty file handling should be in your channel where in it creates an XML message despite having a blank payload and then there has to be a UDF for picking the filename and ampping it onot the receiver structure.

Rgds,

Sriram

RaghuVamseedhar
Active Contributor
0 Kudos

Guz,

Your inputFile.txt is always in empty.

Solution 1:- Sender file channel will pick inputFile.txt and additional attachment file myPayload.txt. Create a myPayload.txt (it will have XML required to call the proxy) and place input folder. Use payload swap bean in sender channel to swap to myPayload.txt.

No mapping is required.

Challenge is to create the myPayload.txt every time. I am still thinking about this.

FYI.

Specifying Additional Files in the Sender File Adapter - Advanced Adapter Engine - SAP Library

Adding PayloadSwapBean in the Module Processor -  Adding Modules to the Module Processor - SAP Libr...

Solution 2:-

If you can request source system to send at least one character in inputFile.txt. Because, empty file will not execute any mapping.

Then implement below Java mapping. More info, ESR object, Java mapping.


package com.map;

import java.io.*;

import com.sap.aii.mapping.api.*;

public class Test_JavaMapping extends AbstractTransformation {

  public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException {

  try { 

             OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream(); 

             //Write a XML required by proxy to output. Change below XML to required XML. We are ignoring input.

             outputstream.write("<?xml version='1.0' encoding='UTF-8'?><note><to>ABCD</to></note>".getBytes()); 

         }  catch (Exception exception) {

  getTrace().addDebugMessage(exception.getMessage());

  throw new StreamTransformationException(exception.toString());

  }

  }

}

RaghuVamseedhar
Active Contributor
0 Kudos

Guz,

I understand, you want to develop a pass-through asynchronous file-to-proxy scenario. Input file is always empty, it will just trigger the interface (to call the proxy).

Solution:- ESR objects are optional. If you want to create receiver service interface for proxy in ESR, you can create it. No mapping is required.

Configure ID objects. Use ICO or Sender agreement (with dummy sender service interface), Receiver determination, Interface determination (no mapping) and Receiver agreement.

Link, Link2

I am not clear on, how proxy will be called with empty XML. I would suggest using a fixed XML input file, which will trigger the proxy.

Former Member
0 Kudos

Hi,

I have tested this solution.

Problem is my inbound file is empty, so proxy doesn't accept empty XML.

I can't change inbound file, it come's from an external service.

How can I call proxy with a value (constant or anything else) with an empty inbound file ?

Former Member
0 Kudos

Yes it is possible..using Classic XI scenario..Just have a dummy field in the source message structure. Map parent nodes of Source XML to Target XML..or use ICO without any ESR content

iaki_vila
Active Contributor
0 Kudos

Hi Guz,

This exception is generated because at mapping level the message can't be interpreted like XML and the PI thinks that is binary but the charset is pointing that it must be an XML.

You can try with:

- Select the option Skip Empty Files under Handling of Empty Files

- If the message is not really empty but it is a big file, then probabbly the is not written when the PI polls and pick it. The you can use Msecs to Wait Before Modification Check under Define Additional Parameters

Regards.

Former Member
0 Kudos

I always have an empty file at inbound, it's normal.

This file just enable me to call CC Receiver XI adapter as outbound.

But I don't know how to build my scenario...

Former Member
0 Kudos

Hi Guz,

If i understand, you receive an empty file from sender and want to send a blank payload to the receiver. Please confirm if this understanding is correct?

Regards,

Sriram

Former Member
0 Kudos

Yes, that's it.

My empty file just enable me to call an XI receiver in outbound.

It's possible ?

iaki_vila
Active Contributor
0 Kudos

Hi Guz,

Why are you using FCC is you have always an empty file?, move the file without ESR development: SAPTechnical.COM - File-to-File Scenario without creating Repository Objects

Regards.

Former Member
0 Kudos

Yes, this is what i want, thanks.

it's possible to do this  with file-to-proxy scenario without creating repository objects i suppose ? My Receiver is a XI adapter.

Former Member
0 Kudos

If u r using ICO then use SOAP with XI(Proxy) on receiver..It will work

iaki_vila
Active Contributor
0 Kudos

Hi Guz,

I haven't tried it but from my point of view the inbound proxy needs a real service interface and to do a file to proxy scenario seems to be impossible, at least for my understanding.

You can do a file to file without ESR and a report in the ECC endpoint that polls the file system in a job.

Try first

Regards.

Message was edited by: Iñaki Vila

Former Member
0 Kudos

Hi Guz,

For Proxy at the receiver end, you will need ESR objects..However the development will be very less..You can just create one field

Just try out..Let us know in case of any issues

Regards,

Sriram

Former Member
0 Kudos

OK I will try.

Thanks

Former Member
0 Kudos

Hi Guz,

You need to select the option to Create message for Empty file under Processign tab. Once this is done a file will be generate and you need to adjust it in your mapping by mapping the parent node appropriately.

Regards,

Sriram

che_eky
Active Contributor
0 Kudos

Are you transforming the file between the sender and receiver adapters? If not then you don't need to use file content conversion, this will solve your problem.

Do you need to transform the file AND handle an empty files?

Che

Former Member
0 Kudos

No I don't have to transforming the inbound file, he's always empty.

the inbound empty file is simply used for call a proxy on SAP ECC.

But I don't know how to build my scenario..

Do I need interface determination ?

Former Member
0 Kudos

Hi Ruz,

Use ASMA to read file name if you want to..Map that file name onto the target structure using Dynamic config... This will send the blank file with file name to SAP through Proxy...

Let me know in case of any queries

Regards,

Sriram

Former Member
0 Kudos

No its not my problem :

I have a CC Sender file adapter with an empty file as inbound.

I have a CC Receiver XI adapter as outbound.

I don't know how to build my scenario..