WSO2 ESB is not listening REST API ports - connection-refused

I'm on wso2 tutorial, at the en of this point https://docs.wso2.com/display/ESB500/Sending+a+Simple+Message#SendingaSimpleMessage-uriTemplate
I've got web-interface of ESB running at localhost:9443/carbon
I've created and packed carbon application as it is described at "Sending a simple message" doc.
"APIs" page sais that I've got an API resource at http://localhost:8280/healthcare
Sooo I'm trying to curl it and it fails:
[bajal#bajal:~/ESBTOOL/eclipse]# curl "http://localhost:8280/healthcare/querydoctor/surgery"
curl: (7) Failed to connect to 127.0.0.1 port 8280: Connection refused
netstat shows me that java-app (esb itself) has no open ports that could look like 8280.
I'm confused. There is nothing about it at ESB doc.
Please help me pass tutorial :)

WSO2 ESB uses Passthrough Listener to listen HTTP traffic on port 8280. This configuration lies on axis2.xml file inside your ESB. I can't remember the exact location now since now I am not into WSO2 much. There you have transport listener and sender configurations. I think it should be fine. Could you please change your curl request as follows [1] and try that out again. Alternatively hit the get url [2] in your browser's address bar and see.
[1] curl -v http://localhost:8280/healthcare/querydoctor/surgery
[2] http://localhost:8280/healthcare/querydoctor/surgery

Related

ETIMEDOUT error

My bluemix securegateway client installed on linux , gives an error as :
[2017-10-03 04:08:05.791] [DEBUG] (Client ID 16583) The Secure Gateway client will fetch its configuration from https://sgmanager.ng.bluemix.net/sgconfig/[masked]
[2017-10-03 04:09:08.882] [ERROR] (Client ID 16583) The response is code: ETIMEDOUT, message: connect
This was working earlier , but suddenly stopped connecting.
Does the client use curl to get to the above configuration url ?
The SG Client doesn't use curl specifically, but it does make an HTTPS request to sgmanager.ng.bluemix.net as part of the initial connection process. Following this request, a second HTTPS request is made to cap-sg-prd-#.integration.ibmcloud.com:9000 where # is 1-5 depending on the details of your specific gateway.
ETIMEDOUT is typically caused by something like a firewall blocking your requests, so you could use something like telnet to confirm your connectivity. A successful connection should be similar to:
telnet sgmanager.ng.bluemix.net 443
Trying 169.54.245.68...
Connected to ng.bluemix.net.
Escape character is '^]'.
and
telnet cap-sg-prd-1.integration.ibmcloud.com 9000
Trying 169.55.54.176...
Connected to cap-sg-prd-1.integration.ibmcloud.com.
Escape character is '^]'.

How to connect to a SVC endpoint?

Given a URL that ends with .svc and that is supposed to run a SOAP web service, how can I get some data from it?
I tried:
to access it via a web browser
to access it via the Python's library Zeep
to access it via the Microsoft utilitary svcutil.exe
In all cases, I get a timeout error:
Failed to establish a new connection: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time.
Does it mean that the web service does not work, or that I do things the wrong way?
Importantly - there is a big distinction between "service not active" (and by that I mean no listener on port 80), and "port not open in firewall".
If the problem were simply that you didn't have a service listening on port 80, you would have gotten something like "connection reset" or "connection rejected" as an error.
Instead, you appear to have gotten a timeout, which implies that either the SYN from the client doesn't reach the server, or the SYN/ACK from the server doesn't reach the client. [ You could verify this by doing a packet capture for port 80 on both client and server ]
I would be tempted to check any firewall in front of the server to see that it's letting port 80 traffic through from your client.
Diagnosing Connectivity Issues
Without more details it is difficult to say, but given your timeout error:
Failed to establish a new connection: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time.
This indicates a network connectivity error at the TCP level, so it is likely web service is not active on the port your are using (default of 80 for http, 443 for https).
In a comment you said you pinged the URL and it responded normally - I assume this means you pinged the hostname. If this is responding normally it means the server is active, but that doesn't tell you anything about the availability of the web service on that server.
telnet %hostname% %port%
where %port% is 80 for http or 443 for https, or something else if there is a port number in the URL you are using (e.g. http://somehost.somewhere.com:port/path.scv)
If ping works and telnet does not connect, then the service is not active.
I suspect this is the case. If the service was active and it was simply that you requesting the data incorrectly, I believe you'd get a different error message - e.g. a valid HTTP response with status code 500 or 404 or similar.
Getting Data from a Web Service
As to your original question as to how to get data from it - once you verify that the service is active, the method to get the data will depend on the specification of the service - i.e.:
which HTTP methods (GET, POST, etc.) does it support
what parameters it requires
what format it requires the parameters in
are the parameters in the query string or POST body.
To interact with a web service there are many command line tools that can be used, as well as the options you have tried, including:
POSTMan Google Chrome Plugin
curl
wget
In windows Powershell, the Invoke-WebRequest
Getting Data from a SOAP Web Service
As you have said it is a SOAP web service, if you have the URL for the wsdl, you can often interract with it using Powershell SOAP WebService Proxies.
The wsdl location varies, but is often at a URL that looks something like.
http://host/path.svc?wsdl
http://host/path.svc/?wsdl
http://host/path/?wsdl
Also if it's configured correctly, just loading the URL in a browser will present a page with a link to the wsdl.
The general idea is:
$URI="http://hostname/path.svc?wsdl"
$Proxy = New-WebserviceProxy $URI –Namespace X
$Proxy | get-member -MemberType Method
This will return a list of methods on the proxy that you can invoke as powershell methods. Any types defined in the wsdl that are needed for arguments, or returned from methods will be available within the namespace X. Invoking the methods will proxy the request to the service, taking care of serializing parameters and serializing results into powershell objects.

SOAP error 5001 (peer not authenticated)

I ran soap action API (PerFormTopUp or RefillT API).
All necessary parameters in request are correct.
Destination IP are correct including port #
Network wise, from router to FW it was sent to destination(LB)
Telnet, traceroute and ping also good
Problem:
In response XML logs, I noticed error 5001 - Java Embedded Fault: peer not authenticated
What is this 5001 error? Can someone help?
Server: oracle (AIA/SOA)
The below post might help you
https://groups.google.com/forum/#!category-topic/httpfiddler/ZQNk6pUgDOo

Connect to C++ REST sdk SERVER on Windows from LAN

I have a server written on C++ REST SDK.
There's http_listener which listens to "http://localhost:34568".
When I try to send a request in browser or from the client to localhost it works fine and I get the responses from my server. But the point is to use the application in network. And here where the problem comes.
When I try to request the server from the other PC using IP(192.168.1.103:34568) I get "HTTP Error 400. The request hostname is invalid."
I'm aware that that could be some firewall issues but it's turned off. Also I tried to set port rules in brandmauer and it didn't help.
And even more! I got XAMPP running Apache server and when I do the same thing but with (192.168.1.103:80) I do get the response from Apache and have an access.
Anybody had something similar or somebody knows what the problem is about?
Listen to local ip address or to your network name (dns):
"http://xxx.xxx.xxx.xxx:34568" or
"http://your_network_name:34568"
So, if you have multiple network adapters, you can choose which one.

MQTT in paho can't connect in connection

I am trying to use the MQTT javascript client from Paho. I see a example from HiveMQ, you can check it here - - http://www.hivemq.com/demos/websocket-client/
It seems to be working, however when I set the host as: test.mosquitto.org:1883, which is a mqtt broker service at mosquitto, it fails.
When I tried to connect to this mosquitto service, it gives me a error on connection - connect failed: AMQJS0007E, Socket error: undefined.
Mosquitto does not support MQTT over WebSockets out of the box. So Roger is using lighttpd with the mod_websocket module to forward.
This means that the port will be port 80 not 1883
But having just had a quick look at http://test.mosquitto.org/ws.html it seams that the lighttpd instance may be down at the moment as the demo is not working.
If you want to run your own local copy of mosquitto for testing there is a link on that page with instructions on how to build mod_websocket for lighttpd or a ubuntu ppa to download it from.
EDIT:
Mosquitto now includes WesbSocket support built in, but you will need to add an extra listener to enable it, e.g.
listener 8883
protocol websockets
As hardillb says, you need to use port 80. The full url you should use is
ws://test.mosquitto.org/mqtt
If you are using m2m.eclipse.org as Andy suggests (which is actually using apache with websockets support) then you should use
ws://m2m.eclipse.org/ws
You could try the same thing against m2m.eclipse.org which I think has websocket support switched on via lighthttpd as well.