Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 调用用户定义的HTTP绑定到SAP PI时引发服务器错误_C#_Ssis_Sap_Sap Xi_Sap Pi - Fatal编程技术网

C# 调用用户定义的HTTP绑定到SAP PI时引发服务器错误

C# 调用用户定义的HTTP绑定到SAP PI时引发服务器错误,c#,ssis,sap,sap-xi,sap-pi,C#,Ssis,Sap,Sap Xi,Sap Pi,我有一个使用以下配置文件调用SAP PI Webservice的代码: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> </configSections> <system.serviceModel> <bindings> <basicHttpBinding> <b

我有一个使用以下配置文件调用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>
然后,调用该方法时,我只使用:

VMService.VMSUpdateVehicleMasterProcessing_Out_SyncClient c = new VMSUpdateVehicleMasterProcessing_Out_SyncClient();
VehicleMasterResponse response = c.VMSUpdateVehicleMasterProcessing_Out_Sync(vm);
这非常有效,因为我能够传递更新并收到适当的响应。我的问题是,我必须在SSIS中实现这一点。SSIS无法识别app.config,因此我尝试创建基本HTTP绑定。不幸的是,当我调用well方法时,总是抛出“Server Error”

以下是我如何设置绑定和实例:

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";

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

第一眼:与.config文件不同,您不必在EndPointAddress中对符号进行编码-尝试替换每个
&
。非常感谢!现在我想知道为什么我没有想到这一点!有时你需要一双眼睛或一双眼睛。