2

我有一个使用以下配置文件调用 SAP PI Webservice 的代码:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
  </configSections>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="VMSUpdateVehicleMasterProcessing_Out_SyncBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Basic"/>
          </security>
        </binding>
        <binding name="VMSUpdateVehicleMasterProcessing_Out_SyncBinding1">
          <security mode="Transport" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://gtsapgwqas.tmp.local:50000/XISOAPAdapter/MessageServlet?senderParty=&amp;senderService=VMSPlantMaintenance_Q&amp;receiverParty=&amp;receiverService=&amp;interface=VMSUpdateVehicleMasterProcessing_Out_Sync&amp;interfaceNamespace=urn%3ATMP.com%3AERP%3APlantMaintenance%3ACreateUpdateVehicleMaster"
        binding="basicHttpBinding" bindingConfiguration="VMSUpdateVehicleMasterProcessing_Out_SyncBinding"
        contract="VMService.VMSUpdateVehicleMasterProcessing_Out_Sync"
        name="HTTP_Port" />
    </client>
  </system.serviceModel>
</configuration>

要创建一个实例以使用此 Web 服务中的方法,我只需使用:

VMService.VMSUpdateVehicleMasterProcessing_Out_SyncClient c = new VMSUpdateVehicleMasterProcessing_Out_SyncClient();

然后,在调用该方法时,我只使用:

VehicleMasterResponse response = c.VMSUpdateVehicleMasterProcessing_Out_Sync(vm);

这非常有效,因为我能够传递更新并收到适当的响应。我的问题是,我必须在 SSIS 中实现它。SSIS 无法识别 app.config,因此我尝试创建基本 HTTP 绑定。不幸的是,当我调用well方法时总是抛出“服务器错误”......

这是我设置绑定和实例的方式:

var binding = new BasicHttpBinding();
            binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;

            var addess = new EndpointAddress("http://gtsapgwqas.tmp.local:50000/XISOAPAdapter/MessageServlet?senderParty=&amp;senderService=VMSPlantMaintenance_Q&amp;receiverParty=&amp;receiverService=&amp;interface=VMSUpdateVehicleMasterProcessing_Out_Sync&amp;interfaceNamespace=urn%3ATMP.com%3AERP%3APlantMaintenance%3ACreateUpdateVehicleMaster");
            VMService.VMSUpdateVehicleMasterProcessing_Out_SyncClient c = new VMSUpdateVehicleMasterProcessing_Out_SyncClient(binding, addess);

            c.ClientCredentials.UserName.UserName = "NAME";
            c.ClientCredentials.UserName.Password = "PWORD";

基本上我只是提供了配置文件中的属性......是什么导致了服务器错误以及如何解决这个问题?

4

0 回答 0