Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

https connection

0 views
Skip to first unread message

hgat

unread,
Nov 10, 2003, 4:18:01 PM11/10/03
to
hi ihrs,

mit diesem code sollte eigentlich eine https connection mit einem server
hergestellt werden der über das cgi-script die daten auswertet und als
respons einen string liefert.
leider funktioniert der code nur bis zum "getInputStream();" dabei wirft er
die exception die ich unten angefügt hab.
kann mir von euch einer sagen was ich da blos falsch mach??

lg horst


try {

// für POST medhode
String data = URLEncoder.encode("key1", "UTF-8") + "=" +
URLEncoder.encode("value1", "UTF-8");
data += "&" + URLEncoder.encode("key2", "UTF-8") + "=" +
URLEncoder.encode("value2", "UTF-8");

// Du erzeugst erst eine URL "https://xxx:xxx/cgi-bin/xxx?*daten*"

System.setProperty("java.protocol.handler.pkgs","javax.net.ssl");
URL url = new URL(inetaddi + outputVorAuto); //https
host/port/cgi-script/daten

// Nun verbindest du dich
HttpsURLConnection https = (HttpsURLConnection)url.openConnection();

// https.setRequestMethod("POST");

https.setDoOutput(true);

/*System.out.println(https.getDate());
System.out.println(https.getURL());
System.out.println(https.getDefaultUseCaches());
System.out.println(https.getOutputStream());
System.out.println(https.getDoInput());
OutputStream out = https.getOutputStream();
System.out.println(outputVorAuto.getBytes());
out.write(outputVorAuto.getBytes());
out.flush();*/

// System.out.println(https.getInputStream());

https.setDoInput(true);

InputStream is = https.getInputStream(); //hier wird die exception
geworfen ?????????????????????????
InputStreamReader isr = new InputStreamReader(is);
BufferedReader rd = new BufferedReader(isr);//(new
InputStreamReader(https.getInputStream()));

while ((line = rd.readLine()) != null) {
strantw += line;
System.out.println("Input: " + line);
}
rd.close();

} catch (IOException ex) {
System.out.println("Fehler!");
Logger.sysOut("ShowZahlungsarten: pruefeKreditkarte -> URL ", ex,
Logger.HIGHPRIORITY);
}
return strantw;

}

START 10.11.2003-19.18.51
Start DBIS
-------------------------------------------------
ShowZahlingsarten: pruefeKreditkarte -> URL 10.11.2003-19.19.55
(Exception) Connection reset
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at com.sun.net.ssl.internal.ssl.InputRecord.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.InputRecord.read(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.afterConnect(DashoA6275)
at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA
6275)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection
.java:615)
at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(DashoA6275)
at
com.nekom.dbis.work.WorkPayment.vorAutorisierungOhneBuchungOnline(WorkPaymen
t.java:107)
at com.nekom.dbis.show.ShowZahlungsarten.doGet(ShowZahlungsarten.java:297)
at com.nekom.dbis.show.ShowZahlungsarten.doPost(ShowZahlungsarten.java:18)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:392)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:619)
at java.lang.Thread.run(Thread.java:534)

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

hgat

unread,
Nov 12, 2003, 2:08:29 AM11/12/03
to
hi ihrs,

nachdem sich niemand mit diesem thema auseinandersetzt, habe ich eine
bitte:

wo kann ich noch um hilfe hoffen, ich kenne keine gescheiten foren...

bei sun bin ich auch nicht fündig geworden und alle anderen versuche
verliefen alle gleich - am code kann es nicht liegen - war die
antwort...warum funktioniert das teil dann nicht??

hoffend....

horst


Carsten Broschek

unread,
Nov 14, 2003, 4:12:48 AM11/14/03
to

> bei sun bin ich auch nicht fündig geworden und alle anderen versuche
> verliefen alle gleich - am code kann es nicht liegen - war die
> antwort...warum funktioniert das teil dann nicht??
Wieso kann es am code nicht liegen? kommt den der Zugriff beim CGI
an? Danach würde ich erst mal den response code checken, vielleicht ist
der Zugriff schon fehlgeschlagen und die Verbindung verloren?

C.

0 new messages