Simple client - proxy - server toy program

Hi.
I haven't done many cs courses yet, lately i am reading on some introduction to network programming, and i thought i should create a simple toy program to test a bit.
Essentially i'd like to keep the communication between client and server using bytes, so i'll but input/output streams. At the same time, i'd like to have the proxy and server and client hosted on the same pc. So, i'll be using local IP's like 127.xx.xx.xx
Client part:
1. open a socket to connect to proxy
2. get input and output streams
3. use loop to write random data to output stream, and read feedbacks from inputstream.
Proxy Part
1. opens a server soc to listen to client
2. opens a soc to connect to server
3. create 2 service objects to take care of IO, one for upstream(to server) and other for downstream
4. display and verify content.
Server Part:
1. open a server socket to listen to connections
2. create a service object to take care of stream IO
3. display IO streams to counter verify with client IO
Questions:
1. When constructing a socket for client side, i should be including proxy IP and proxy listened_port as parameters right?
if I try to put in a local ip such as 127.99.99.99, and port number 5999. At the same time i set my proxy port_to_listen_to as 5999
how will I know which address represents my proxy?
Will any random local IP work?
Will a thread be more appropriate since i am using threads in proxy and server?
2. My understanding of proxy is that it is partly a server, and partly a client. But i am not sure if i am right to create 2 threads to handle upstream and downstream operations independently. I have tried to stay out of global/static variable so that i can avoid synchronization part.
3. As for the server side. i have similar issues regarding the IP address problems mentioned above.
Can some one help me sort out my concepts?

1. When constructing a socket for client side, i should be including proxy IP and proxy listened_port as parameters right?Yes.
if I try to put in a local ip such as 127.99.99.99, and port number 5999. At the same time i set my proxy port_to_listen_to as 5999
how will I know which address represents my proxy?That address represents your proxy.
Will any random local IP work?127.0.0.* will work. I don' t know about the others like 127.99.99.99.
Will a thread be more appropriate since i am using threads in proxy and server?Only if you have multiple connections in the client at the same time, or if the client's input and output are unco-ordinated. From your description it sounds like you are writing requests and reading responses, which you can do serially without threads.
2. My understanding of proxy is that it is partly a server, and partly a client. But i am not sure if i am right to create 2 threads to handle upstream and downstream operations independently.You are right.
3. As for the server side. i have similar issues regarding the IP address problems mentioned above.I don't know exactly what you mean by 'issues' or 'problems'. You can run the whole setup using 127.0.0.1, or 'localhost', with one listening port for the proxy and another for the server.

Similar Messages

  • Client-Proxy-Server:  Connection refused

    I was meddling with a client-proxy-server toy program.
    Pardon my poor code construction. I have never had any previous knowledge in this field.
    I have created  a client side program with my main that handles IO serially.
    ProxY consists of 2 unscynchronized threads each interacts with client and server respectively.
    Packet exchange within ProxY is relayed using a PacketBuffer object.
    Server consist of a single threaded service. Below is the code for my main.
    import java.io.IOException;
    import java.net.ServerSocket;
    import java.net.Socket;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Scanner;
    public class TestProxy
         public static void main(String[] args) throws IOException
              final int SERVER_PORT = 19989;
              final int PROXY_PORT = 19988;
              ServerSocket proxyServerSoc = new ServerSocket(PROXY_PORT);
              Socket proxyClientSoc = new Socket("127.0.0.9",SERVER_PORT); //127.0.0.9 is server IP
              Server serv = new Server(SERVER_PORT);                             //Server started
              ProxY prox = new ProxY(proxyClientSoc, proxyServerSoc);            //proxy started
              //Start Client side;
              Socket toProxy = new Socket("127.0.0.1", PROXY_PORT);
              InputStream in = toProxy.getInputStream();
              OutputStream out = toProxy.getOutputStream();
              Scanner keyboard = new Scanner(System.in);
              String input;
              while(true)
                   System.out.println("Enter data  : ");
                   input = keyboard.nextLine();
                   if(input.equals("exit")) break;
                   System.out.println("data in BYTE: "+input.getBytes());
                   System.out.println("Sending data to server ...");
                   out.write(input.getBytes());
                   try{
                        Thread.sleep(100);
                   catch(InterruptedException e)
                        e.printStackTrace();
                   System.out.println("Received from server :" + in.toString());
    }Compilation is a success, but there is a runtime error...
    When i attempt to run the program for the first time(tried on XP, Vista, 7, jdk1.6), windows prompts for network permission.
    Before i can [edit]unblock[edit] it, my console window shows following error
    C:\java\proxy>javac *.java
    C:\java\proxy>java TestProxy
    Exception in thread "main" java.net.ConnectException: Connection refused: connec
    t
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.PlainSocketImpl.doConnect(Unknown Source)
            at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
            at java.net.PlainSocketImpl.connect(Unknown Source)
            at java.net.SocksSocketImpl.connect(Unknown Source)
            at java.net.Socket.connect(Unknown Source)
            at java.net.Socket.connect(Unknown Source)
            at java.net.Socket.<init>(Unknown Source)
            at java.net.Socket.<init>(Unknown Source)
            at TestProxy.main(TestProxy.java:15)
    C:\java\proxy>Can someone advise me where might i be possibly wrong?
    Edited by: J-Ideas on Mar 10, 2010 10:50 PM

                   out.write(input.getBytes());
                   try{
                        Thread.sleep(100);
                   catch(InterruptedException e)
                        e.printStackTrace();
                   }What's that for?
                   System.out.println("Received from server :" + in.toString());No no no. 'in' is an input stream. in.toString() is just a string representation of that object. It certainly isn't anything received from the server. If you want to receive data from the server you must call one of the in.read() methods.
    When i attempt to run the program for the first time(tried on XP, Vista, 7, jdk1.6), windows prompts for network permission.
    Before i can [edit]unblock[edit] it, my console window shows following errorYou should separate your program into three: server, proxy, and client, each with their own main() methods, so you can deal with these problems one at a time.

  • Using ACE to load balance HTTP/S traffic between client & proxy server using tcp 8080

    Folks,
    I have a scenario where ACE is in load balancing connections to a bunch of Websense servers in a one-armed topology.  ACE presents a single VIP to web browser clients and each client's browser proxy configuration is populated with the VIP DNS name.  Traffic then gets load balanced between the Websense servers.  The problem arises due to Websense requiring the 'X-Forwarded-For' HTTP header in order to obtain the source IP of the client.  
    ACE inserts this header into the standard HTTP 'proxied' traffic but doing this for HTTPS traffic has required the configuration of the ACE SSL proxy client server.
    So the problem I have is this:
    How to configure ACE to load balance both HTTP & HTTPS applications using a single VIP and tcp port number ie tcp 8080
    The ACE hardware being used is ACE20-MOD-K9  -  MODULE
    I have attempted to use a L7 class map to match all ciphers and attach this to a L7 Policy-Map but the documentation highlights the fact the 'match cipher' configuration is only available on the ACE appliance.  
    I believe I am on the correct track.  The HTTPS traffic must be identified and used to match against PolicyA and HTTP traffic matched against PolicyB
    I'm looking for ideas!  I'm hopeful someone must have solved this problem previously!!
    Regards,
    Simon

    Hi Simon,
    The classification has to work on different ports. Whether client types http or https doesn't matter to client. His request will reach VIP which will classify the traffic based on port, protocol first and then it can look into further detail to send the traffic to appropriate serverfarm.
    You can class-map match-any xxxxx
    2 match virtual-address x.x.x.x tcp any
    and then you configure further classification on the basis of L7 like  url, header etc. 
    But again, you will still need SSL termination on ACE.
    Regards,
    Kanwal
    Note: Please mark answers if they are helpful.

  • Help me to sort out the problem in this Simple Client - Server problem

    Hi all,
    I have just started Network programming in java . I tried to write simple Client and Server program which follows
    MyServer :
    package connection;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.ServerSocket;
    import java.net.Socket;
    public class MyServer {
          * @param args
         public static void main(String[] args) {
              String ss ="";
              try {
                   ServerSocket sockServer = new ServerSocket(6000);
                   Socket clientLink = sockServer.accept();
                   System.out.println("Connection Established");
                   InputStreamReader isr = new InputStreamReader(clientLink.getInputStream());
                   BufferedReader bufReader = new BufferedReader(isr);
                   System.out.println("buf "+bufReader.readLine());
                   try {
                        while ((ss=bufReader.readLine())!=null) {
                             ss+=ss;
                        System.out.println("client message "+ss);
                   } catch (IOException e) {
                        System.out.println("while reading");
                        e.printStackTrace();
              } catch (IOException e) {
                   System.out.println("Can't able to connect");
                   e.printStackTrace();
    }MyClient:
    package connection;
    import java.io.IOException;
    import java.io.OutputStreamWriter;
    import java.io.PrintWriter;
    import java.net.Socket;
    public class MyClient {
          * @param args
         public static void main(String[] args) {
              try {
                   Socket client = new Socket("127.0.0.1",6000);
                   OutputStreamWriter osw = new OutputStreamWriter(client.getOutputStream());
                   PrintWriter pw = new PrintWriter(osw);
                   pw.write("hello");
              } catch (IOException e) {
                   System.out.println("Failed to connect");
                   e.printStackTrace();
    }I got this error message when I start my client program .
    Error message :
    Connection Established
    java.net.SocketException: Connection reset
         at java.net.SocketInputStream.read(Unknown Source)
         at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
         at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
         at sun.nio.cs.StreamDecoder.read(Unknown Source)
         at java.io.InputStreamReader.read(Unknown Source)
    Can't able to connect
         at java.io.BufferedReader.fill(Unknown Source)
         at java.io.BufferedReader.readLine(Unknown Source)
         at java.io.BufferedReader.readLine(Unknown Source)
         at connection.MyServer.main(MyServer.java:27)I think this is very simple one but can't able to find this even after many times . please help me to sort out this to get start my network programming .
    Thanks in advance.

                   System.out.println("buf "+bufReader.readLine());Here you are reading a line from the client and printing it.
                   try {
                        while ((ss=bufReader.readLine())!=null) {
                             ss+=ss;
                        }Here you are reading more lines from the client and adding it to itself then throwing it away next time around the loop.
                        System.out.println("client message "+ss);... so this can't print anything except 'null'.
                   pw.write("hello");Here you are printing one line to the server. So the server won't ever do anything in the readLine() loop above. Then you are exiting the client without closing the socket or its output stream so the server gets a 'connection reset'.

  • Build Proxy Server

    Hi to all microsoft visual studio lover and friends and masters
    i have a problem with run proxy server 
    when i run program. program freezing...
    please help me to complete the code
    code :
    try
    int port=8080;
    string ipaddress="127.0.0.1";
    ListBox alert=new ListBox();
    alert.Width = Form1.ActiveForm.Width;
    alert.Height = Form1.ActiveForm.Height;
    Controls.Add(alert);
    alert.Items.Add("Create Server");
    TcpListener TcpListner = new TcpListener(IPAddress.Parse(ipaddress), port);
    TcpListner.Start();
    alert.Items.Add("Server Started");
    TcpClient tcpclient = TcpListner.AcceptTcpClient();
    alert.Items.Add("Connection Accepted");
    catch (Exception ee) { }
    Thanks

    Hi ,
    I am not familiar with HTTP Proxy Server. Just search some sample about HTTP Proxy Server C# Source Code using
    TcpListener.
    Please have a try.
    using System.Net;
    using System.Net.Sockets;
    namespace SimpleHttpProxy
    class ServerListerner
    private int listenPort;
    private TcpListener listener;
    public ServerListerner(int port)
    this.listenPort = port;
    this.listener = new TcpListener(IPAddress.Any, this.listenPort);
    public void StartServer()
    this.listener.Start();
    public void AcceptConnection()
    Socket newClient = this.listener.AcceptSocket();
    ClientConnection client = new ClientConnection(newClient);
    client.StartHandling();
    How it works?
    namespace SimpleHttpProxy
    class Program
    static void Main(string[] args)
    ServerListerner simpleHttpProxyServer = new ServerListerner(9000);
    simpleHttpProxyServer.StartServer();
    while (true)
    simpleHttpProxyServer.AcceptConnection();
    Some more detailed information, please refer to
    Simple HTTP Proxy Server C# Source Code
    How to create proxy server between application and remote host
    How to develop a proxy server using DotNet?
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Fetching a URL  from a socket output or input stream in a proxy server

    We have written a proxy server in java .
    It connects with a client on some local port and forwards the request of the client to main server through socket connections.
    The code is as follows...
    * BasicProxyServer.java
    * A simple multithreaded proxy server.
    * A client connects to theserver. The server starts a
    * separate threads for data flow though two Sockets.
    * The first socket communicates with the socket of the client.
    * The second socket is used to communcate with the main server
    * for which this server is a proxy. The sockets are connected by pipes.
    import java.net.*;
    import java.io.*;
    public class BasicProxyServer {
         private static int serverPort;
         private static String primaryServerHost;
         private static int primaryServerPort;
         // 1st arg: port to listen on
         // 2nd arg: primary server IP
         // 3rd arg: primary server port
         public static void main(String [] args) {
              serverPort = Integer.parseInt(args[0]);
              primaryServerHost = args[1];
              primaryServerPort = Integer.parseInt(args[2]);
              BasicServer bserv = new BasicServer(serverPort,primaryServerHost,primaryServerPort);
    class BasicServer extends Thread {
         private int serverPort;
         private String primaryHost;
         private int primaryPort;
         private ServerSocket servSock = null;
         public BasicServer(int port, String primSrv, int primPort) {
              serverPort = port;
              primaryHost = primSrv;
              primaryPort = primPort;
              start();
         public void run() {
              Socket clientSock = null;
              Socket primaryServerSock = null;
              try {
                   servSock = new ServerSocket(serverPort);
              catch (IOException e) {
                   e.printStackTrace();
              while(true) {
                   try {
                        clientSock = servSock.accept();
                        primaryServerSock = new Socket(primaryHost, primaryPort);
                        PipedInputStream fromClient = new PipedInputStream();
                        PipedOutputStream toMainServer = new PipedOutputStream(fromClient);
                        PipedInputStream fromMainServer = new PipedInputStream();
                        PipedOutputStream toClient = new PipedOutputStream(fromMainServer);
                        Talk clientToMainServer = new Talk(clientSock, fromClient, primaryServerSock, toMainServer);
                        Talk mainServerToClient = new Talk(primaryServerSock, fromMainServer, clientSock, toClient);
                        clientToMainServer.start();
                        mainServerToClient.start();
                   catch (IOException e) {
                        e.printStackTrace();
         // Override finalize() to close server socket
    protected void finalize() {
    if (servSock != null) {
    try {
    servSock.close();
    } catch (IOException e) {
    e.printStackTrace();
    servSock = null;
    class Talk extends Thread {
         private Socket incoming;
         private Socket outgoing;
         private InputStream in;
         private OutputStream out;
         private InputStream from;
         private OutputStream to;
         Talk(Socket inSock, InputStream in, Socket outSock, OutputStream out) {
              this.in = in;
              this.out = out;
              incoming = inSock;
              outgoing = outSock;
         public void run() {
              int aByte;
              try {
                   from = incoming.getInputStream();
                   to = outgoing.getOutputStream();          
                   while(( aByte = from.read()) != -1 ) {     //read from socket
                        out.write(aByte);     // write to pipe`
                        // read the byte from the pipe
                        to.write(in.read());          // write it to the output socket stream
                        to.flush();
                   to.close();
                   from.close();
                   if(incoming != null) {
                        incoming.close();
                        incoming = null;
                   if(outgoing != null) {
                        outgoing.close();
                        outgoing = null;
              catch (SocketException e) {
              // there is one for a closed socket. Seems to have no effect.
              //     e.printStackTrace();
              catch (IOException e) {
                   e.printStackTrace();
    Here,when client gives any URL in the address bar in the web browser the request is forwarded to this proxy server.
    We want to fetch the URL which client enters in order to implement content filtering and also store the most visited sites by each user .
    But we don't know how to fetch the URL from the socket input or output stream.
    Can you suggest any suitable solution for the same??

    Shailesh24 wrote:
    We want to fetch the URL which client enters in order to implement content filtering and also store the most visited sites by each user .
    But we don't know how to fetch the URL from the socket input or output stream.
    Can you suggest any suitable solution for the same??Yes. Write a proxy server that actually speaks HTTP.

  • Why java Client  Proxy is used?

    Hi all!
    I am using sudhir porumamill's scenario available at the following links:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/a068cf2f-0401-0010-2aa9-f5ae4b2096f9
    and
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f272165e-0401-0010-b4a1-e7eb8903501d
    I am not getting which proxy he is referring to? whether it is java client proxy/server proxy?
    What to be given in SLD for client proxy and server proxy as well?
    Thanks

    Hi,
    Only the database name can be specified in JDBC communication channel. The table should given in receiver data type in Integration Repository.
    Refer these link for sql-xml data types to be followed for JDBC scenario.
    http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Regards,
    Uma

  • Program on client and server proxy

    hai
    can any body send me abap programs  or
    how to run client or server proxy in application system

    Hi
    see the below links
    /people/vijaya.kumari2/blog/2006/01/26/how-do-you-activate-abap-proxies - Activate Proxy
    /people/siva.maranani/blog/2005/04/03/abap-server-proxies - ABAP Server Proxy
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy - ABAP Client Proxy
    /people/prateek.shah/blog/2005/06/14/file-to-r3-via-abap-proxy - ABAP Proxy
    Regards
    Chilla
    <i>reward points if it is helpful..</i>

  • What is Inbound Proxy and Outbound Proxies  - Client and Serv please help ?

    Hi Friends ,
                <b>  1.  What is exact meaning for Inbound Proxies and OutBound Proiex ?
                    2.  Is outbound proxies means sending message to IS ?
                     3.  Is Inbound proxies means receiving message  from IS ?
                   4.  Where exactly we need proxy ?
                   5. What is Sever and client Proxies ?
                     Is server  ( here servre means XI Server ? )means Inbound .
                 Then normal meaning of Inbound is to  from server right ?  Then  hwo it will bwecome as inbound ?</b>
               I have gone through many blogs but still i am not clear .Please anyboy can expalin me ?
    Regards .,
    Shyam

    Hi Shyam
    1. What is exact meaning for Inbound Proxies and OutBound Proiex ?
    2. Is outbound proxies means sending message to IS ?
    3. Is Inbound proxies means receiving message from IS ?
    Ans ::
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/18dfe590-0201-0010-6b8b-d21dfa9929c9
    How to integrate or Establish connection between SAP XI and BIW?
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5f12a03d-0401-0010-d9a7-a55552cbe9da
    4. Where exactly we need proxy ?
    5. What is Sever and client Proxies ?
    Ans ::
    /people/vijaya.kumari2/blog/2006/01/26/how-do-you-activate-abap-proxies - Activate Proxy
    /people/siva.maranani/blog/2005/04/03/abap-server-proxies - ABAP Server Proxy
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy - ABAP Client Proxy
    Proxies: are interfaces which will get executed in the application system.They can be created only in the system from message interfaces using the proxy generation functions.
    The biggest advantage of the proxy is that it always by passes the Adapter Engine and will directly interact with the application system and Integration engine - so it will and should give us a better performance.
    The literal definition of a proxy is an object / process authorized to act for another; an agent or a substitute. In simpler terms, proxies in the XI context are objects used to encapsulate the creation (from a sender system) or parsing of XML (at a receiver system) as well as the communication with the relevant runtime components required to send or receive those messages. The Proxy Runtime controls these objects / processes, and can itself be controlled by the applications it communicates with.
    The Proxy currently has the following components available:
    1. ABAP Proxy – Communication using XI or Web Services
    2. Java Proxy– Communication using XI (J2EE)
    JAVA Proxies:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a068cf2f-0401-0010-2aa9-f5ae4b2096f9
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f272165e-0401-0010-b4a1-e7eb8903501d
    ABAP Proxies:
    /people/sap.user72/blog/2005/12/13/integration-builders-through-proxy-server-part--2
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy
    /people/arulraja.ma/blog/2006/08/18/xi-reliable-messaging-150-eoio-in-abap-proxies
    /people/stefan.grube/blog/2006/07/28/xi-debug-your-inbound-abap-proxy-implementation
    /people/michal.krawczyk2/blog/2006/04/19/xi-rfc-or-abap-proxy-abap-proxies-with-attachments
    /people/sukumar.natarajan/blog/2007/01/07/how-to-raise-alerts-from-abap-proxy
    /people/sravya.talanki2/blog/2006/07/28/smarter-approach-for-coding-abap-proxies
    Just refer these links u will get the answer of ur all 5 Question
    <b>Pls reward if useful</b>

  • Desperately need some help with client-server java programming

    Hi all,
    I'm new to client server java programming. I would like to work on servlets and apache tomcat. I installed the apache tomcat v 5.5 into my machine and i have sun java 6 also. I created a java applet class to be as a client and embed it into an html index file, like this:
    <applet code="EchoApplet.class" width="300" height="300"></applet>However, when I try to run the html file on the localhost, it print this error: classNotFoundException, couldn't load "EchoApplet.class" class. On the other hand, when I open the index file on applet viewer or by right clicking, open with firefox version 3, it works.
    I thought that the problem is with firefox, but after running the applet through the directory not the server, i found that the problem is not any more with firefox.
    Can anyone help me to solve this problem. I'm working on it for 5 days now and nothing on the net helped me. I tried a lot of solutions.
    Any help?

    arun,
    If the browser is going to execute $myApplet, first it must get the $myApplet.class from the server, right?
    So it follows that:
    1. $myApplet.class must be acessible to server, and
    2. the server must know exactly where to find $myApplet.class
    So, the simplest solution is to is put the $myApplet.class in the same directory as the HTML file which uses it... then your applet tag is simple:
      <applet height="200" width="400" code="$myApplet.class" ></applet>* The height & width attributes are required
    * Note the +.class+ is required in the code attribute (a common mistake).
    * This works uniformly (AFAIK) accross all java-enabled browsers.
    * There are incompatibilities with the codebase attribute. Poo!
    Cheers. Keith.

  • How can I write a simple proxy server that intercept 80(www)socket???

    Does any body knows how can i write simple proxy server that intercept web sites watching by user???thx

    Does any body knows how can i write simple proxy
    server that intercept web sites watching by user???thxTo be clear a proxy means that requests go to the proxy and then the proxy relays the request to proper place.
    If you want to see traffic without being in the middle (the requests go direct) then you can not use the standard Java API. And do so in any situation of course requires that you be in the physical connection in the first place (ie in a star network with a router in the middle a client machine will not see packets from other machines.)

  • Difference between client proxy and server proxy

    hi all,
    could u explain me the differences between client proxy and server proxy,
    regards,
    AVR

    Hi AV,
    simple search in sdn may answer your question,
    There are two type of Proxy's in ABAP and JAVA(Clinet and Server),
    Clinet ABAP proxy used to send message from ANY SAP System to Integration server,in this case XI adapter not required .
    Server ABAP proxy used to send messages from Intergration server to any SAP System,in this case XI Adapter required.
    How to implement ABAP proxy comunication refer below link
    http://wiki.sdn.sap.com/wiki/display/stage/ABAPproxyproviderimplementationand+testing
    The sama way Client JAVA proxy used to send message to Integration sever from any Web Application ,
    Server JAVA proxy used to send messages to any destination system ,in both cases XI adapter required.
    refer below link
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/7d4db211-0d01-0010-1e8e-9b07fc2113ab&overridelayout=true
    Regards,
    Raj

  • JAX-WS client - WebLogic - SSL with proxy server

    Good night!
    I'm having trouble communicating with webservices using certificate authentication (weblogic.wsee.jaxws.sslclient.PersistentSSLInfo) through and going through a proxy server (weblogic.wsee.jaxws.proxy.ClientProxyFeature) .
    If communication with the webservice is done directly (no proxy server) everything happens perfectly, but to set the proxy server I get the exception "BAD_CERTIFICATE." it is as if the certificate was not attached in the request.
    The webservice client was generated by JDeveloper.
    Has anyone experienced this problem?
    Sorry for my bad english
    Exception
    javax.xml.ws.WebServiceException: javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received.
         at com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:218)
         at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:204)
         at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:124)
         at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:121)
         at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:866)
         at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:815)
         at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:778)
         at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:680)
         at com.sun.xml.ws.client.Stub.process(Stub.java:272)
         at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:153)
         at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:115)
         at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:95)
         at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:136)
         at $Proxy30.cleCadastroLote(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at weblogic.wsee.jaxws.spi.ClientInstanceInvocationHandler.invoke(ClientInstanceInvocationHandler.java:84)
         at $Proxy31.cleCadastroLote(Unknown Source)
         at br.com.tbl.ws.CleCadastroPortClient.main(CleCadastroPortClient.java:51)
    Webservice client with proxy server (error)
    import weblogic.wsee.jaxws.sslclient.PersistentSSLInfo;
    import javax.xml.ws.BindingProvider;
    import weblogic.wsee.jaxws.JAXWSProperties;
    import weblogic.wsee.jaxws.proxy.ClientProxyFeature;
    import weblogic.wsee.jaxws.sslclient.SSLClientUtil;
    public class CleCadastroPortClient
    public static void main(String [] args)
    try{
    CleCadastro_Service cleCadastro_Service = new CleCadastro_Service();
    CleCadastro cleCadastro = cleCadastro_Service.getCleCadastroPort();
    String clientKeyStore = "C:\\certificados.jks";
    String clientKeyStorePasswd = "xxxxx";
    String clientKeyAlias = "xxxxx";
    String clientKeyPass = "xxxxx";
    String trustKeystore = "C:\\keystore_completo.jks";
    String trustKeystorePasswd = "xxxxx";
    PersistentSSLInfo sslInfo = new PersistentSSLInfo();
    sslInfo.setKeystore(clientKeyStore);
    sslInfo.setKeystorePassword(clientKeyStorePasswd);
    sslInfo.setKeyAlias(clientKeyAlias);
    sslInfo.setKeyPassword(clientKeyPass);
    sslInfo.setTrustKeystore(trustKeystore);
    sslInfo.setTrustKeystorePassword(trustKeystorePasswd);
    ClientProxyFeature clientProxy = new ClientProxyFeature();
    clientProxy.setProxyHost("proxy.com");
    clientProxy.setProxyPort(Integer.parseInt("3128") );
    clientProxy.setProxyUserName("user");
    clientProxy.setProxyPassword("pass");
    clientProxy.attachsPort(cleCadastro);
    ((BindingProvider) cleCadastro).getRequestContext().put(JAXWSProperties.CLIENT_PERSISTENT_SSL_INFO, sslInfo);
    ((BindingProvider) cleCadastro).getRequestContext().put(JAXWSProperties.SSL_SOCKET_FACTORY, SSLClientUtil.getSSLSocketFactory(sslInfo));
    ((BindingProvider) cleCadastro).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "https:/xxxx/ws");
    String retorno = cleCadastro.cleCadastroLote("xml", "xml");
    }catch(Exception ex){
    ex.printStackTrace();
    Webservice client without proxy server (OK)
    import weblogic.wsee.jaxws.sslclient.PersistentSSLInfo;
    import javax.xml.ws.BindingProvider;
    import weblogic.wsee.jaxws.JAXWSProperties;
    import weblogic.wsee.jaxws.proxy.ClientProxyFeature;
    import weblogic.wsee.jaxws.sslclient.SSLClientUtil;
    public class CleCadastroPortClient
    public static void main(String [] args)
    try{
    CleCadastro_Service cleCadastro_Service = new CleCadastro_Service();
    CleCadastro cleCadastro = cleCadastro_Service.getCleCadastroPort();
    String clientKeyStore = "C:\\certificados.jks";
    String clientKeyStorePasswd = "xxxxx";
    String clientKeyAlias = "xxxxx";
    String clientKeyPass = "xxxxx";
    String trustKeystore = "C:\\keystore_completo.jks";
    String trustKeystorePasswd = "xxxxx";
    PersistentSSLInfo sslInfo = new PersistentSSLInfo();
    sslInfo.setKeystore(clientKeyStore);
    sslInfo.setKeystorePassword(clientKeyStorePasswd);
    sslInfo.setKeyAlias(clientKeyAlias);
    sslInfo.setKeyPassword(clientKeyPass);
    sslInfo.setTrustKeystore(trustKeystore);
    sslInfo.setTrustKeystorePassword(trustKeystorePasswd);
    ((BindingProvider) cleCadastro).getRequestContext().put(JAXWSProperties.CLIENT_PERSISTENT_SSL_INFO, sslInfo);
    ((BindingProvider) cleCadastro).getRequestContext().put(JAXWSProperties.SSL_SOCKET_FACTORY, SSLClientUtil.getSSLSocketFactory(sslInfo));
    ((BindingProvider) cleCadastro).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "https:/xxxx/ws");
    String retorno = cleCadastro.cleCadastroLote("xml", "xml");
    }catch(Exception ex){
    ex.printStackTrace();
    }

    Hi,
    I tried to use the option "-DUseSunHttpHandler=true" and enabled "JSSE SSL", but it did not work, now showing the exception "General SSLEngine problem".
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <javax.xml.ws.WebServiceException: javax.net.ssl.SSLHandshakeException: General SSLEngine problem>
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <at com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:218)>
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:204)>
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:124)>
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:866)>
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:121)>
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:815)>
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:778)>
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:680)>
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <at $Proxy308.cleCadastroLote(Unknown Source)>
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)>
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:136)>
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:95)>
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:115)>
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:153)>
    <05/09/2012 15h36min55s GMT-03:00> <Notice> <StdErr> <BEA-000000> <at com.sun.xml.ws.client.Stub.process(Stub.java:272)>

  • Can i run UDP  client and UDP  server socket program in the same pc ?

    hi all.
    when i execute my UDP client socket program and UDP server socket program in the same pc ,
    It's will shown the error msg :
    "Address already in use: Cannot bind"
    but if i run UDP client socket program in the remote pc and UDP server socket program run in local pc , it's will success.
    anybody know what's going on ?
    any help will be appreciated !

    bobby92 wrote:
    i have use a specified port for UDP server side , and for client define the server port "DatagramSocket clientSocket= new DatagramSocket(Server_PORT);"Why? The port you provide here is not the target port. It's the local port you listen on. That's only necessary when you want other hosts to connect to you (i.e. when you're acting as a server).
    The server should be using that constructor, the client should not be specifying a port.
    so when i start the udp server code to listen in local pc , then when i start UDP client code in local pc ,i will get the error "Address already in use: Cannot bind"Because your client tries to bind to the same port that the server already bound to.

  • Unable to use proxy server with MAC OS X Anyconnect client

    Hi All,
    I have a VPN setup thru a Cisco 5520, Windows clients connect just find and the end users configure there browser to use our internal proxy servers.   Users with the MAC OS X Anyconnect client can connect, they configure their Mac to use our proxy server, but the broswers will not work, clients can reach networks and resources behind the VPN gateway and have access to the Proxy(Tried a telnet to that hostname/port).  Anyone run into this issue before?  I am running ASA 8.3(2), Anyconnect(OS X) 3.1.01065.
    Thank You

    We had the same problem.
    We are behind government firewall so I don't know which Cisco firewall is used but we are using AnyConnect to establish VPN from internet to LAN behind firewall. We have no problems with Windows. With Mac OS X connection through proxy didn't work with Safari and Chrome (both are using system Proxy setting), but it did work with Firefox (which has it's own Proxy).
    Finally we found out that ethernet MTU size was the culprit. When we set it to manual, with size being 1347 (or less), proxy started to work.

Maybe you are looking for

  • Possible to change sidebar div from left to right?

    I'm just starting to design completely using CSS...very tough to change. I have a home page roughed out with a sidbar nav on the left BUT I'm thinking it may be a bit more mobile friendly if I move it to the right and allow the content to be all the

  • !!NOKIA MAKE A NEW FIRMWARE FOR N82!! 35.0.002 is ...

    I BUYED THIS PHONE(N82) TO USED...NOT TO WATCH AT HIM....TO MAKE A PICTURE DOESNT WORK...VIDEO NO.....MUSYC PLAYER IS BLOCKING...A NEW BUG AT BAR CODES READER!!!!i am tired to ask for help on this forum.........nothing solved......i dont know what to

  • Need a DAC Expert - Need some Urgent Help DAC 10.1.3.4

    Hi We have just upograded out DAC from 7 to 10.1.3.4, We have upgraded the repository we were using in 7 to 10 via na empty container all the mappings look ok, we genereated the parameters, then build the execution plan. When we click execute we get

  • Extend desktop macbook pro-13" to imac screen

    Hello, i can get my macbookpro hooked up to my i mac to use is as an extended desktop connection via thunderbolt cable who can give me advice. Mac book pro just brabdnew Imac bought in early 2012. regards

  • Freetype fonts!! help

    Ok I downloaded the freetype fonts from http://freetype.org/ but I cant find the way to install them!! I need em to run some Darwine aplications, anyone have an Idea how to install them? Thanks.