Вызов SOAP-службы Oracle GlInterface в .net Core

#oracle #.net-core #soap

#Oracle #.net-core #soap

Вопрос:

Ошибка: система.ServiceModel.Исключение FaultException`1[Служба.ServiceErrorMessage]: JBO-GL:::GL_INVALID_LEDGER: GL-781535 Вы ввели недопустимое значение регистра. (Информация о неисправности равна службе.ServiceErrorMessage).

результат только при поиске

         BasicHttpBinding basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
        basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
        EndpointAddress endpointAddress = new EndpointAddress(new Uri("https://fa-eosd-dev1-saasfaprod1.fa.ocs.oraclecloud.com:443/fscmService/JournalImportService?WSDL"));
        ChannelFactory<JournalImportService> factory = new ChannelFactory<JournalImportService>(basicHttpBinding, endpointAddress);

        factory.Credentials.UserName.UserName = "user";
        factory.Credentials.UserName.Password = "pass";
        JournalImportService serviceProxy = factory.CreateChannel();

        ((ICommunicationObject)serviceProxy).Open();

        var opContext = new OperationContext((IClientChannel)serviceProxy);
        var prevOpContext = OperationContext.Current; // Optional if there's no way this might already be set
        OperationContext.Current = opContext;

        importJournalsRequest importJournalsRequest = new importJournalsRequest();

        GlInterfaceTransHeader glInterfaceTransHeader = new GlInterfaceTransHeader();

        glInterfaceTransHeader.LedgerId = 300000001958365; 

        List<GlInterface> glInterface = new List<GlInterface>();
        glInterface.Add(glInter);

        glInterfaceTransHeader.GlInterface = glInterface.ToArray();
        importJournalsRequest.interfaceRows = glInterfaceTransHeader;
       
        try
        {
            var result = await serviceProxy.importJournalsAsync(importJournalsRequest);

            //cleanup
            factory.Close();
            ((ICommunicationObject)serviceProxy).Close();

        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            // *** ENSURE CLEANUP *** \
            CloseCommunicationObjects((ICommunicationObject)serviceProxy, factory);
            OperationContext.Current = prevOpContext; // Or set to null if you didn't capture the previous context
        }
    }
 

Ответ №1:

glInterfaceTransHeader.AccountingDateSpecified = true;