Saving a copy of XML file before transmitting

We are using SAP Business connector 4.6 to map an IDOC from SAP to customer XML format.
Is there a way to save a copy of XML files before or after transmitting through http post? If there is, please let me know how I can do it. I cannot seem to find it in the documentation for Business connector.

Thanks,
Roger

You can send the XML through the Partner Manager for persisting and routing to a delivery service that you write.

Rob,
As always thanks for your reply.

I am routing the IDOC to a flow service where I map the IDOC to customer XML format and post it to a http site. How and where can I save a copy of the XML file? Please advise.

Thanks,
Roger

Roger,

If you want to write the file to the disk, use services in the pub.io folder and if you want to write it to the DB, use the adapter services.

ramesh.

Roger,

It sounds like you already have the XML string and just want to see how to write it to a file, is that right?

If so, there is a the PSUtilities package, which can be downloaded from Advantage, contains a sample java service called PSUtilities.file:writeToFile that should get you started. Note that for security reasons, their writeToFile service checks a properties file to ensure that the user has rights to write to the specific directory first.

You need to update the properties file psutilities.cnf in the config folder to add your target path to the allowedWritePaths property. You can also remove or disable the code that checks this property, but be sure you understand the security risk before you do so.

Mark

Roger:

If you simply need to save off a copy of what get’s sent, then the suggestions from ramesh and Mark will do nicely. Be aware that you’ll need to pay attention to disk space if you simply write it to local disk, depending on your message volumes and the size of your server’s disk.

If you want a bit more capability, you can use Partner Manager.

It’s been a while since I’ve worked with BC so I may be mixing things from that and the wM SAP Adapter but I believe the overlap is significant.

Under the covers, the BC components use a package named WmPartners. This is the tool that provides the routing based on routing rules you set up. In the service the does your IDoc translation, instead of doing the HTTP post directly, pass the XML string to the appropriate service in the WmPartners package. There is documentation for this in the <integration>/packages/WmPartners/pub/doc directory.

Set up another rule for the right sender & receiver & this document type. Configure the rule to invoke a new service that you write (containing the parts of your existing service that does the http post) to send the document to the partner.

By following this approach you get all the facilities of WmPartners for your XML document (saving to the message store, dynamic routing, etc.).

Ramesh, Mark and Rob,
Thank you all for your replies. I will start off looking at pub.io option. XML files that I am sending are very small.

Thanks,
Roger