Sending a Http-Get request from a browser to wso2 proxy service does not work in wso2 2.0 Beta 3

fyang's picture

I am new in WSo2 ESB. I had a simple test on wso2 proxy service. I created a wso2 proxy service with the following configuration:  <syn:proxy xmlns:syn="http://ws.apache.org/ns/synapse" name="MyProxy" transports="https,http" statistics="enable" trace="enable" startOnLoad="true">
   <syn:target>
      <syn:outSequence>
         <syn:send />
      </syn:outSequence>
      <syn:endpoint>
         <syn:address uri="http://info-d.mitre.org/employeeservice/suis/fyang" format="get" />
      </syn:endpoint>
   </syn:target>
</syn:proxy>
  I got the following error in console while running http://mm146878-pc:8280/services/MyProxy/ from Ie browser: [2009-01-12 16:03:25,641] INFO - To: /services/MyProxy/, MessageID: urn:uuid:C8841C65C6D077EF691231794221318, Direction: request {org.apache.synapse .mediators.builtin.LogMediator} [2009-01-12 16:04:26,625] ERROR - Connection Timeout - before message body was fully read : [/129.83.54.91:3662] {org.apache.synapse.transport.nhttp. ServerHandler} If I ran ://mm146878-pc:8280/services/MyProxy/mediate from Ie browser, I got errors: [2009-01-12 16:04:27,656] WARN - Unexpected HTTP status code received : 404 :: Not Found {org.apache.synapse.transport.nhttp.ClientHandler} [2009-01-12 16:05:28,452] ERROR - Connection Timeout - before message body was fully read : [/129.83.54.91:3686] {org.apache.synapse.transport.nhttp. ServerHandler} Not sure what is wrong? I tried wso21v 1.7.1 and could not get it work neither. Could someone help me out here? I'd like to resolve it ASAP. Thanks -Fran

ruwan's picture

Hi Fran, If you want to try

Hi Fran,

If you want to try the GET requests for proxy services, you need to specify the WSDL... please provide the WSDL of the target service as the publishWSDL of the proxy service.

Please have a look at the sample 150 for a sample on specifying the publishWSDL.

Thanks,
Ruwan Linton

fyang's picture

Even a RESTful web service needs WSDL file for using HTTP proxy

Thanks Ruwan.

You meant that I need to create a WSDL for RESTful web service if I need to send GET request to WSO2 proxy service?

I have another question on WSO2 ESB. just wonder whether I can listen the GET request without using proxy service? Here is my senario. I have some RESTful web services and I'd like to intercept the GET request for monitoring and security reasons. what is the best to leverage WSO2 to perform it?

Thanks a lot again

-Fran

ruwan's picture

You will have to have the

You will have to have the WSDL so that the proxy service can get the operations to make available.

For your second question, you can either define a proxy through which your messages are going or you could do this with the main sequence.

Thanks,
Ruwan Linton

fyang's picture

which one is better?

Great. You said that I can do it with/without proxy. May I ask you that which approach you think is better?
Could you give me a bit details on how to main sequence to intercept GET request to endpoint service?
 
Thank you very much. your responses are very helpful.
 
-Fran

ruwan's picture

I recommend you to use the

I recommend you to use the proxy services approach, because the getting this to work through the main sequence is going to be a little tricky, because there is no direct means of getting to this sequence through a browser.

It does a special check to deliver a HTML page of the list of services available which clashes with the GET request on main sequence.

If you need to invoke this main sequence please use the following url rather than just accessing the root context.

http://localhost:8280/services/__SynapseService/mediate

Thanks,
Ruwan Linton

asankha's picture

Hi Fran >"I am new in WSo2

Hi Fran

>"I am new in WSo2 ESB. I had a simple test on wso2 proxy service"

May I ask why you want to connect to a proxy service via the browser? I believe the backend is a REST service and not a web site..

Please refer to: https://issues.apache.org/jira/browse/SYNAPSE-365?focusedCommentId=12611110#action_12611110

If possible, get a TCPDump output to see if your client sends a \r\n with a GET, if we still find and issue, lets fix SYNAPSE-365 soon

cheers
asankha
http://adroitlogic.org

fyang's picture

Tried it as your instruction but still have issue

Hi Asankha,
Thanks for your reply. I tried it as below following your sample.
 
1. from browser, I can go http://info-i.mitre.org/employeeservice/suis/fyang and get XML data back. The RESTful web service is running in my intg machine
2. I started wso2BES and axis2 server
3. I created a proxy call myProxy as configured below
<syn:proxy xmlns:syn="http://ws.apache.org/ns/synapse" name="myProxy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <syn:target>
      <syn:outSequence>
         <syn:send />
      </syn:outSequence>
      <syn:endpoint>
         <syn:address uri="http://info-i.mitre.org/employeeservice/suis" format="get" />
      </syn:endpoint>
   </syn:target>
</syn:proxy>
 
4. from browser(firefox and IE), I entered http://localhost:8280/services/myProxy/employeeservice/suis/fyang and I got the following error in console
2009-01-14 11:09:59,584 [129.83.54.91-MM146878-PC] [HttpClientWorker-4]  INFO LogMediator To: /services/myProxy/employeeservice/suis/fyang, MessageID:
 urn:uuid:151CB01FCEC116BB701231949407376, Direction: request
2009-01-14 11:10:59,585 [129.83.54.91-MM146878-PC] [http-Listener I/O dispatcher-2] ERROR ServerHandler Connection Timeout - before message body was f
ully read : [/127.0.0.1:2115]
 
Here i did not specify WSDL  as it is not mentioned in your example.
 
regarding your question, using browser to invoke the restful service is just for a quick testing. I assume either browser-invoker or web-client-invoker should work.
 
Thanks a lot for your help
 
-Fran
 

asankha's picture

Hi Fran Can you use tcpmon

Hi Fran

Can you use tcpmon (on a Unix/Linux machine) or Wireshark, Windump or if all these fail the Apache TCPMon to trace the conversation between the ESB and the backend service?

For TCPDump the command would be of the form:
sudo tcpdump -i wlan0 -X -n -s 4096 port 80

Replace "-i wlan0" as necessary for your environment e.g. "-i eth1"

If you send me this output, I could check exactly whats wrong.

cheers
asankha
http://adroitlogic.org

fyang's picture

no traffic btw ESB to endpoint service

Hi Asankha
 
I used TCPMon to monitor the traffic on 8280 and my service port.  Here is what I did
1. create tcp port 9998 listening host:localhost port:8280 and tcp port 9999 listening servicehost:8010 (htis is my endpoint service host)
2. ESB configuration is
<syn:proxy xmlns:syn="http://ws.apache.org/ns/synapse" name="myProxy" transports="https,http" statistics="disable" trace="enable" startOnLoad="true">
   <syn:target>
      <syn:outSequence>        
         <syn:send />     
      </syn:outSequence>
      <syn:endpoint>        
         <syn:address uri="http://localhost:9999/employeeservice/suis" format="get" />     
      </syn:endpoint>
   </syn:target>
</syn:proxy>
 
3. from firefox, enter http://localhost:9998/services/myProxy/employeeservice/suis/fyang
4. from TCPmon 9998 port, I got
GET /services/myProxy/employeeservice/suis/fyang HTTP/1.1
Host: MM146878-PC.MITRE.ORG:9998
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.18) Gecko/20081029 Firefox/2.0.0.18
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
5. no thing showed in TCpMon 9999 port, no traffic at all
6. in console, I still got
2009-01-14 14:27:46,141 [129.83.54.91-MM146878-PC] [HttpClientWorker-10]  INFO LogMediator To: /services/myProxy/employeeservice/suis/fyang, MessageID
: urn:uuid:8F81F733CCA722BC251231961277034, Direction: request
2009-01-14 14:28:45,127 [129.83.54.91-MM146878-PC] [http-Listener I/O dispatcher-2] ERROR ServerHandler Connection Timeout - before message body was f
ully read : [/129.83.54.91:3131]
 
Maybe I did something wrong in TCPMon?
 
Thanks
 
-Fran

Hot Topic
Hot
Topic

Google Gadgets are a nice way to develop user interfaces for distributed services. The fact that they can be hosted anywhere over a network, not necessarily in the very portal server they eventually run in makes them re-usable and allows users to quickly...

Latest Webinar
In this webinar we'll share the range of concerns we've heard from the industry, and survey some of the new and sometimes subtle types of lock-in associated with cloud technologies.
Wednesday, 8 September, 10.00 AM (PDT)