UnknownHostException:http

Hi all,
We are migrating an application from 5.1 to 7.0 version and when we access the url which belongs to the application it throws UnknownHostException:http .This is thrown in the class
public class DAVURLConnection extends sun.net.www.protocol.http.HttpURLConnection
And the stack trace is:
10/4/12 1:15:01:244 CDT 00000027 SystemErr R java.net.UnknownHostException: http
10/4/12 1:15:01:244 CDT 00000027 SystemErr R at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:207)
10/4/12 1:15:01:245 CDT 00000027 SystemErr R at java.net.Socket.connect(Socket.java:539)
10/4/12 1:15:01:245 CDT 00000027 SystemErr R at java.net.Socket.connect(Socket.java:488)
10/4/12 1:15:01:245 CDT 00000027 SystemErr R at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
10/4/12 1:15:01:245 CDT 00000027 SystemErr R at sun.net.www.http.HttpClient.openServer(HttpClient.java:407)
10/4/12 1:15:01:245 CDT 00000027 SystemErr R at sun.net.www.http.HttpClient$4.run(HttpClient.java:470)
10/4/12 1:15:01:245 CDT 00000027 SystemErr R at java.security.AccessController.doPrivileged(AccessController.java:251)
10/4/12 1:15:01:245 CDT 00000027 SystemErr R at sun.net.www.http.HttpClient.privilegedOpenServer(HttpClient.java:452)
10/4/12 1:15:01:245 CDT 00000027 SystemErr R at sun.net.www.http.HttpClient.openServer(HttpClient.java:533)
10/4/12 1:15:01:246 CDT 00000027 SystemErr R at sun.net.www.http.HttpClient.<init>(HttpClient.java:246)
10/4/12 1:15:01:246 CDT 00000027 SystemErr R at sun.net.www.http.HttpClient.New(HttpClient.java:319)
10/4/12 1:15:01:246 CDT 00000027 SystemErr R at sun.net.www.http.HttpClient.New(HttpClient.java:336)
10/4/12 1:15:01:246 CDT 00000027 SystemErr R at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:980)
10/4/12 1:15:01:246 CDT 00000027 SystemErr R at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:959)
10/4/12 1:15:01:246 CDT 00000027 SystemErr R at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:846)
10/4/12 1:15:01:246 CDT 00000027 SystemErr R at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1024)
10/4/12 1:15:01:247 CDT 00000027 SystemErr R at com.ibm.webdav.protocol.http.DAVURLConnection.getOutputStream(DAVURLConnection.java:89)
To add more info . We did telnet for hostname to which we are trying to connect from the linux server for this we could able to telnet but when we try to connect that host through java code then we are getting the above specified stacktrace at getOutputStream() method. getOutputStream() method is overriden in above mentioned class WebDAVURLConnection and calling super.getOutputStream() method.Are we need to do any jar files inclusion after migrating to 7.0 version? Do we need to change code which uses this method ? Any suggestions.
Edited by: 962584 on Oct 4, 2012 4:57 AM

The code:
URL getUrl = new URL("ValidURL");
               String protocol = getUrl.getProtocol();
               int port = getUrl.getPort();
DAVURLConnection getUrlCon = new DAVURLConnection(getUrl, protocol, port);
               getUrlCon.setDoInput(true);
               getUrlCon.setRequestMethod("PUT");
               getUrlCon.setRequestProperty("Content-type", "text/xml");
               getUrlCon.setRequestProperty("Depth", depth);
               getUrlCon.setFollowRedirects(false);
               authenticate(cookieList, getUrlCon, respCode);
               getUrlCon.setDoOutput(true);
               OutputStream os = getUrlCon.getOutputStream(); --- getting exception at this point
============================================
In DAVURLConnection (Url , protocol, port) construtor, we are calling super(u, host, port) constructor of sun.net.www.protocol.http.HttpURLConnection.
i.e public DAVURLConnection(URL u, String host, int port) throws IOException {
super(u, host, port);
Edited by: 962584 on Oct 4, 2012 4:53 AM
Edited by: 962584 on Oct 4, 2012 4:56 AM

Similar Messages

  • HTTP Transport Error in Net BEans 6.5

    Hello,
    I am consuming a web service using JAX-RPC. I am trying to log onto a web interface through my program but I am getting the following error:
    Feb 6, 2009 1:10:54 PM ttsample.Engine Login
    SEVERE: null
    java.rmi.RemoteException: HTTP transport error: java.net.UnknownHostException: http; nested exception is:
    Logged in...
    HTTP transport error: java.net.UnknownHostException: http
    at ttsample.TtsoapcgiPortType_Stub.databaseLogon(TtsoapcgiPortType_Stub.java:819)
    at ttsample.Engine.Login(Engine.java:77)
    at ttsample.Main.main(Main.java:30)
    Caused by: HTTP transport error: java.net.UnknownHostException: http
    at com.sun.xml.rpc.client.http.HttpClientTransport.invoke(HttpClientTransport.java:140)
    at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:96)
    at ttsample.TtsoapcgiPortType_Stub.databaseLogon(TtsoapcgiPortType_Stub.java:802)
    ... 2 more
    I searched the web and found that this is a proxy setting proble.
    I configured apache earlier to use the local host that run the web client.
    When I change the http port host and port number and try to login into the web client its giving me page not found error.So I changed the proxy settings to default and then restarted the system and then tried to log into the web client and it worked.
    I dont know where i am going wrong.I want to consume the WSDL and log into the web client but i am gettingthe above error.
    Anyone's help will be greatly appreciated.
    Thank You,
    Sravanthi.

    Where did you get the address: http://sal006.salnetwork.com:82/bin/lccountrycodes.cgi (shouldn't the 82 be 83 instead?)

  • UnknownHostException AS2

    Hi Experts,
    I am connecting PI 7.1 and 4PL External system using AS2 adapter,
    I am getting the below error :
    13 16:15:26     Error     Message could not be forwarded to the JCA adapter. Reason: Fatal exception: javax.resource.ResourceException: SEEBURGER AS2: java.net.UnknownHostException: http # , SEEBURGER AS2: java.net.UnknownHostException: http #
    2010-07-13 16:15:26     Error     Adapter Framework caught exception: Fatal exception: javax.resource.ResourceException: SEEBURGER AS2: java.net.UnknownHostException: http # , SEEBURGER AS2: java.net.UnknownHostException: http #
    2010-07-13 16:15:26     Error     Delivering the message to the application using connection AS2_http://seeburger.com/xi failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: javax.resource.ResourceException: Fatal exception: javax.resource.ResourceException: SEEBURGER AS2: java.net.UnknownHostException: http # , SEEBURGER AS2: java.net.UnknownHostException: http # .
    2010-07-13 16:15:26     Error     The message status was set to NDLV.
    What is the error? How to resolve it? Please reply.. Thanks!
    Best Regards,
    Bijal

    Hi Bijal,
    Possible Cause:
    The AS2 adapter is unable to resolve the used DNS name of the partneru2019s AS2 server.
    Possible Solution:
    Check if the system is able to resolve the name of the remote host using nslookup <host name> or ping <hostname> (pings are often blocked by firewalls!). If the name is unknown to the used DNS server, you have to check with the network administrator (On DMZ machines it is quite common that no DNS is available.)
    Using the IP instead of the host name might not always be a good idea, because of the SSL host name check that is performed by the AS2 adapter. Otherwise the following error might occur: u201Cjavax.net.ssl.SSLException: Name in certificate <certificate> does not match host name <hostname>.
    regards,
    Daniel

  • Running an HTTPS Client application...

    Hello,
    I have configured the Tomcat 3.4 to act as an HTTPS Server now.
    I start up Tomcat and then when I try to run the application from the command line ,i get the Error:
    java HTTPSClient <Enter>
    Exception : java.net.UnknownHostException:https://localhost:8443/AHTTP/index.html.
    Please can any one explain why am I getting error?
    My HTTPSClient code is:
    Connects to a secure HTTPS Server,
    print out file contents */
    import java.net.*;
    import java.io.*;
    import java.security.*;
    import javax.net.ssl.*;
    import java.util.*;
    public class HTTPSClient {
    public static void main(String[] args) throws MalformedURLException{
    String secureURL = "https://localhost:8443/AHTTP/index.html";
    int port = 8443; // HTTPS Port on the Host.
    try
    Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
    SSLSocketFactory sslFact = (SSLSocketFactory)SSLSocketFactory.getDefault();
    SSLSocket socket = (SSLSocket) sslFact.createSocket(secureURL,port);
    System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
    java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
    URL url = new URL(secureURL);
    BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
    String line;
    while ((line = br.readLine()) != null)
    System.out.println(line);
    br.close();
    }catch(IOException e)
    {System.out.println("Exception Caught : " + e.toString());}
    } // End of Class.
    Please can anyone help me out with this?
    Regards
    Ajay Luthria
    } // End of Class HTTPSClient

    This exception is thrown because of:
    1. Either you have not created any certificates with private & public keys.
    or
    2. The certificates on the server & client side do not match.
    To create certificates you can use the tool 'keytool' provided by jdk(i use jdk1.4 beta).
    The syntax & documentation for keytool and JSSE is provided in the JDK1.4beta documentation.
    If you already have a certificate, you have to set the program to read the certificate from the keystore.
    This is done by adding command line parameters to while running the program.
    i.e
    java -Djavax.net.ssl.trustStore=<path to keystore> <prog name> <arguments>
    You can also get debugging info. of the authentication process by adding the parameter:
    -Djavax.net.debug=all

  • Error in AS2 Adapter

    Hi All,
    I am sending files through AS2 Adapter but I see the status message as
    Could not deliver as2 message to partner: java.net.UnknownHostException: http # null. Can any one tell me what is causing this error ?
    Thanks
    Laks
    Edited by: lakshmi s on May 5, 2009 8:30 PM

    Hi Prakash,
    1. I checked the configuration as you said. I haven't it checked the " Deliver Transmission Report"
    Is it mandatory to use this check box. Its for what purpose. ?
    2. I also tested by selecting No action in Handle MDN part. Now i see success status in Message Monitor .
    What i want to know is " is ot necessary to receive MDN " But i am not doing anything with that MDN.
    Kindly let me know answers for my 2 questions .
    Thanks
    Laks

  • Need help with SSL

    Hi, want to establish the SSL connection with client authentication.
    I have Server`s certificate in JKS (name 'serv_trust', no password)
    and my certificate in P12 (client.p12)
    So, i have some exceptions executing my application:
    Sorry for my english.
    java.net.UnknownHostException: https://online.serv.com
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
         at java.net.Socket.connect(Socket.java:452)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(DashoA12275)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(DashoA12275)
         at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(DashoA12275)
         at SSLSocketClientWithClientAuth.main(SSLSocketClientWithClientAuth.java:40)
    And my code:
          System.setProperty
          ("javax.net.ssl.trustStore", "serv_trust");
          Security.addProvider((Provider)Class.forName
          ("com.sun.crypto.provider.SunJCE").newInstance());
          java.security.Security.addProvider
          (new com.sun.net.ssl.internal.ssl.Provider());
          System.setProperty("java.protocol.handler.pkgs",
          "com.sun.net.ssl.internal.www.protocol");
          try {
          System.setProperty ("javax.net.ssl.keyStoreType", "pkcs12");
          System.setProperty ("javax.net.ssl.keyStorePassword", "123456789");
          System.setProperty ("javax.net.ssl.keyStore", "client.p12");
          SSLSocketFactory factory =
          (SSLSocketFactory)SSLSocketFactory.getDefault();
          SSLSocket socket =
          (SSLSocket)factory.createSocket("https://online.serv.com", 443);
         socket.startHandshake();
             socket.startHandshake();
             PrintWriter out = new PrintWriter(
                          new BufferedWriter(
                          new OutputStreamWriter(
                               socket.getOutputStream())));
             out.println("GET ");
             out.println();
             out.flush();
             if (out.checkError())
              System.out.println(
                  "SSLSocketClient: java.io.PrintWriter error");
             BufferedReader in = new BufferedReader(
                            new InputStreamReader(
                            socket.getInputStream()));
             String inputLine;
             while ((inputLine = in.readLine()) != null)
              System.out.println(inputLine);
             in.close();
             out.close();
             socket.close();
    And debug:
    keyStore is : client.p12
    keyStore type is : pkcs12
    init keystore
    init keymanager of type SunX509
    found key for : my certificate
    chain [0] = [
    Version: V3
    Subject: [email protected], CN=www.myhost.com, OU=development, O=DK, L=City, ST=US, C=US
    Signature Algorithm: MD5withRSA, OID = 1.2.840.113549.1.1.4
    Key: SunJSSE RSA public key:
    public exponent:
    010001
    modulus:
    d6a408ae 36632041 0a5d9da4 edc4c98d 01be3fbd ad02ca8b 88445fcf 5de8b6c2
    cc60dc18 61f25cf3 fc9eba3c 637f6ca0 e933795c 6c74b8e9 bd158f51 ed5fe584
    e7566e56 894e215f fc1f492f 2fc4a21c 526edd31 4953ebab 6cb1c5b8 52d4d09f
    3bd8abf1 8e71e1d4 3187a60f f5bcae58 98d11be3 b6108ba8 c1cbb6ac ff60b88d
    Validity: [From: Wed Dec 22 11:00:26 MSK 2004,
                   To: Thu Dec 22 11:00:26 MSK 2005]
    Issuer: [email protected], CN=Alexander Alexandrov, OU=IT Division, O=Company Ltd, L=City, ST=City, C=US
    SerialNumber: [    1a]
    Certificate Extensions: 4
    [1]: ObjectId: 2.16.840.1.113730.1.13 Criticality=false
    Extension unknown: DER encoded OCTET string =
    0000: 04 1F 16 1D 4F 70 65 6E 53 53 4C 20 47 65 6E 65 ....OpenSSL Gene
    0010: 72 61 74 65 64 20 43 65 72 74 69 66 69 63 61 74 rated Certificat
    0020: 65 e
    [2]: ObjectId: 2.5.29.14 Criticality=false
    SubjectKeyIdentifier [
    KeyIdentifier [
    0000: 57 5E 20 18 C6 CC 62 6F E6 E6 57 D9 0A 99 31 0E W^ ...bo..W...1.
    0010: E1 78 24 92 .x$.
    [3]: ObjectId: 2.5.29.35 Criticality=false
    AuthorityKeyIdentifier [
    KeyIdentifier [
    0000: CD 2D 38 1C 58 DE BC FC 2C B8 86 EC F6 2C 57 25 .-8.X...,....,W%
    0010: AD 89 28 65 ..(e
    [[email protected], CN=Alexander Alexandrov, OU=IT Division, O=Company Ltd, L=City, ST=City, C=US]
    SerialNumber: [    00]
    [4]: ObjectId: 2.5.29.19 Criticality=false
    BasicConstraints:[
    CA:false
    PathLen: undefined
    Algorithm: [MD5withRSA]
    Signature:
    0000: 82 D6 0F 08 32 98 42 80 1D D4 D6 50 5E 55 A2 B1 ....2.B....P^U..
    0010: D3 C2 11 40 65 39 3A 6C A3 6D 2E C5 A2 3B 2C 43 ...@e9:l.m...;,C
    0020: 96 B8 D3 13 9A F6 95 F8 9D C8 DA 56 7B 11 BD 75 ...........V...u
    0030: 1B 9E ED 18 B4 B9 E3 77 FE C4 49 A1 48 EC E5 93 .......w..I.H...
    0040: 95 C5 BD 6B 7F 5B A9 42 9E 22 FE 5A FE 2A 39 C2 ...k.[.B.".Z.*9.
    0050: C1 9C 96 E3 1E 25 AC 42 BE AF 1C F7 B6 83 48 0F .....%.B......H.
    0060: 2E 02 4E 99 37 1D 01 C6 87 E8 0E 57 DD C8 16 99 ..N.7......W....
    0070: E4 6B D1 D9 93 AD 57 C3 2A D9 41 92 72 25 D6 DF .k....W.*.A.r%..
    trustStore is: serv_trust
    trustStore type is : jks
    init truststore
    adding as trusted cert:
    Subject: [email protected], CN=Alexander Alexandrov, OU=IT Division, O=Company Ltd, L=City, ST=City, C=US
    Issuer: [email protected], CN=Alexander Alexandrov, OU=IT Division, O=Company Ltd, L=City, ST=City, C=US
    Algorithm: RSA; Serial number: 0x0
    Valid from Tue Sep 14 18:43:06 MSD 2004 until Wed Sep 14 18:43:06 MSD 2005
    init context
    trigger seeding of SecureRandom
    done seeding SecureRandom
    java.net.UnknownHostException: https://online.serv.com.ru
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
         at java.net.Socket.connect(Socket.java:452)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(DashoA12275)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(DashoA12275)
         at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(DashoA12275)
         at SSLSocketClientWithClientAuth.main(SSLSocketClientWithClientAuth.java:40)

    Please include your solution the next time you reply back...
    The problem is caused by including the protocol in the URL. In his example, he should have used "online.serv.com" as the host argument and not "https://online.serv.com".

  • Critical error with default host

    Hi,
    I am relatively new to Web Logic and think I have made an error within the Web Logic Console with the default host parameter. As a result, I can no longer start up my WLS.
    Is there a way I can edit this parameter outside of the Web Logic Console?
    The error from the logs is below:
    ####<01-May-2012 12:22:30 o'clock BST> <Critical> <WebLogicServer> <AOKEEFF-GB> <AdminServer> <main> <<WLS Kernel>> <> <> <1335871350199> <BEA-000362> <Server failed. Reason:
    There are 1 nested errors:
    java.net.UnknownHostException: http://127.0.0.1
         at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
         at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:850)
         at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1201)
         at java.net.InetAddress.getAllByName0(InetAddress.java:1154)
         at java.net.InetAddress.getAllByName(InetAddress.java:1084)
         at java.net.InetAddress.getAllByName(InetAddress.java:1020)
         at java.net.InetAddress.getByName(InetAddress.java:970)
         at weblogic.rjvm.JVMID.setLocalID(JVMID.java:238)
         at weblogic.rjvm.RJVMService.setJVMID(RJVMService.java:48)
         at weblogic.rjvm.RJVMService.start(RJVMService.java:30)
         at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Thanks

    Along the lines that Fabian suggested, this is what you can do now.
    Create a new domain and compare the config.xml of that new domain with the existing one you have issues with. This should give you the an indication of the changes that need to be reverted from the existing config.xml.
    And as already suggested, always take a back of the config.xml before you make any changes. :)
    Thanks,
    Patrick

  • Problem with SSL socket(SSLSocketFactoryImpl.createSocket())

    Hello,
    I'm trying to create a ssl socket but I get an exception, I really don't know why. I have alredy include the certificate via keytool to my jdk. And I'm able to get html header with URLConnection with the code below
    import java.net.URL;
    import java.net.URLConnection;
    public class testClass {
         public static void main(String[] args) throws Exception {
              try{
                   URL url = new URL("https://ippbx1:8443/axl/");
                   String userPassword = "****" + ":" + "****";
                   String encoding = new sun.misc.BASE64Encoder().encode (userPassword.getBytes());
                   URLConnection c = url.openConnection();
                   c.setRequestProperty("Authorization", "Basic " + encoding);
                   for (int i=0; ; i++)
                        String name = c.getHeaderFieldKey(i);
                        String value = c.getHeaderField(i);
                        if (name == null && value == null)     // end of headers
                             break;        
                        if (name == null)     // first line of headers
                             System.out.println("Server HTTP version, Response code:");
                             System.out.println(value);
                             System.out.print("\n");
                        else
                             System.out.println(name + "=" + value);
              catch (Exception e) {}
    }and I get the following result :
    Server HTTP version, Response code:
    HTTP/1.1 200 OK
    Server=Apache-Coyote/1.1
    Pragma=No-cache
    Cache-Control=no-cache
    Expires=Thu, 01 Jan 1970 01:00:00 CET
    Set-Cookie=JSESSIONIDSSO=77670D5480DAD295C6519E812F9FED64; Path=/
    Set-Cookie=JSESSIONID=B71BDB730FA5B3B431D3B16C41E190E3; Path=/axl; Secure
    Content-Type=text/html;charset=ISO-8859-1
    Content-Length=233
    Date=Wed, 10 Jun 2009 15:17:10 GMTBut when I try to make a socket :
    import java.io.*;
    import java.net.*;
    import javax.net.SocketFactory;
    import javax.net.ssl.SSLSocketFactory;
    public class axlforward {
         public static void main(String[] args) {
    String address = "https://ippbx1:8443/axl/";        
              int portnum = 8443;
    try
                   SocketFactory socketFactory = SSLSocketFactory.getDefault();
                   Socket socket = socketFactory.createSocket(address, portnum);
    } catch (Exception e) {e.printStackTrace();} I get the following
    java.net.UnknownHostException: https://ippbx1/axl/
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
         at java.net.Socket.connect(Socket.java:519)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:550)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:353)
         at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:71)
         at axlforward.main(axlforward.java:89)I have a VB program that connects to the socket(with Inet1.Protocol = icHTTPS and Inet1.Execute strURL, "Post", strFormData, strFormHdr methods) and do what I want but I need to do it in Java but I'm not able to find the error.
    the server socket is a Cisco callManager Service(AXL Web Service) which receives and html+SOAP request and sends back an xml response and this server socket is running correctly with no problem.
    Thanks for your help.

    Jdevelopper8709 wrote:
    Thanks for your reply.
    I now can access to my socket and get the information I want with:
    SocketFactory socketFactory = SSLSocketFactory.getDefault();
                   socket = (SSLSocket) socketFactory.createSocket("ippbx1", 8443);In fact the problem was a username/password issue.
    Thanks.I quote from reply #1 "The address is just "ippbx1" and not "https://ippbx1:8443/axl/". The protocol is not part of the IP address.".

  • SalesForce and Crystal error

    When I try to run a report created with Crystal 2008 V12.3.0.601 that uses data from SalesForce, I get the following two errors.
    - Failed to retrieve data from the database.
    - Database Connector Error: 'Unexpected'
    This report also contains multiple subreports that also pull from SalesForce and when I run those by themselves, they work just fine.  The query/report on the main report that errors out in Crystal runs just fine in SalesForce.
    I have reviewed some postings about changing the CRConfig file and those changes have not helped fix the error.
    Specifics for my computer:
    Win 7 - 64-bit
    16GB memory
    465 GB free HD space
    Crystal Reports 2008 v12.3.0.601*
    * I have also tried running the report a Win 7 - 32bit with 4GB memory & 297 GB free HD space using CR 2011 and get the same error.
    All reports reside on a network server.
    I have attached the CRconifg file.  Is there something else that I need to change in here like a java path?
    Thanks
    Glen Rogers

    Hi Glen
    When I use the search term 'crystal salesforce fail' in the search box in the top right corner, I get the following KBAs that may help:
    1825387 - Logon failed. Details: Unexpected error; nested exception is: Java.net.UnknownHostException:https
    1639310 - Crystal Reports 2011 SP02 failed to connect to salesforce.com. Error: Failed to Open the connection Details:Unexpected Error
    1978931 - Logon Failed error while connecting Crystal Reports 2013 to SalesForce.com
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • Send email from Hotmail

    Hi,
    When I use the string "http://services.msn.com/svcs/hotmail/httpmail.asp" as outgouing mail in the my Java-application I obtain "Error connection:
    java.net.UnknownHostException: http://services.msn.com/svcs/hotmail/ httpmail.asp". Help me,please solve this problem.
    Best regards,Vadim.

    You are trying to connect to a asp page for your smtp connection.
    Find the correct name for your smtp server and replace the url.
    Your ISP should have given you SMTP, POP#/IMAP, and NNTP servers to uses.

  • Starting Sample CMSXDB

    Hello *,
    I have installed the Sample CMS for Oracle XML DB. If I run CMSProject.jpr I get the login page where the login as cmsadmin is possible. But if I want to sign up a new user I get the error:
    Stack Trace :
    oracle.otnsamples.cmsxdb.exception.CMSAccessException: Error sending request : java.net.UnknownHostException: http
         at oracle.otnsamples.cmsxdb.useraction.ServletUtils.sendRequest(ServletUtils.java:165)
         at oracle.otnsamples.cmsxdb.useraction.DataUtils.serveRequest(DataUtils.java:330)
         at Contents.jspService(Contents.jsp:446)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:347)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    How can I solve this problem? Is there anyone who had installed CMSXDB successfully? If I deploy transformservlet.deploy I get some errors too. But I think thats only relevant when transforming some XML content?
    Thanks in advance,
    Lars Geldner

    Hello *,
    I have installed the Sample CMS for Oracle XML DB. If I run CMSProject.jpr I get the login page where the login as cmsadmin is possible. But if I want to sign up a new user I get the error:
    Stack Trace :
    oracle.otnsamples.cmsxdb.exception.CMSAccessException: Error sending request : java.net.UnknownHostException: http
         at oracle.otnsamples.cmsxdb.useraction.ServletUtils.sendRequest(ServletUtils.java:165)
         at oracle.otnsamples.cmsxdb.useraction.DataUtils.serveRequest(DataUtils.java:330)
         at Contents.jspService(Contents.jsp:446)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:347)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    How can I solve this problem? Is there anyone who had installed CMSXDB successfully? If I deploy transformservlet.deploy I get some errors too. But I think thats only relevant when transforming some XML content?
    Thanks in advance,
    Lars Geldner

  • Failed to read WSDL - connectException and unknownHostException

    Hi Guys,
    I am starting out with a new installation of SOA Suite 10g on my local windows machine.
    I've tested out a simple BPEL process deployment and all works fine.
    My next step is to test an Invoke of an external webservice: http://www.w3schools.com/webservices/tempconvert.asmx?WSDL
    Initially I had to setup proxy of my Jdev installation to get JDev to look at this WSDL (could not validate the WSDL without this):
    Proxy: 10.176.227.40
    Port: 8080
    Exceptions: |D701341|d701341|localhost
    But when I tried to deploy the BPEL process from jDev, I got an UnknownHostException:
    BUILD FAILED
    C:\jdev10g\jdev\mywork\NetworkRailSHLApplication\Pilot2\build.xml:78: A problem occured while connecting to server "localhost" using port "8888": bpel_Pilot2_1.0.jar failed to deploy. Exception message is: ORABPEL-05215
    Error while loading process.
    The process domain encountered the following errors while loading the process "Pilot2" (revision "1.0"): Failed to read wsdl.
    Error happened when reading wsdl at "C:\soa10gdemo\bpel\domains\default\tmp\.bpel_Pilot2_1.0_e0b22fe325615e2ac6bf1710ef089616.tmp\ExternalWS.wsdl", because "Error reading import of file:/C:/soa10gdemo/bpel/domains/default/tmp/.bpel_Pilot2_1.0_e0b22fe325615e2ac6bf1710ef089616.tmp/ExternalWS.wsdl: Failed to read wsdl file at: "http://www.w3schools.com/webservices/tempconvert.asmx?WSDL", caused by: java.net.UnknownHostException. : www.w3schools.com: www.w3schools.com".
    Make sure wsdl exists at that URL and is valid.
    After searching a bit on the forums, found out that I might have to fiddle with my HOSTS file: C:\WINNT\system32\drivers\etc\hosts
    I added the following line to my hosts file:
    127.0.0.1 localhost
    216.128.29.26     www.w3schools.com
    This time when I tried to deploy the same process, got a ConnectException:
    BUILD FAILED
    C:\jdev10g\jdev\mywork\NetworkRailSHLApplication\Pilot2\build.xml:78: A problem occured while connecting to server "localhost" using port "8888": bpel_Pilot2_1.0.jar failed to deploy. Exception message is: ORABPEL-05215
    Error while loading process.
    The process domain encountered the following errors while loading the process "Pilot2" (revision "1.0"): Failed to read wsdl.
    Error happened when reading wsdl at "C:\soa10gdemo\bpel\domains\default\tmp\.bpel_Pilot2_1.0_e0b22fe325615e2ac6bf1710ef089616.tmp\ExternalWS.wsdl", because "Error reading import of file:/C:/soa10gdemo/bpel/domains/default/tmp/.bpel_Pilot2_1.0_e0b22fe325615e2ac6bf1710ef089616.tmp/ExternalWS.wsdl: Failed to read wsdl file at: "http://www.w3schools.com/webservices/tempconvert.asmx?WSDL", caused by: java.net.ConnectException. : Connection timed out: connect".
    Make sure wsdl exists at that URL and is valid.
    I can visit view WSDL from my Internet Explorer with the same proxy config as mentioned above.
    I am not sure how do I get my local SOA Suite to talk to the external web service.
    Could someone point me in the right direction please?
    Thanks,
    Ravi

    I am also facing the similar kind of issue. Please suggest a solution

  • Error while XI and xMII integration (Plain HTTP as sender)

    Dear Friends,
       I am doing the scenario XI and xMII integration. While sending the input file from plain HTTP adapter the result comes as follows in *sxmb_moni* :
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <!-- Call Adapter -->
    <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
    <SAP:Category>XIAdapterFramework</SAP:Category>
    <SAP:Code area="MESSAGE">GENERAL</SAP:Code>
    <SAP:P1/>
    <SAP:P2/>
    <SAP:P3/>
    <SAP:P4/>
    <SAP:AdditionalText>com.sap.aii.af.ra.ms.api.DeliveryException: <xMII server name></SAP:AdditionalText>
    <SAP:ApplicationFaultMessage namespace=""/>
    <SAP:Stack/>
    <SAP:Retry>M</SAP:Retry>
    </SAP:Error>
    In HTTP Client Adapter for XI 3.0 it is shown as follows:
    <SAP:Error><SAP:Category>XIAdapterFramework</SAP:Category><SAP:Code>MESSAGE.GENERAL
    </SAP:Code>
    <SAP:AdditionalText>com.sap.aii.af.ra.ms.api.DeliveryException: <xMII server name> </SAP:AdditionalText></SAP:Error>
    Please show the way to rectify this error.
    Regards,
    Jagan.

    Dear Sudharshan,
       I'm doing the scenario which is in the following blog.
    /people/dhanabal.thangavel/blog/2008/02/07/xi-and-xmii-integration--part-1 ==> XI and xMII Integration - Part 1
    This is a synchronous one. So I set QOS as BE in Client Http Adapter for XI 3.0.
    Scenario is HTTP <--> XI <--> xMII
    The following errors are I found:
    1) In RWB -> Message Monitoring
    Status : Canceled with Errors
    Message Details:
    SOAP : call failed
    SOAP :error occured: java.net.UnknownHostException: <HOST>
    Exception caught by adapter framework: <HOST>
    Delivery of the message to the application using connection AFW failed, due to: <HOST>. Setting message to status failed
    The message status set to FAIL.
    Returning synchronous error message to calling application: <HOST>.
    2) Error coming in the Client Http Adapter for XI 3.0 as follows:
    *URL:*
    http://xxxxxx07:xx10/sap/xi/adapter_plain?namespace=http%3A//www.xxxxxxx.com/XIBatch3/10099/xMII_Integration&interface=xMII_Integration_Sync_Outbound&service=BS_BATCH3&party=&agency=&scheme=&QOS=BE&sap-user=xxxxx&sap-password=xxxxx&sap-client=xx1&sap-language=EN
    *Result:*
    <SAP:Error><SAP:Category>XIAdapterFramework</SAP:Category><SAP:Code>MESSAGE.GENERAL</SAP:Code><SAP:AdditionalText>com.sap.aii.af.ra.ms.api.DeliveryException:<HOST></SAP:AdditionalText></SAP:Error>
    *Input XML file:*
    <?xml version="1.0" encoding="UTF-8"?>
    <ns1:XacuteRequest xmlns:ns1="http://www.lighthammer.com/Xacute">
       <ns1:LoginName/>
       <ns1:LoginPassword/>
       <ns1:InputParams>
          <ns1:ProductName>ProductA1</ns1:ProductName>
       </ns1:InputParams>
    </ns1:XacuteRequest>
    *WSDL file (Which is generated using the xMII transaction):*
    <?xml version="1.0" encoding="UTF-8"?><definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://www.lighthammer.com/Xacute" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://www.lighthammer.com/Xacute">
        <!-- Types -->
        <types>
            <s:schema elementFormDefault="qualified" targetNamespace="http://www.lighthammer.com/Xacute">
                <s:complexType name="InputParams">
                    <s:sequence id="InputSequence">
                    <s:element maxOccurs="1" minOccurs="0" name="ProductName" type="s:string"/></s:sequence>
                </s:complexType>
                <s:element name="XacuteRequest">
                    <s:complexType>
                        <s:sequence>
                            <s:element maxOccurs="1" minOccurs="0" name="LoginName" type="s:string"/>
                            <s:element maxOccurs="1" minOccurs="0" name="LoginPassword" type="s:string"/>
                            <s:element maxOccurs="1" minOccurs="0" name="InputParams" type="s0:InputParams"/>
                        </s:sequence>
                    </s:complexType>
                </s:element>
                <s:complexType name="Rowsets">
                    <s:sequence>
                        <s:element maxOccurs="1" minOccurs="0" name="FatalError" type="s:string"/>
                        <s:element maxOccurs="1" minOccurs="0" name="Messages" type="s0:Messages"/>
                        <s:element maxOccurs="1" minOccurs="0" name="Rowset" type="s0:Rowset"/>
                    </s:sequence>
                    <s:attribute name="StartDate" type="s:dateTime" use="required"/>
                    <s:attribute name="EndDate" type="s:dateTime" use="required"/>
                    <s:attribute name="DateCreated" type="s:dateTime" use="required"/>
                    <s:attribute name="Version" type="s:string"/>
                </s:complexType>
                <s:complexType name="Messages">
                    <s:sequence>
                        <s:element maxOccurs="unbounded" minOccurs="0" name="Message" type="s:string"/>
                    </s:sequence>
                </s:complexType>
                <s:complexType name="Columns">
                    <s:sequence>
                        <s:element maxOccurs="unbounded" minOccurs="0" name="Column" type="s0:Column"/>
                    </s:sequence>
                </s:complexType>
                <s:complexType name="Column">
                    <s:attribute name="Name" type="s:string" use="required"/>
                    <s:attribute name="Description" type="s:string" use="required"/>
                    <s:attribute name="SourceColumn" type="s:string" use="required"/>
                    <s:attribute name="MinRange" type="s:double" use="required"/>
                    <s:attribute name="MaxRange" type="s:double" use="required"/>
                    <s:attribute name="SQLDataType" type="s:int" use="required"/>
                </s:complexType>
                <s:complexType name="Rowset">
                    <s:sequence>
                        <s:element maxOccurs="1" minOccurs="1" name="Columns" type="s0:Columns"/>
                        <s:element maxOccurs="unbounded" minOccurs="0" name="Row" type="s0:Row"/>
                    </s:sequence>
                </s:complexType>
                <s:complexType name="Row">
                    <s:sequence id="RowSequence">
                    <s:element maxOccurs="1" minOccurs="1" name="Quantity" type="s:long"/><s:element maxOccurs="1" minOccurs="1" name="ProductName" type="s:string"/></s:sequence>
                </s:complexType>
                <s:element name="XacuteResponse">
                    <s:complexType>
                        <s:sequence>
                            <s:element maxOccurs="1" minOccurs="0" name="Rowsets" type="s0:Rowsets"/>
                        </s:sequence>
                    </s:complexType>
                </s:element>
            </s:schema>
        </types>
        <!-- Messages -->
        <message name="XacuteSoapIn">
            <part element="s0:XacuteRequest" name="parameters"/>
        </message>
        <message name="XacuteSoapOut">
            <part element="s0:XacuteResponse" name="parameters"/>
        </message>
        <!-- Ports -->
        <portType name="XacuteWSSoap">
            <operation name="Xacute">
                <input message="s0:XacuteSoapIn"/>
                <output message="s0:XacuteSoapOut"/>
            </operation>
        </portType>
        <!-- Bindings -->
        <binding name="XacuteWSSoap" type="s0:XacuteWSSoap">
            <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
            <operation name="Xacute">
                <soap:operation soapAction="http://www.lighthammer.com/Xacute" style="document"/>
                <input>
                    <soap:body use="literal"/>
                </input>
                <output>
                    <soap:body use="literal"/>
                </output>
            </operation>
        </binding>
        <!-- Service mapping -->
        <service name="XacuteWS">
            <port binding="s0:XacuteWSSoap" name="XacuteWSSoap">
                <soap:address location="http://<XMII_SERVER_NAME>/Lighthammer/SOAPRunner/Jagan/SDN_Fetch_Product_Qty"/>
            </port>
        </service>
    </definitions>
    Regards,
    Jagan.

  • How to send a HTTP request to servlet in java application

    I'm new in Java. I need to send a HTTP request with parameters to servlet in a java aplication. Here is my code. It can be compiled but always threw an exceptions when I ran it. Can anyone help?
    package coreservlets;
    import java.io.*;
    import java.net.*;
    public class PostHTTP
         public static void main(String args[])
              throws IOException, UnknownHostException {
              try
              // URL and servlet
                   URL myURL = new URL("http://pc076/servlet/coreservlets.OffHold");
                   URLConnection c = myURL.openConnection();
                   c.setUseCaches(false);
                   c.setDoOutput(true);
                   ByteArrayOutputStream byteStream = new ByteArrayOutputStream(512);
                   PrintWriter out = new PrintWriter(byteStream, true);
    //parameters
                   String postData = "REASON_CODE=3B&RSPCODE=JSmith&CASENUM=NA795401&REPLY=123&SOURCE=XYZ&REPLYLINK=http://pc076/servlet/coreservlets.ShowParameters";
                   out.print(postData);
                   out.flush();
                   String lengthString = String.valueOf(byteStream.size());
                   c.setRequestProperty("Content-Length", lengthString);
                   c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
                   byteStream.writeTo(c.getOutputStream());
                   BufferedReader in =     new BufferedReader(new InputStreamReader
                                                 (c.getInputStream()));
                   String line;
                   //String linefeed = "\n";
                   //resultsArea.setText("");
                   while((line = in.readLine()) != null) {
                        System.out.println(line);
                        //resultsArea.append(linefeed);
              catch(IOException ioe) {
              // Print debug info in Java Console
              System.out.println("IOException: " + ioe);

    here are some updates to your code I haven't tested it running
    post again if you still have trouble
    URL myURL = new URL("http://pc076/servlet/coreservlets.OffHold");
    HttpURLConnection c = (HttpURLConnection)myURL.openConnection();
    c.setDoInput(true);
    c.setDoOutput(true);
    ByteArrayOutputStream byteStream = new ByteArrayOutputStream(512);
    String lengthString = String.valueOf(byteStream.size());
    c.setRequestProperty("Content-Length", lengthString);
    c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    PrintWriter out = new PrintWriter(byteStream, true);
    //parameters
    String postData = "REASON_CODE=3B&RSPCODE=JSmith&CASENUM=NA795401&REPLY=123&SOURCE=XYZ&REPLYLINK=http://pc076/servlet/coreservlets.ShowParameters";
    out.print(postData);
    out.flush();
    byteStream.writeTo(c.getOutputStream());
    // connect
    c.connect();
    BufferedReader in = new BufferedReader(new InputStreamReader
    (c.getInputStream()));
    String line;
    while((line = in.readLine()) != null)
        System.out.println(line);

  • Can any body help me in reading from HTTPS URL

    I need to read an HTTPS URL and store the response within a table .
    How will I manage to do it from within a servlet using URLConnection and openStream as it does'nt work .
    How will JSSE help in this regard .
    Since I also need to give the userid and password to get into the file and read the file
    https://anyhost.com/readthisfile.html
    somnath
    Web Developer

    Hi,
    The Java Secure Socket Extension (JSSE) library from Sun Microsystems lets you access a secure Web server from behind a firewall via
    proxy tunneling. To do this, the JSSE application needs to set the https.ProxyHost and https.ProxyPort system properties. The
    tunneling code in JSSE checks for "HTTP 1.0" in the proxy's response. If your proxy, like many, returns "HTTP 1.1", you will get an
    IOException. In this case, you need to implement your own HTTPS tunneling protocol.
    In this article, I will show you how to create a secure socket that tunnels through the firewall, and pass it to the HTTPS stream handler to
    open HTTPS URLs using the URLConnection class.
    Open the http tunnel socket to the proxy
    The first step to creating your secure socket is to open the tunneling socket to the proxy port. The code needed to do this proxy
    handshaking can be found in the sample code SSLClientSocketWithTunneling.java that comes with the JSSE distribution. First, a normal socket is created that connects to
    the proxy port on the proxy host (line 65). After the socket is created, it is passed to the doTunnelHandshake() method where the proxy's tunneling protocol is called:
    54 SSLSocketFactory factory =
    55 (SSLSocketFactory)SSLSocketFactory.getDefault();
    56
    57 /*
    58 * Set up a socket to do tunneling through the proxy.
    59 * Start it off as a regular socket, then layer SSL
    60 * over the top of it.
    61 */
    62 tunnelHost = System.getProperty("https.proxyHost");
    63 tunnelPort = Integer.getInteger("https.proxyPort").intValue();
    64
    65 Socket tunnel = new Socket(tunnelHost, tunnelPort);
    66 doTunnelHandshake(tunnel, host, port);
    In doTunnelHandshake(), an http "CONNECT" command is sent to the proxy, with the secure site's hostname and port number as the parameters (line 161). In the original
    tunneling code on line 206 in JSSE, it then checks for "HTTP/1.0 200" in the proxy's reply. If your organization's proxy replies with "HTTP 1.1", an IOException will be
    thrown. To get around this, the code here checks for the reply "200 Connection Established", which indicates that tunneling is successful (line 207). You can modify the
    code to check for the expected corresponding response from your proxy:
    139 private void doTunnelHandshake(Socket tunnel, String host, int port)
    140 throws IOException
    141 {
    142 OutputStream out = tunnel.getOutputStream();
    143 String msg = "CONNECT " + host + ":" + port + " HTTP/1.0\n"
    144 + "User-Agent: "
    145 + sun.net.www.protocol.http.HttpURLConnection.userAgent
    146 + "\r\n\r\n";
    147 byte b[];
    148 try {
    149 /*
    150 * We really do want ASCII7 -- the http protocol doesn't change
    151 * with locale.
    152 */
    153 b = msg.getBytes("ASCII7");
    154 } catch (UnsupportedEncodingException ignored) {
    155 /*
    156 * If ASCII7 isn't there, something serious is wrong, but
    157 * Paranoia Is Good (tm)
    158 */
    159 b = msg.getBytes();
    160 }
    161 out.write(b);
    162 out.flush();
    163
    164 /*
    165 * We need to store the reply so we can create a detailed
    166 * error message to the user.
    167 */
    168 byte reply[] = new byte[200];
    169 int replyLen = 0;
    170 int newlinesSeen = 0;
    171 boolean headerDone = false; /* Done on first newline */
    172
    173 InputStream in = tunnel.getInputStream();
    174 boolean error = false;
    175
    176 while (newlinesSeen < 2) {
    177 int i = in.read();
    178 if (i < 0) {
    179 throw new IOException("Unexpected EOF from proxy");
    180 }
    181 if (i == '\n') {
    182 headerDone = true;
    183 ++newlinesSeen;
    184 } else if (i != '\r') {
    185 newlinesSeen = 0;
    186 if (!headerDone && replyLen < reply.length) {
    187 reply[replyLen++] = (byte) i;
    188 }
    189 }
    190 }
    191
    192 /*
    193 * Converting the byte array to a string is slightly wasteful
    194 * in the case where the connection was successful, but it's
    195 * insignificant compared to the network overhead.
    196 */
    197 String replyStr;
    198 try {
    199 replyStr = new String(reply, 0, replyLen, "ASCII7");
    200 } catch (UnsupportedEncodingException ignored) {
    201 replyStr = new String(reply, 0, replyLen);
    202 }
    203
    204 /* We check for Connection Established because our proxy returns
    205 * HTTP/1.1 instead of 1.0 */
    206 //if (!replyStr.startsWith("HTTP/1.0 200")) {
    207 if(replyStr.toLowerCase().indexOf(
    208 "200 connection established") == -1){
    209 throw new IOException("Unable to tunnel through "
    210 + tunnelHost + ":" + tunnelPort
    211 + ". Proxy returns \"" + replyStr + "\"");
    212 }
    213
    214 /* tunneling Handshake was successful! */
    215 }
    Overlay http tunnel socket with SSL socket
    After you have successfully created the tunneling socket, you overlay it with the SSL socket. Again, this is not difficult to do:
    54 SSLSocketFactory factory =
    55 (SSLSocketFactory)SSLSocketFactory.getDefault();
    56
    57 /*
    58 * Set up a socket to do tunneling through the proxy.
    59 * Start it off as a regular socket, then layer SSL
    60 * over the top of it.
    61 */
    62 tunnelHost = System.getProperty("https.proxyHost");
    63 tunnelPort = Integer.getInteger("https.proxyPort").intValue();
    64
    65 Socket tunnel = new Socket(tunnelHost, tunnelPort);
    66 doTunnelHandshake(tunnel, host, port);
    67
    68 /*
    69 * Ok, let's overlay the tunnel socket with SSL.
    70 */
    71 SSLSocket socket =
    72 (SSLSocket)factory.createSocket(tunnel, host, port, true);
    73
    74 /*
    75 * register a callback for handshaking completion event
    76 */
    77 socket.addHandshakeCompletedListener(
    78 new HandshakeCompletedListener() {
    79 public void handshakeCompleted(
    80 HandshakeCompletedEvent event) {
    81 System.out.println("Handshake finished!");
    82 System.out.println(
    83 "\t CipherSuite:" + event.getCipherSuite());
    84 System.out.println(
    85 "\t SessionId " + event.getSession());
    86 System.out.println(
    87 "\t PeerHost " + event.getSession().getPeerHost());
    88 }
    89 }
    90 );
    The code had called the SSLSocketFactory's getDefault() method earlier to get an instance of the SSLSocketFactory (line 54, repeated above). Next, it passes the
    tunneling socket that was created in the previous step to the createSocket() method of the SSLSocketFactory. The createSocket() method returns an SSLSocket that is
    connected to the destination host and port via the proxy tunnel. You can optionally add a HandshakeCompletedListener to the socket if you wish to be informed when the
    SSL handshaking is completed.
    The SSLSocket created is basically ready for use to transfer secure contents. The startHandshake() method is called to start the SSL handshaking (line 98). After which, you
    can issue the http "GET" command to retrieve the secure pages (line 105):
    91
    92 /*
    93 * send http request
    94 *
    95 * See SSLSocketClient.java for more information about why
    96 * there is a forced handshake here when using PrintWriters.
    97 */
    98 socket.startHandshake();
    99
    100 PrintWriter out = new PrintWriter(
    101 new BufferedWriter(
    102 new OutputStreamWriter(
    103 socket.getOutputStream())));
    104
    105 out.println("GET http://www.verisign.com/index.html HTTP/1.0");
    106 out.println();
    107 out.flush();
    However, issuing http commands to the tunneling SSL socket to access Webpages is not ideal because it would mean having to rewrite the whole http protocol handler from
    scratch. Instead, you should use the HTTPS URL APIs that the JSSE already includes for that purpose. To do this, you have to pass the tunneling SSL socket to the HTTPS URL
    stream handler.
    Pass SSL socket to HTTPS URL stream handler
    The JSSE library has an HttpsURLConnection class that is in the com.sun.net.ssl package, which extends the java.net.URLConnection class. An HttpsURLConnection object
    is returned by the URL object's openConnection() method when "HTTPS" is specified as the protocol. The HttpsURLConnection class has a method, setSSLSocketFactory(),
    that lets you set an SSLSocketFactory of your choice. To pass the tunneling SSL socket to the HTTPS URL stream handler, you would set the setSSLSocketFactory()
    method's parameter with a socket factory that returns the tunneling SSL socket that you created previously.
    To do this, you would wrap the code discussed previously in an SSLTunnelSocketFactory class that extends from the SSLSocketFactory class. The SSLSocketFactory is an
    abstract class. To extend it, you must implement the createSocket() method to return the tunneling SSL socket that you created earlier:
    12 public SSLTunnelSocketFactory(String proxyhost, String proxyport){
    13 tunnelHost = proxyhost;
    14 tunnelPort = Integer.parseInt(proxyport);
    15 dfactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
    16 }
    44 public Socket createSocket(Socket s, String host, int port,
    45 boolean autoClose)
    46 throws IOException,UnknownHostException
    47 {
    48
    49 Socket tunnel = new Socket(tunnelHost,tunnelPort);
    50
    51 doTunnelHandshake(tunnel,host,port);
    52
    53 SSLSocket result = (SSLSocket)dfactory.createSocket(
    54 tunnel,host,port,autoClose);
    55
    56 result.addHandshakeCompletedListener(
    57 new HandshakeCompletedListener() {
    58 public void handshakeCompleted(HandshakeCompletedEvent event) {
    59 System.out.println("Handshake finished!");
    60 System.out.println(
    61 "\t CipherSuite:" + event.getCipherSuite());
    62 System.out.println(
    63 "\t SessionId " + event.getSession());
    64 System.out.println(
    65 "\t PeerHost " + event.getSession().getPeerHost());
    66 }
    67 }
    68 );
    69
    70 result.startHandshake();
    71
    72 return result;
    73 }
    Notice that the SSLTunnelSocketFactory contains a default SSLSocketFactory object. The default SSLSocketFactory object can be instantiated from a call to the static
    method getDefault() (line 15). You need this SSLSocketFactory object to overlay the tunnel socket with the SSL socket, as discussed earlier. You also call the default
    object's getDefaultCipherSuites() and getSupportedCipherSuites() methods when implementing the corresponding abstract methods of the SSLSocketFactory super
    class. For implementation details, please refer to the complete source code for the SSLTunnelSocketFactory in Resources.
    Tunnel through the proxy via URLConnection
    To tunnel through the proxy via URLConnection in your JSSE application, after you call the openConnection() method, check if the returned object is that of the
    HttpsURLConnection. If so, you instantiate your SSLTunnelSocketFactory object and set it in the setSSLSocketFactory() method (lines 22 through 25):
    10 public class URLTunnelReader {
    11 private final static String proxyHost = "proxy.sg.ibm.com";
    12 private final static String proxyPort = "80";
    13
    14 public static void main(String[] args) throws Exception {
    15 System.setProperty("java.protocol.handler.pkgs",
    16 "com.sun.net.ssl.internal.www.protocol");
    17 //System.setProperty("https.proxyHost",proxyHost);
    18 //System.setProperty("https.proxyPort",proxyPort);
    19
    20 URL verisign = new URL("https://www.verisign.com");
    21 URLConnection urlc = verisign.openConnection(); //from secure site
    22 if(urlc instanceof com.sun.net.ssl.HttpsURLConnection){
    23 ((com.sun.net.ssl.HttpsURLConnection)urlc).setSSLSocketFactory
    24 (new SSLTunnelSocketFactory(proxyHost,proxyPort));
    25 }
    26
    27 BufferedReader in = new BufferedReader(
    28 new InputStreamReader(
    29 urlc.getInputStream()));
    30
    31 String inputLine;
    32
    33 while ((inputLine = in.readLine()) != null)
    34 System.out.println(inputLine);
    35
    36 in.close();
    37 }
    38 }
    You can then access the HTTPS URLs using the APIs provided by the URLConnection class. You don't need to worry about the format of the http GET and POST commands,
    which you would if you used the SSL Socket APIs.
    The complete source code for the SSLTunnelSocketFactory and the application code that connects to a secure URL using proxy tunneling is included in Resources. To
    compile and run the application, you would need to download and install Sun's JSSE from its Website, also listed in Resources.
    Conclusion
    If your JSSE application could not tunnel through your organization's firewall, you need to implement your own tunneling socket. The sample code included with the JSSE
    distribution shows you how to open an SSL socket tunnel. This article goes one step further to show you how to pass the tunneling socket to the HTTPS URL stream handler,
    and saves you the trouble of rewriting a http handler
    I hope this will help you.
    Thanks
    Bakrudeen

Maybe you are looking for

  • Design Invoice in Crystal Report 8.5

    Hello, Crystal report is the software used to create reports and documents for the business software we use (it's built-in). We have received from the graphic designer a layout design in PDF vectorial format for the sales invoice, but we are having a

  • How to Create Table Using Column Drag and Drop Feature

    Hi: I am new to Oracle SQL dev Data Modeler tool and would like to know if there is a way to create a new table by re-using the existing columns or column groups. The idea is to maintain consistency and save table design time. If columns created prev

  • Mac Mini, no video after 10.5.7 upgrade

    I installed the 10.5.7 upgrade after reboot, had no video. I reset the smc and pmu then I got no power light and the fans raced. Reset pmu again and mini booted to grey screen with spinning indicator, then after a min or two the mac would just shut d

  • I have kindle fire and I get voice but no video wh...

    Why is it that my video doesn't work with the pre installed app

  • Have a SAVE button but disable Menu Save

    Hi there, I know how to create a SAVE button although is there any way to disable a user from being able to save through the menu. The problem I am having is that some users are using the SAVE in the menu which is overwriting the original form. I hav