Results 1 to 4 of 4

Thread: My application doesn't work since I changed the url of the web service

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2014
    Location
    France
    Posts
    15

    My application doesn't work since I changed the url of the web service

    Since August 1st, the url of the web service changed, the application was running fine with the previous url, but with the new one, the application works for 1 user, the 2 other ones encounter this error message :
    Could not establish trust relationship for the SSL/TLS secure channel with authority 'e-factura.sunat.gob.pe'
    My project is a console one, in it, I use a certificate file to sign a xml file, the certificate is on a server, it's not installed on the certificate store. Moreover, to consume the web service, a wsse:security authentication is required. My app.config file is this one (I did hide the wsse:security credentials) :
    Code:
    <?xml version="1.0"?>
    <configuration>
    <configSections>
    </configSections>
    <system.diagnostics>
    <sources>
    <source name="DefaultSource" switchName="DefaultSwitch">
        <listeners>
          <add name="FileLog"/>
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="DefaultSwitch" value="Information"/>
    </switches>
    <sharedListeners>
      <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter"/>
    </sharedListeners>
     </system.diagnostics>
      <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>
    <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BillServicePortBinding" 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="secured">
          <security mode="TransportWithMessageCredential">
            <message clientCredentialType="UserName" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://e-factura.sunat.gob.pe:443/ol-ti-itcpfegem/billService"
          binding="basicHttpBinding" bindingConfiguration="BillServicePortBinding"
          contract="Production.billService" name="BillServicePort" >
        <headers>
          <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
            <wsse:UsernameToken >
              <wsse:Username>XXXXXXXX</wsse:Username>
              <wsse:Password Type='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'>XXXXXX</wsse:Password>
            </wsse:UsernameToken>
          </wsse:Security>
        </headers>
      </endpoint>
    </client>
    </system.serviceModel>
    </configuration>
    I have no idea what to do to solve the problem, moreover, I can't consume the web service on my machine (the web service is used to sent real invoices to tax office). Thanks

  2. #2
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,657

    Re: My application doesn't work since I changed the url of the web service

    Why dont you add some logging into your app which logs what is happening during the process.

    You should be able to see if anything is different between the user that it is working for and the 2 that it is not.

    If nothing is different this may suggest that there is a permissions issue with those 2 users.
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2014
    Location
    France
    Posts
    15

    Re: My application doesn't work since I changed the url of the web service

    Here is my code to consume the web service :

    Code:
    System.Net.ServicePointManager.UseNagleAlgorithm = True
    System.Net.ServicePointManager.Expect100Continue = False
    System.Net.ServicePointManager.CheckCertificateRevocationList = True
    
    Dim data As Byte() = System.IO.File.ReadAllBytes(global_zipToSend)
    Dim MyReturn As Byte()
    ws.ClientCredentials.CreateSecurityTokenManager()
    ws.ClientCredentials.UserName.UserName = userName
    ws.ClientCredentials.UserName.Password = pwd
    
    Try
         ws.Open()
         Console.WriteLine("open")
         MyReturn = ws.sendBill(l_nombre, data)
         Console.WriteLine("close")
         ws.Close()
    Catch ex As Exception
         Throw New Exception(ex.Message)
    End Try
    But I tend to think the error is related to the certificate itself but I'm not sure

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2014
    Location
    France
    Posts
    15

    Re: My application doesn't work since I changed the url of the web service

    Hello guys,

    I ran Internet Explorer on the server, I added the web address of the web service as a trusted site, I asked users to the same, so far, I got a feedback from 1 of them who confirms the call of the web service is now working.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width