"Не удалось найти элемент конечной точки по умолчанию" с привязкой SAP PI WSDL
Здесь так много вопросов с одинаковым названием, что ни один из них не решил мою проблему.
Я пытаюсь получить доступ к данным 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=&senderService=NSAP_DEV&receiverParty=&receiverService=&interface=TaxCreditEmpTaxCreditRequest_Out&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)
Пожалуйста, может кто-нибудь направить меня или дать мне какую-нибудь подсказку.