SAP WSDL - ошибка элемента конечной точки по умолчанию - PullRequest
0 голосов
/ 01 марта 2020

Здесь так много вопросов с одинаковым названием, но ни один из них не решил мою проблему.

Я пытаюсь получить доступ к данным SAP с помощью PI / PO WSDL:

http://******.*****.com:50100/dir/wsdl?p=ic/dd43ed49927532309d6ba3c80b60749e

После добавления его в качестве ссылки на службу в Visual Studio приведенный ниже код был сгенерирован в файле app.config. (Я сам добавил тег security в bindings

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="TaxCreditEmpTaxCreditRequest_OutBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Basic" proxyCredentialType="Basic"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://*****.****.com:50100/XISOAPAdapter/MessageServlet?senderParty=&amp;senderService=NSAP_DEV&amp;receiverParty=&amp;receiverService=&amp;interface=TaxCreditEmpTaxCreditRequest_Out&amp;interfaceNamespace=http%3A%2F%2Fwww.*******.com%2FTaxCredit"
        binding="basicHttpBinding" bindingConfiguration="TaxCreditEmpTaxCreditRequest_OutBinding"
        contract="TaxCreditEmpTaxCreditRequest_OutService.TaxCreditEmpTaxCreditRequest_Out"
        name="HTTP_Port" />
    </client>
  </system.serviceModel>
</configuration>

Ниже приведен код, который я использую для доступа к услуге.

TaxCreditEmpTaxCreditRequest_OutService.TaxCreditEmpTaxCreditRequest_OutRequest obj = new TaxCreditEmpTaxCreditRequest_OutService.TaxCreditEmpTaxCreditRequest_OutRequest();

obj.PERNR = "00001042";
obj.BEGDATE = (year + "-07-01");
obj.ENDDATE = (year + 1 + "-06-30");
obj.TAXCREDIT_DET = new TaxCreditEmpTaxCreditRequest_OutService.ZENG_TAX_CREDIT_STRUCT_NEW[] { };

TaxCreditEmpTaxCreditRequest_OutService.TaxCreditEmpTaxCreditRequest_OutClient ws = new TaxCreditEmpTaxCreditRequest_OutService.TaxCreditEmpTaxCreditRequest_OutClient();
ws.ClientCredentials.UserName.UserName = "********";
ws.ClientCredentials.UserName.Password = "********";

ws.TaxCreditEmpTaxCreditRequest_Out(obj.BEGDATE, obj.ENDDATE, obj.PERNR, ref obj.TAXCREDIT_DET); 

TaxCreditEmpTaxCreditRequest_OutService.TaxCreditEmpTaxCreditRequest_OutResponse res = new TaxCreditEmpTaxCreditRequest_OutService.TaxCreditEmpTaxCreditRequest_OutResponse(0, obj.TAXCREDIT_DET);

string effRate = res.EFF_RATE.ToString();
zengTaxCredit = res.TAXCREDIT_DET;

Ниже приведено сообщение об ошибке

Could not find default endpoint element that references contract 'TaxCreditEmpTaxCreditRequest_OutService.TaxCreditEmpTaxCreditRequest_Out' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
StackTrace:
   at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
   at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
   at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
   at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName)
   at System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()
   at System.ServiceModel.EndpointTrait`1.CreateChannelFactory()
   at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
   at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
   at System.ServiceModel.ClientBase`1..ctor()
   at TaxCredit.TaxCreditEmpTaxCreditRequest_OutService.TaxCreditEmpTaxCreditRequest_OutClient..ctor()
   at TaxCredit.Common.SapConnector.GetEmployeeInfoNew(String destinationName, String pno)

Пожалуйста, кто-нибудь может направить меня или дать мне какую-нибудь подсказку.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...