Hi Thishani ,

Untill yesterday things were working fine however today i am getting
connection refused error, Could you please help me with this, below is my
proxy and sample java code.


Proxy service :

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse";
       name="TestProxy"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http">
   <target>
      <inSequence>
         <log level="full"/>
         <property name="OUT_ONLY" value="true"/>
      </inSequence>
      <endpoint>
         <address uri="tcp://192.168.80.87:8092"/>
      </endpoint>
   </target>
   <description/>
</proxy>



Sample TCP Server JAVA Code:

public class TCPServer {

public static void main(String[] args) throws Exception {
String clientSentence;
  String capitalizedSentence;
  ServerSocket welcomeSocket = new ServerSocket(8902);

  while (true) {
   Socket connectionSocket = welcomeSocket.accept();
   BufferedReader inFromClient =
    new BufferedReader(new
InputStreamReader(connectionSocket.getInputStream()));
   DataOutputStream outToClient = new
DataOutputStream(connectionSocket.getOutputStream());
   clientSentence = inFromClient.readLine();
   System.out.println("Received: " + clientSentence);
  // capitalizedSentence = clientSentence.toUpperCase() + 'n';
   System.out.println("Received1: " + clientSentence);
  // outToClient.writeBytes(capitalizedSentence);


   outToClient.close();
   System.out.println("Received2: " + clientSentence);
   inFromClient.close();
   connectionSocket.close();
  }

}

}



Regards,

Amit Gupta

On Tue, Aug 21, 2018 at 5:30 PM Amit Gupta <amit.elcar...@gmail.com> wrote:

> Thank you Thishani ,
>
> I updated the proxy with the example and tried however i am getting same
> issue.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <proxy xmlns="http://ws.apache.org/ns/synapse";
>        name="TestProxy"
>        startOnLoad="true"
>        statistics="disable"
>        trace="disable"
>        transports="http">
>    <target>
>       <inSequence>
>          <log level="full"/>
>          <property name="OUT_ONLY" value="true"/>
>       </inSequence>
>       <endpoint>
>          <address uri="tcp://192.168.80.106:9988"/>
>       </endpoint>
>    </target>
>    <description/>
> </proxy>
>
>
> Below are the logs
>
> [2018-08-21 17:26:35,672] []  INFO - DeploymentInterceptor Deploying Axis2
> service: TestProxy {super-tenant}
> [2018-08-21 17:26:35,673] []  INFO - ProxyService Successfully created the
> Axis2 service for Proxy service : TestProxy
> [2018-08-21 17:26:45,484] []  WARN - JavaLogger potential cross-site
> request forgery (CSRF) attack thwarted (user:<anonymous>,
> ip:192.168.80.106, method:POST,
> uri:/carbon/admin/jsp/WSRequestXSSproxy_ajaxprocessor.jsp, error:required
> token is missing from the request)
> [2018-08-21 17:27:09,121] []  WARN - JavaLogger potential cross-site
> request forgery (CSRF) attack thwarted (user:<anonymous>,
> ip:192.168.80.106, method:POST,
> uri:/carbon/admin/jsp/WSRequestXSSproxy_ajaxprocessor.jsp, error:required
> token is missing from the request)
> [2018-08-21 17:27:12,305] []  WARN - JavaLogger potential cross-site
> request forgery (CSRF) attack thwarted (user:<anonymous>,
> ip:192.168.80.106, method:POST,
> uri:/carbon/admin/jsp/WSRequestXSSproxy_ajaxprocessor.jsp, error:required
> token is missing from the request)
>
>
>
> The IP 192.168.80.106 is my system.Can you let me know what is going wrong
>
> On Tue, Aug 21, 2018 at 5:25 PM Thishani Lucas <thish...@wso2.com> wrote:
>
>> Hi Amit,
>>
>> As I have answered in [1], we need a TCP endpoint in the send mediator.
>>
>> [1]
>> https://stackoverflow.com/questions/51947933/sending-data-over-tcp-on-wso2-esb
>>
>> Thanks,
>> Thishani
>>
>> On Tue, Aug 21, 2018 at 7:53 PM, Amit Gupta <amit.elcar...@gmail.com>
>> wrote:
>>
>>> Hi Lahirumadu ,
>>>
>>> Thank you for the response .
>>>
>>> I had gone through the documentation and  was little confused, Like when
>>> ESB needs to send data over TCP then IP and port of the TCP server is
>>> required however here we just mention Port, So my scenario is that ESB
>>> should be able to send data over TCP to another server and once the server
>>> responds with a message then ESB should further do the enrich the response.
>>>
>>> Regards,
>>>
>>> Amit Gupta
>>>
>>> On Tue, Aug 21, 2018 at 4:18 PM Lahiru Madushanka <lahirum...@wso2.com>
>>> wrote:
>>>
>>>> Hi Amit,
>>>>
>>>> Please refer to this [1] documentation. ( contains a sample )
>>>>
>>>> [1] https://docs.wso2.com/display/ESB500/TCP+Transport
>>>>
>>>> Thanks,
>>>> Lahiru
>>>>
>>>> On Tue, Aug 21, 2018 at 5:28 PM Amit Gupta <amit.elcar...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi ,
>>>>>
>>>>> I have created a proxy in wso2 esb wherin i can receive data over TCP
>>>>> from external parties.
>>>>> However my requirement is that i need to develop a proxy wherein esb
>>>>> sends request over TCP and then receives a response and then process the
>>>>> response further.
>>>>>
>>>>> Any leads on this or any example will be helpful for me.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Amit Gupta
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> *Thishani Lucas*
>> *Software Engineer*
>> *WSO2 Lanka (Private) Limited**: http://wso2.com <http://wso2.com/>*
>> *lean.enterprise.middle-ware*
>>
>> *Tel: +94 77 2556931 *
>>
>> *LinkedIn: https://www.linkedin.com/in/thishani-lucas/
>> <https://www.linkedin.com/in/thishani-lucas/>*
>>
>>
>> <http://wso2.com/signature>
>>
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to