Segue abaixo um web.config exemplo. Pontos importantes:

  • Configurar a configSection do cobredireto.net
  • Configurar o cliente WCF

 

<?xml version="1.0"?>

<configuration>

   <!-- registra a configSection para o cobreDireto -->

   <configSections>

       <section name="cobreDireto" type="CobreDireto.net.Config.CobreDiretoConfigurationSection, CobreDireto.net"/>

   </configSections>

 

   <!-- configura os parametros para o cobreDireto -->

   <cobreDireto version="1.1.0" merchant="xx" user="xx" password="xx" />

  

   <!--configura o cliente WCF para o Webservice do CobreDireto -->

   <system.serviceModel>

       <bindings>

           <basicHttpBinding>

               <binding name="BPagWSSoapBinding" closeTimeout="00:01:00" openTimeout="00:01:00"

                   receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"

                   bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

                   maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

                   messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"

                   useDefaultWebProxy="true">

                   <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"

                       maxBytesPerRead="4096" maxNameTableCharCount="16384" />

                   <security mode="Transport">

                       <transport clientCredentialType="None" proxyCredentialType="None"

                           realm="" />

                       <message clientCredentialType="UserName" algorithmSuite="Default" />

                   </security>

               </binding>

               <binding name="BPagWSSoapBinding1" closeTimeout="00:01:00" openTimeout="00:01:00"

                   receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"

                   bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

                   maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

                   messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"

                   useDefaultWebProxy="true">

                   <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"

                       maxBytesPerRead="4096" maxNameTableCharCount="16384" />

                   <security mode="None">

                       <transport clientCredentialType="None" proxyCredentialType="None"

                           realm="" />

                       <message clientCredentialType="UserName" algorithmSuite="Default" />

                   </security>

               </binding>

           </basicHttpBinding>

       </bindings>

       <client>

           <endpoint address="https://psp.cobredireto.com.br/bpag2Sandbox/services/BPagWS"

               binding="basicHttpBinding" bindingConfiguration="BPagWSSoapBinding"

               contract="CobreDiretoService.BPagWS" name="BPagWS" />

       </client>

   </system.serviceModel>

   <system.web>

       <compilation debug="true" targetFramework="4.0" />

   </system.web>

   <system.webServer>

       <modules runAllManagedModulesForAllRequests="true"/>

   </system.webServer>

</configuration>

Last edited Nov 5, 2010 at 9:06 PM by penihel, version 2

Comments

No comments yet.