none
Code not transferring zip file RRS feed

  • Question

  • We are trying to compile files and upload the file as zip format to a vendors site through the URL and credentials provided by them. The URL and credentials are in the script. But the file transfer does not occur. We are running this through task scheduler on a Windows Server 2012 R2 server. There are no firewall configured for outbound or inbound. Firewall is disabled on the server.

    They have an url which has /api/2/batch/profile. If I go directly to that path it gives me a 404 file not found. I added restapi/2/batch/profile and I get the following error. Server Error

    404 - File or directory not found.
    The resource you are looking for might have been removed, had its name 
    changed, or is temporarily unavailable.
    

    This is the script file (few lines from the main script)

    ---------<add key="ZippedFile" value="filename.zip" />
    -------- <add key="EmailHost" value="smtp.company.com" />
    ----------<add key="EmailPort" value="25" />
    ---------<add key="DateAuditsBeganInPD" value="2012-03-18" />
    ----------<add key="WebServiceURI" 
    ----------value="https://companyname.com/api/2/batch/profile"/>
    ----------<add key="UserId" value="userID"/>
    --------- <add key="Password" value="password"/>
    --------- <add key="UploadResponseFile" value="UploadResponse.txt"/>
    -------</appSettings>
    

    I get no error message. The file does not get uploaded to their website. But, if we do it through CURL command and try to upload the file just through CURL command it uploads it from that server or from any desktop.

    curl.exe -X POST -u "userID":"password" -H "content-type: multipart/form- 
    data" --form "batch-file=@\\path to the zip file\filename.zip" --url 
    "https://companyname.com/api/2/batch/profile"


    AA2913


    Wednesday, November 6, 2019 2:57 PM

Answers

All replies

  • We have a visual c++ code that is supposed to zip the files and transfer to our customer website. When we do with the CURL command the file it gets uploaded, but when we do with the program that is written it does not.

    What could be wrong

    Since you have not provided any information about your C++ code and the specific errors encountered there is no way to answer this question.  You need to debug your code.

    • Edited by RLWA32 Wednesday, November 6, 2019 3:04 PM
    Wednesday, November 6, 2019 3:03 PM
  • Hello,

    as RLWA32 already said, show the source code in order to get help here. You have edited your Question but this does not help us to help you.

    If there is a file not found, are you sure you write the zip file? The questions are: How do you write the zip file and how do you start the transfer in your C++ source code?

    Regards, Guido

    Thursday, November 7, 2019 8:38 AM
    Moderator
  • Thanks  guys here is the source code. Earlier we used to run this in  scheduled task and we used to send it to someone and they would upload it manually, but now we are uploading it through the URL.

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections>
        <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <section name="PolicyData.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
          <section name="company.Analytics.PolicyData.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        </sectionGroup>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      </configSections>
      <loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
        <listeners>
          <add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" fileName="..\IO\PolicyData.log" footer="" formatter="Text Formatter" header="" rollSizeKB="5000" maxArchivedFiles="5" />
        </listeners>
        <formatters>
          <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" template="{timestamp(local)}  {message}" name="Text Formatter" />
        </formatters>
        <categorySources>
          <add switchValue="All" name="General">
            <listeners>
              <add name="Rolling Flat File Trace Listener" />
            </listeners>
          </add>
        </categorySources>
        <specialSources>
          <allEvents switchValue="All" name="All Events" />
          <notProcessed switchValue="All" name="Unprocessed Category" />
          <errors switchValue="All" name="Logging Errors &amp; Warnings">
            <listeners>
              <add name="Rolling Flat File Trace Listener" />
            </listeners>
          </errors>
        </specialSources>
      </loggingConfiguration>
      <connectionStrings>
        <add name="PD_CDB" connectionString="Data Source=db-pr-pd.company.com;Initial Catalog=BWCDB;uid=PDExternalAppsId;Password=password" />
        <add name="CLAIMSEntities" connectionString="metadata=res://*/ClaimsModel.csdl|res://*/ClaimsModel.ssdl|res://*/ClaimsModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SQLCWSPROD;initial catalog=CLAIMS;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
        <add name="GenBusinessEntities" connectionString="metadata=res://*/GenBusinessModel.csdl|res://*/GenBusinessModel.ssdl|res://*/GenBusinessModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=db-pr-genbusiness.company.com;initial catalog=GenBusiness;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
        <add name="NLog" connectionString="Data Source=db-pr-appprog.company.com;Initial Catalog=ApplicationsProgramming;Trusted_Connection=True;" />
      </connectionStrings>
      <appSettings>
        <add key="PD_UserID" value="serviceaccount" />
        <add key="PD_Password" value="password" />
        <add key="PD_ClientID" value="14" />
        <add key="XMLManagerServiceURL" value="http://prod-app-net/PDSERVICES/WSXMLMANAGERSERVICEEX.ASMX" />
        <add key="OutputPath" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO" />
        <add key="ArchivePath" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\archive" />
        <add key="ErrorPath" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\error" />
        <add key="ShareFolder" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\Share" />
        <add key="DataFolder" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\Data "/>
        <add key="InsuredFile" value="insured.psv" />
        <add key="TermFile" value="term.psv" />
        <add key="StateFile" value="state.psv" />
        <add key="ClassFile" value="class.psv" />
        <add key="ClaimFile" value="claim.psv" />
        <add key="ClaimDetailFile" value="claim_detail.psv" />
        <add key="ZippedFile" value="companyPolicyData.DEV.zip" />
        <add key="EmailHost" value="smtp.company.com" />
        <add key="EmailPort" value="25" />
        <add key="DateAuditsBeganInPD" value="2012-03-18" />
        <add key="VENDORNAMEWebServiceURI" value="https://insureright.VENDORNAME.com/api/2/batch/profile"/>
        <add key="VENDORNAMEUserId" value="test@company.com"/>
        <add key="VENDORNAMEPassword" value="password"/>
    <add key="UploadResponseFile" value="UploadResponse.txt"/>
        </appSettings>
      <system.diagnostics>
        <sources>
          <!-- This section defines the logging configuration for My.Application.Log -->
          <source name="DefaultSource" switchName="DefaultSwitch">
            <listeners>
              <add name="FileLog" />
              <!-- Uncomment the below section to write to the Application Event Log -->
              <!--<add name="EventLog"/>-->
            </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" />
          <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
          <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
        </sharedListeners>
      </system.diagnostics>
      <system.serviceModel>
        <bindings>
          <wsHttpBinding>
            <binding name="BasicHttpEndpoint">
              <security mode="Transport" />
            </binding>
            <binding name="WSHttpBinding_ICommon">
              <security mode="Transport" />
            </binding>
            <binding name="WSHttpBinding_IBranding">
              <security mode="Transport" />
            </binding>
          </wsHttpBinding>
        </bindings>
        <client>
          <endpoint address="https://agencyservices.company.com/companyBiz.svc" binding="wsHttpBinding" bindingConfiguration="BasicHttpEndpoint" contract="AgencyService.IcompanyBiz" name="BasicHttpEndpoint" />
          <endpoint address="https://commonservices.company.com/Common.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICommon" contract="CommonService.ICommon" name="WSHttpBinding_ICommon" />
          <endpoint address="https://commonservices.company.com/Branding.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IBranding" contract="BrandService.IBranding" name="WSHttpBinding_IBranding" />
        </client>
      </system.serviceModel>
      <applicationSettings>
        <PolicyData.My.MySettings>
          <setting name="PolicyGapData_XMLManagerServiceEx_WSXMLManagerServiceEx" serializeAs="String">
            <value>http://tst-iisapp-net/PDSERVICES/WSXMLMANAGERSERVICEEX.ASMX</value>
          </setting>
        </PolicyData.My.MySettings>
      </applicationSettings>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
      </startup>
      <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
          <parameters>
            <parameter value="mssqllocaldb" />
          </parameters>
        </defaultConnectionFactory>
        <providers>
          <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
        </providers>
      </entityFramework>
    </configuration>

    ---------------------------------------------------------

    This is the URL to which we are trying to transfer the zipped file with their credentials.

        <add key="VENDORNAMEWebServiceURI" value="https://insureright.VENDORNAME.com/api/2/batch/profile"/>
        <add key="VENDORNAMEUserId" value="test@company.com"/>
        <add key="VENDORNAMEPassword" value="password"/>


    AA2913

    Thursday, November 7, 2019 1:56 PM
  • Thanks  guys here is the source code. Earlier we used to run this in  scheduled task and we used to send it to someone and they would upload it manually, but now we are uploading it through the URL.

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections>
        <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <section name="PolicyData.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
          <section name="company.Analytics.PolicyData.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        </sectionGroup>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      </configSections>
      <loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
        <listeners>
          <add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" fileName="..\IO\PolicyData.log" footer="" formatter="Text Formatter" header="" rollSizeKB="5000" maxArchivedFiles="5" />
        </listeners>
        <formatters>
          <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" template="{timestamp(local)}  {message}" name="Text Formatter" />
        </formatters>
        <categorySources>
          <add switchValue="All" name="General">
            <listeners>
              <add name="Rolling Flat File Trace Listener" />
            </listeners>
          </add>
        </categorySources>
        <specialSources>
          <allEvents switchValue="All" name="All Events" />
          <notProcessed switchValue="All" name="Unprocessed Category" />
          <errors switchValue="All" name="Logging Errors &amp; Warnings">
            <listeners>
              <add name="Rolling Flat File Trace Listener" />
            </listeners>
          </errors>
        </specialSources>
      </loggingConfiguration>
      <connectionStrings>
        <add name="PD_CDB" connectionString="Data Source=db-pr-pd.company.com;Initial Catalog=BWCDB;uid=PDExternalAppsId;Password=password" />
        <add name="CLAIMSEntities" connectionString="metadata=res://*/ClaimsModel.csdl|res://*/ClaimsModel.ssdl|res://*/ClaimsModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SQLCWSPROD;initial catalog=CLAIMS;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
        <add name="GenBusinessEntities" connectionString="metadata=res://*/GenBusinessModel.csdl|res://*/GenBusinessModel.ssdl|res://*/GenBusinessModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=db-pr-genbusiness.company.com;initial catalog=GenBusiness;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
        <add name="NLog" connectionString="Data Source=db-pr-appprog.company.com;Initial Catalog=ApplicationsProgramming;Trusted_Connection=True;" />
      </connectionStrings>
      <appSettings>
        <add key="PD_UserID" value="serviceaccount" />
        <add key="PD_Password" value="password" />
        <add key="PD_ClientID" value="14" />
        <add key="XMLManagerServiceURL" value="http://prod-app-net/PDSERVICES/WSXMLMANAGERSERVICEEX.ASMX" />
        <add key="OutputPath" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO" />
        <add key="ArchivePath" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\archive" />
        <add key="ErrorPath" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\error" />
        <add key="ShareFolder" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\Share" />
        <add key="DataFolder" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\Data "/>
        <add key="InsuredFile" value="insured.psv" />
        <add key="TermFile" value="term.psv" />
        <add key="StateFile" value="state.psv" />
        <add key="ClassFile" value="class.psv" />
        <add key="ClaimFile" value="claim.psv" />
        <add key="ClaimDetailFile" value="claim_detail.psv" />
        <add key="ZippedFile" value="companyPolicyData.DEV.zip" />
        <add key="EmailHost" value="smtp.company.com" />
        <add key="EmailPort" value="25" />
        <add key="DateAuditsBeganInPD" value="2012-03-18" />
        <add key="VENDORNAMEWebServiceURI" value="https://insureright.VENDORNAME.com/api/2/batch/profile"/>
        <add key="VENDORNAMEUserId" value="test@company.com"/>
        <add key="VENDORNAMEPassword" value="password"/>
    <add key="UploadResponseFile" value="UploadResponse.txt"/>
        </appSettings>
      <system.diagnostics>
        <sources>
          <!-- This section defines the logging configuration for My.Application.Log -->
          <source name="DefaultSource" switchName="DefaultSwitch">
            <listeners>
              <add name="FileLog" />
              <!-- Uncomment the below section to write to the Application Event Log -->
              <!--<add name="EventLog"/>-->
            </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" />
          <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
          <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
        </sharedListeners>
      </system.diagnostics>
      <system.serviceModel>
        <bindings>
          <wsHttpBinding>
            <binding name="BasicHttpEndpoint">
              <security mode="Transport" />
            </binding>
            <binding name="WSHttpBinding_ICommon">
              <security mode="Transport" />
            </binding>
            <binding name="WSHttpBinding_IBranding">
              <security mode="Transport" />
            </binding>
          </wsHttpBinding>
        </bindings>
        <client>
          <endpoint address="https://agencyservices.company.com/companyBiz.svc" binding="wsHttpBinding" bindingConfiguration="BasicHttpEndpoint" contract="AgencyService.IcompanyBiz" name="BasicHttpEndpoint" />
          <endpoint address="https://commonservices.company.com/Common.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICommon" contract="CommonService.ICommon" name="WSHttpBinding_ICommon" />
          <endpoint address="https://commonservices.company.com/Branding.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IBranding" contract="BrandService.IBranding" name="WSHttpBinding_IBranding" />
        </client>
      </system.serviceModel>
      <applicationSettings>
        <PolicyData.My.MySettings>
          <setting name="PolicyGapData_XMLManagerServiceEx_WSXMLManagerServiceEx" serializeAs="String">
            <value>http://tst-iisapp-net/PDSERVICES/WSXMLMANAGERSERVICEEX.ASMX</value>
          </setting>
        </PolicyData.My.MySettings>
      </applicationSettings>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
      </startup>
      <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
          <parameters>
            <parameter value="mssqllocaldb" />
          </parameters>
        </defaultConnectionFactory>
        <providers>
          <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
        </providers>
      </entityFramework>
    </configuration>

    ---------------------------------------------------------

    This is the URL to which we are trying to transfer the zipped file with their credentials.

        <add key="VENDORNAMEWebServiceURI" value="https://insureright.VENDORNAME.com/api/2/batch/profile"/>
        <add key="VENDORNAMEUserId" value="test@company.com"/>
        <add key="VENDORNAMEPassword" value="password"/>


    AA2913

    Well,

    this is not Visual C++ source code. This looks like XML. You should ask in an XML Forum. Maybe here: https://social.msdn.microsoft.com/Forums/en-US/home?forum=xmlandnetfx

    Regards, Guido

    Thursday, November 7, 2019 2:01 PM
    Moderator
  • Hi RLWA32 

    Please, find the source code. Also, there was a question asked by someone what libraries are being used. I am not sure what that means. As, I do not code and I am not sure what libraries are being used. How does the libraries that are used determine what the issue is. Is it the code is supported by the vendor to do the transfer?

    Please help! The coder has no much info just that he says he wrote the code. 


    AA2913

    Thursday, November 7, 2019 2:03 PM
  • What you are showing isn't code, it's a config file. And given the WCF section in there, I can safely say it is not even written in C++, as Visual C++ does not support WCF. 

    Microsoft or us have no idea how long is the support contract between you and the vendor who wrote the code. You got to ask your relevant department... or the vendor. If it is out of support then shop for alternatives. If it is still in support, ask the vendor to fix it, we can't fix code without first seeing it, you know. and it does not look like you are the kind of person able to locate the file containing relevant code or compile a fixed version even when you have the full source code. 



    Visual C++ MVP


    Friday, November 8, 2019 1:44 AM
    Moderator
  • Hello,

    Thank you for posting here.

    Since this thread is not related to C++, I will move it to Where is the Forum For…? forum to redirect it to the correct forum.

    Best Regards,

    Suarez Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.




    Monday, November 11, 2019 8:13 AM
  • Monday, November 11, 2019 8:34 AM
    Moderator