bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] Fwd: RE: Scheme missing error from Java program


From: Tim Rühsen
Subject: [Bug-wget] Fwd: RE: Scheme missing error from Java program
Date: Sun, 27 Mar 2016 21:20:40 +0200
User-agent: KMail/4.14.10 (Linux/4.4.0-1-amd64; KDE/4.14.14; x86_64; ; )

Just for the record...

----------  Weitergeleitete Nachricht  ----------

Betreff: RE: [Bug-wget] Scheme missing error from Java program
Datum: Sonntag, 27. März 2016, 17:59:00
Von: Marc Stein <address@hidden>
An: Tim Rühsen <address@hidden>

You're right!!!! I needed double quotes around the URL. It works fine now.
Thanks for your help!!

-----Original Message-----
From: Tim Rühsen [mailto:address@hidden 
Sent: Sunday, March 27, 2016 9:45 AM
To: Marc Stein <address@hidden>
Subject: Re: [Bug-wget] Scheme missing error from Java program

Am Sonntag, 27. März 2016, 13:20:32 schrieb Marc Stein:
> Hi Tim,
> 
> Thanks for the help!! The problem is that this is the command that is
> failing:
> 
> wget --no-check-certificate --load-cookie "cookiefile.txt" 
> --output-document "C:\Users\Hal\OpptyAnalysis.pdf"
> 'https://secure-ausomxesa.crmondemand.com/OnDemand/user/ReportService?
> Metho d=ReportExecute&Path=OpptyAnalysis&Format=pdf&Refresh=Y'  
> --max-redirect=100

From the error message I would think that ' is taken as part of the URL 
string, so a 'https scheme isn't valid (just a guess).

Try to replace it ' by \" or play around with other escape measures (not sure 
what Windows and/or Powershell expects).

Regards, Tim



> 
> Thanks, Marc
> 
> -----Original Message-----
> From: Tim Rühsen [mailto:address@hidden
> Sent: Saturday, March 26, 2016 3:30 AM
> To: address@hidden
> Cc: Marc Stein <address@hidden>
> Subject: Re: [Bug-wget] Scheme missing error from Java program
> 
> Hi Marc,
> 
> there is a space before https://... in your command string. That is 
> part of the argument to wget.
> >             String cmd = "wget --no-check-certificate
> > 
> > --user-agent=\"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0)
> > Gecko/20100101 Firefox/17.0\" --keep-session-cookies --save-cookies 
> > \"cookiefile.txt\" --post-data \"j_username=" + username + "&j_password="
> > + password + "&langCode=ENU\"
> > https://secure-ausomxesa.crmondemand.com/OnDemand/authenticate";;
> 
> Change it to
> 
> > "&langCode=ENU \"https://secure->
> And you should be fine.
> 
> Regards, Tim
> 
> Am Freitag, 25. März 2016, 22:57:29 schrieb Marc Stein:
> > Howdy,
> > 
> > I'm using wget to down report files from an Oracle CRMOD Report 
> > Server. When I use the command from Windows Powershell it works 
> > fine, but when I make the exact same call from a Java program I get 
> > the scheme missing error. I downloaded wget 1.17.1-win64. I'm using 
> > Java version 1.7.0_51.
> > 
> > I have a login URL which works fine from both Powershell and the 
> > program, but the report download command works from Powershell and 
> > fails in the program. Here's the command:
> > 
> > wget --no-check-certificate --load-cookie "cookiefile.txt"
> > --output-document "C:\Users\Hal\OpptyAnalysis.pdf"
> > 'https://secure-ausomxesa.crmondemand.com/OnDemand/user/ReportService?
> > Metho d=ReportExecute&Path=OpptyAnalysis&Format=pdf&Refresh=Y'
> > --max-redirect=100
> > 
> > Here is what is logged in the log file. The first line is the text 
> > of the command written out as a string for comparison to the text 
> > used in
> > Powershell:
> > 
> > wget --no-check-certificate --load-cookie "cookiefile.txt"
> > --output-document "C:\Users\Hal\OpptyAnalysis.pdf"
> > 'https://secure-ausomxesa.crmondemand.com/OnDemand/user/ReportService?
> > Metho d=ReportExecute&Path=OpptyAnalysis&Format=pdf&Refresh=Y'
> > --max-redirect=100
> > 
> > ERR>'https://secure-ausomxesa.crmondemand.com/OnDemand/user/ReportSe
> > ERR>rv
> > ERR>ice?Me
> > thod=ReportExecute&Path=OpptyAnalysis&Format=pdf&Refresh=Y': Scheme 
> > missing. ExitValue: 1 Here is the code used for the program:
> > package reports;
> > 
> > import java.util.*;
> > import java.io.*;
> > import java.io.InputStream;
> > import java.io.OutputStream;
> > 
> > public class Distribute {
> > 
> >     //Constructor
> >     public Distribute() {
> >     
> >         super();
> >     
> >     }
> >     
> >     public static void main(String args[])
> >     {
> >     
> >         Distribute d = new Distribute();
> >         try
> >         {
> >         
> >             Login("IIE_CTE02/MSTEIN", "xxxxxxxx");
> >             Thread.sleep(1000);
> >             GetReport();
> >             Logout();
> >         
> >         }
> >         catch (Throwable t)
> >         {
> >         
> >             t.printStackTrace();
> >         
> >         }
> > 
> > }
> > 
> >     //Login function
> >     public static void Login(String username, String password)
> >     {
> >     
> >         try
> >         {
> >         
> >             String cmd = "wget --no-check-certificate
> > 
> > --user-agent=\"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0)
> > Gecko/20100101 Firefox/17.0\" --keep-session-cookies --save-cookies 
> > \"cookiefile.txt\" --post-data \"j_username=" + username + "&j_password="
> > + password + "&langCode=ENU\"
> > https://secure-ausomxesa.crmondemand.com/OnDemand/authenticate";;
> > //System.out.println(cmd);
> > 
> >             Runtime rt = Runtime.getRuntime();
> >             Process proc = rt.exec(cmd);
> >             
> >             // any error message?
> >             StreamGobbler errorGobbler = new
> >             
> >                 StreamGobbler(proc.getErrorStream(), "ERR");
> >             
> >             // any output?
> >             StreamGobbler outputGobbler = new
> >             
> >                 StreamGobbler(proc.getInputStream(), "OUT");
> >             
> >             // kick them off
> >             errorGobbler.start();
> >             outputGobbler.start();
> >             
> >             // any error???
> >             int exitVal = proc.waitFor();
> >             System.out.println("ExitValue: " + exitVal);
> >         
> >         }
> >         catch (Throwable t)
> >         {
> >         
> >             t.printStackTrace();
> >         
> >         }
> >     
> >     }
> >     
> >     //Get Report
> >     public static void GetReport()
> >     {
> >     
> >         int exitVal = 5;
> >         //Try to get the report 3 times
> >         for (int count = 0; count < 3; count++)
> >         {
> >         
> >             if(exitVal == 0) break;
> >             try
> >             {
> >             
> >                 String cmd = "wget --no-check-certificate
> > 
> > --load-cookie \"cookiefile.txt\" --output-document 
> > \"C:\\Users\\Hal\\OpptyAnalysis.pdf\"
> > 'https://secure-ausomxesa.crmondemand.com/OnDemand/user/ReportService?
> > Metho d=ReportExecute&Path=OpptyAnalysis&Format=pdf&Refresh=Y'
> > --max-redirect=100"; System.out.println("");
> > 
> >                 System.out.println("Report: " + cmd);
> >                 System.out.println("");
> >                 Runtime rt = Runtime.getRuntime();
> >                 Process proc = rt.exec(cmd);
> >                 
> >                 // any error message?
> >                 StreamGobbler errorGobbler = new
> >                 
> >                     StreamGobbler(proc.getErrorStream(), "ERR");
> >                 
> >                 // any output?
> >                 StreamGobbler outputGobbler = new
> >                 
> >                     StreamGobbler(proc.getInputStream(), "OUT");
> >                 
> >                 // kick them off
> >                 errorGobbler.start();
> >                 outputGobbler.start();
> >                 
> >                 // any error???
> >                 exitVal = proc.waitFor();
> >                 System.out.println("ExitValue: " + exitVal);
> >             
> >             }
> >             catch (Throwable t)
> >             {
> >             
> >                 t.printStackTrace();
> >             
> >             }
> >         
> >         }
> >     
> >     }
> >     
> >     //Logout function
> >     public static void Logout()
> >     {
> >     
> >         try
> >         {
> >         
> >             String cmd = "wget --no-check-certificate --load-cookie
> > 
> > \"cookiefile.txt\"
> > https://secure-ausomxesa.crmondemand.com/OnDemand/logoff.jsp";; 
> > Runtime rt = Runtime.getRuntime();
> > 
> >             Process proc = rt.exec(cmd);
> >             
> >             // any error message?
> >             StreamGobbler errorGobbler = new
> >             
> >                 StreamGobbler(proc.getErrorStream(), "ERR");
> >             
> >             // any output?
> >             StreamGobbler outputGobbler = new
> >             
> >                 StreamGobbler(proc.getInputStream(), "OUT");
> >             
> >             // kick them off
> >             errorGobbler.start();
> >             outputGobbler.start();
> >             
> >             // any error???
> >             int exitVal = proc.waitFor();
> >             System.out.println("ExitValue: " + exitVal);
> >         
> >         }
> >         catch (Throwable t)
> >         {
> >         
> >             t.printStackTrace();
> >         
> >         }
> >     
> >     }
> >     
> >     private static class StreamGobbler extends Thread
> >     {
> >     
> >         InputStream is;
> >         String type;
> >         OutputStream os;
> >         
> >         StreamGobbler(InputStream is, String type)
> >         {
> >         
> >             this(is, type, null);
> >         
> >         }
> >         
> >         StreamGobbler(InputStream is, String type, OutputStream redirect)
> >         {
> >         
> >             this.is = is;
> >             this.type = type;
> >             this.os = redirect;
> >         
> >         }
> >         
> >         public void run()
> >         {
> >         
> >             try
> >             {
> >             
> >                 PrintWriter pw = null;
> >                 if (os != null)
> >                 
> >                     pw = new PrintWriter(os);
> >                 
> >                 InputStreamReader isr = new InputStreamReader(is);
> >                 BufferedReader br = new BufferedReader(isr);
> >                 String line = null;
> >                 while ((line = br.readLine()) != null) {
> >                 
> >                     if (pw != null)
> >                     
> >                         pw.println(line);
> >                     
> >                     System.out.println(type + ">" + line);
> >                 
> >                 }
> >                 if (pw != null)
> >                 
> >                     pw.flush();
> >             
> >             }
> >             catch (IOException ioe)
> >             {
> >             
> >                 ioe.printStackTrace();
> >             
> >             }
> >         
> >         }
> >     
> >     }
> > 
> > }
> > 
> > Any help with this would be greatly appreciated.
> > 
> > Thanks, Marc
> > 
> > 
> > Marc Stein | CRM Technical Development [Apex 
> > Logo]<http://www.apexit.com/>
> > *: 719.351.8578  *: address@hidden
-------------------------------------------------------------

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]