Configuration WSDL Custom Binding

Untuk bisa menggunakan wsdl yang menggunakan authentication dan custom binding kita harus menambahkan beberapa baris code baik di c# dan di web.confignya

Untuk code c#

    ZWS_MIM_SET_MATERIAL_MASTERClient service;

    public SAPService()
    {
        string username = ConfigurationManager.AppSettings["ServiceUser"].ToString();
        string password = ConfigurationManager.AppSettings["ServicePass"].ToString();

        System.ServiceModel.Security.X509ServiceCertificateAuthentication temp = new System.ServiceModel.Security.X509ServiceCertificateAuthentication
        {
            RevocationMode = System.Security.Cryptography.X509Certificates.X509RevocationMode.NoCheck,
            CertificateValidationMode = X509CertificateValidationMode.None
        };

        service = new ZWS_MIM_SET_MATERIAL_MASTERClient();
        service.ClientCredentials.UserName.UserName = username;
        service.ClientCredentials.UserName.Password = password;
        service.ChannelFactory.Credentials.ServiceCertificate.SslCertificateAuthentication = new System.ServiceModel.Security.X509ServiceCertificateAuthentication();

        service.ChannelFactory.Credentials.ServiceCertificate.SslCertificateAuthentication = temp;
        service.ChannelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
        service.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;

    }

Untuk web.config

  <system.serviceModel>
    <bindings>
      <customBinding>
        <binding name="ZBIN_MIM_SET_MATERIAL_MASTER">
          <!--    WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'urn:sap-com:document:sap:rfc:functions':    -->
          <!--    <wsdl:binding name='ZBIN_MIM_SET_MATERIAL_MASTER'>    -->
          <!--        <sapattahnd:Enabled xmlns:sapattahnd="http://www.sap.com/710/features/attachment/">..</sapattahnd:Enabled>    -->
          <mtomMessageEncoding messageVersion="Soap11WSAddressing10" />
          <httpsTransport authenticationScheme="Basic" />
        </binding>
        <binding name="ZBIN_MIM_SET_MATERIAL_MASTER_soap12">
          <!--    WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'urn:sap-com:document:sap:rfc:functions':    -->
          <!--    <wsdl:binding name='ZBIN_MIM_SET_MATERIAL_MASTER_soap12'>    -->
          <!--        <sapattahnd:Enabled xmlns:sapattahnd="http://www.sap.com/710/features/attachment/">..</sapattahnd:Enabled>    -->
          <mtomMessageEncoding />
          <httpsTransport authenticationScheme="Basic" />
        </binding>
      </customBinding>
    </bindings>
    <client>
      <endpoint address="https://JKTSAPRG01.starenergy.id:5200/sap/bc/srt/rfc/sap/zws_mim_set_material_master/320/zser_mim_set_material_master/zbin_mim_set_material_master"
        binding="customBinding" bindingConfiguration="ZBIN_MIM_SET_MATERIAL_MASTER"
        contract="MaterialMasterService.ZWS_MIM_SET_MATERIAL_MASTER"
        name="ZBIN_MIM_SET_MATERIAL_MASTER" />
    </client>
  </system.serviceModel>

Indra Rahmat Jatnika has written 10 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>