View source | Discuss this page | Page history | Printable version   

Module:SAP ECC SOAP Communication/Developers Guide/How To Import And Export iDocs

Introduction

In this document is described how to use the SAP ECC SOAP Communication module for interchanging iDocs between Openbravo and a SAP Server.

Exporting IDocs

The first step to enable the IDoc exportation from Openbravo to SAP is to develop a consumer for the SOAP web service that exposes the operation to export the IDocs into SAP.

To define and configure this consumer, we need to develop a class that extends the SAPExportClient class. For example:

 
public class IDocExportClient extends SAPExportClient<IDocExportService> {
 
  public IDocExportClient(SOAPConfiguration configuration) {
    super(configuration);
  }
 
  @Override
  protected void export(IDocExportService service, Map<String, String> iDocsToExport) {
    // Call the service operation that exports the iDocs
    iDocsToExport.entrySet()
        .stream()
        .forEach(iDoc -> service.invoke(iDoc.getKey(), iDoc.getValue()));
  }
 
  @Override
  protected SOAPClient<IDocExportService> getSOAPClient(SOAPConfiguration soapConfiguration) {
    IDocSOAPExporter consumer = new IDocSOAPExporter(getIDocExportServiceImpl());
    consumer.configure(soapConfiguration);
    return consumer;
  }
 
  private IDocExportService getIDocExportServiceImpl() {
    // return the implementation of the IDocExportService
  }
}
 
 
  class IDocSOAPExporter extends SOAPClient<IDocExportService> {
 
    IDocSOAPExporter() {
      super(new IDocExportService().getPort());
    }
 
    void configure(SOAPConfiguration soapConfiguration) {
      // Configure the client 
      // The SOAPConfiguration parameter can be used to get the AD configuration data
      Map<String, Object> requestData = new HashMap<>();
      requestData.put(BindingProvider.USERNAME_PROPERTY, soapConfiguration.getMyUserField());
      requestData.put(BindingProvider.PASSWORD_PROPERTY, soapConfiguration.getMyPassField());
      setRequestData(requestData);
    }
  }

Some notes about the previous code:

The second step consist of registering our SAPExportClient class into the Application Dictionary. This is done by creating a SOAP configuration into the Communication with SAP ECC Server window:


CommunicationWithSAPSOAP.png


In the header:

In the SOAP Configuration tab:

Note the SOAP Configuration tab is the place to add additional configuration settings (like HTTP basic credentials). This can be done by adding new fields into this tab. The value of this new fields can be retrieved in the getSOAPClient method of our SAPExportClient as explained above.

Importing IDocs

For importing IDocs coming from SAP into Openbravo a SOAP web service is exposed by default at:

<openbravo_url>/org.openbravo.base.cxf/sapImportService?wsdl


Idocws.png

This web receives an IDoc that is processed asynchronously using the default SAP import process.

See here to find a guide that explains how SOAP web services can be consumed.

Retrieved from "http://wiki.openbravo.com/wiki/Module:SAP_ECC_SOAP_Communication/Developers_Guide/How_To_Import_And_Export_iDocs"

This page has been accessed 1,187 times. This page was last modified on 1 August 2019, at 11:11. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.