SignalR java: client-test-integration-android : InvalidHttpStatusCodeException - java

I am trying to run the signalR self-host example server ( http://www.asp.net/signalr/overview/deployment/tutorial-signalr-self-host ) with the android test integration (provided with the signalr official java client). I have tested that the self-host server is accessible by clients written in C# from another machine in the local network (I changed localhost to * on the server). However, I have not been successful yet in connection from android. I get the following error:
Critical: AutomaticTransport - Error:
microsoft.aspnet.signalr.client.http.InvalidHttpStatusCodeException:
Invalid status code: 500
The full log can be seen here:
http://pastebin.com/fMPabbN1
Am I missing something? It does not look like a compilation or IP configuration error. If I don't run the server and run the tests, I get socketTimeOut, which is expected.
I ran the "Basic Connection Flow - Auto" test.
Thanks!

Adding to my answer in case someone else runs into it. It was a crappy mistake on my part, jumped into java client without understanding signalr properly! The Hub class on the server and the Hub proxy name has to be the same. So on the server side the class:
public class MessageHub : Hub
And on the client side
HubProxy hub = connection.createHubProxy( “MessageHub” );
And voila!

Related

Dependency uses outdated URL

I'm trying to clone and build a GitHub repo using Bazel, but a dependency requires an old verson of zlib via an outdated URL. I've already spent a few hours trying to do things like messing with the /etc/hosts file and running a web server to get it to work. I've gotten zlib.net to point to localhost, then running a web server on localhost:80 with zlib at the correct path, but that's not working, since the request is timing out.
I've googled it and only about 3 remotely relevant results have popped up, none of which are helpful.
How do I get it to build?
This is the error:
Error in download_and_extract: java.io.IOException: Error downloading [https://zlib.net/zlib-1.2.11.tar.gz] to /private/var/tmp/_bazel_user/37df51594c7eac8a62dd677a22c5514b/external/zlib/temp16216011345324291299/zlib-1.2.11.tar.gz: GET returned 404 Not Found
It is timing out because the request uses HTTPS, which is port 443, not HTTP on port 80. You can use a similar approach to what you are doing (with the hosts file) but just run a HTTPS server on port 443.
This can be achieved using tools such as ngrok and your current localhost web server.

SignalR (ASP .Net) - "The ConnectionId is in the incorrect format" - problem with websocket using own Java Websocket Client

I'm working on websocket integration to Bittrex - v3 API (https://bittrex.github.io/api/v3#topic-Authenticating). Bittrex websocket implementation is based on Microsoft ASP.net’s SignalR - they are not using ASP.net Core’s SignalR implementation.
I'm working on my own Java Client (based on Vert.x) because there is no available actual java client to SignalR.
I've encountered an problem. I want to connect with Bittrex websocket using my own websocket client developed in Java but I’m receiving 400 with information that “The ConnectionId is in the incorrect format”. I don’t know the SignalR protocol, I’ve only made some chrome debugging of bittrex website to get knowledge how can I connect using websocket.
How the process of the connection looks like in my case:
Step 1. I’m requesting for a connection token usign this GET request:
encoded: https://socket-v3.bittrex.com/signalr/negotiate?clientProtocol=2.0&connectionData=[{%22name%22:%22c3%22}]&_=1600500715881
decoded: https://socket-v3.bittrex.com/signalr/negotiate?clientProtocol=2.0&connectionData=[{"name":"c3"}]&_=1600500715881
Step: 2. Nest using the response like:
{"Url":"/signalr","ConnectionToken":"0kBiAOYeOtyGleCNodFQjl6TxKgBZy6o8RmI96GxteRH+GPfeycU+cyODS8YiAgpvCJ4RTmuQYh3Gr6TKo7U1K/nwi1CQxuaBroX0iF6j/wKxkeU","ConnectionId":"c79d4fa4-7518-4dc3-8884-0885598b105d","KeepAliveTimeout":20.0,"DisconnectTimeout":30.0,"ConnectionTimeout":110.0,"TryWebSockets":true,"ProtocolVersion":"2.0","TransportConnectTimeout":5.0,"LongPollDelay":0.0}
I’m creating a request to establish WS connection using:
host: socket-v3.bittrex.com
port: 443
requestUri (encoded): /signalr/connect?transport=webSockets&clientProtocol=2.0&connectionToken=0kBiAOYeOtyGleCNodFQjl6TxKgBZy6o8RmI96GxteRH+GPfeycU+cyODS8YiAgpvCJ4RTmuQYh3Gr6TKo7U1K/nwi1CQxuaBroX0iF6j/wKxkeU&connectionData%3D%5B%7B%22name%22%3A%22c3%22%7D%5D&tid=0
requestUri (decoded): /signalr/connect?transport=webSockets&clientProtocol=2.0&connectionToken=0kBiAOYeOtyGleCNodFQjl6TxKgBZy6o8RmI96GxteRH GPfeycU cyODS8YiAgpvCJ4RTmuQYh3Gr6TKo7U1K/nwi1CQxuaBroX0iF6j/wKxkeU&connectionData=[{"name":"c3"}]&tid=0
(tid is always constant in the request)
Maybe someone also have the same problem. Do you have any idea what could be wrong? I was trying to put also a ConnectionId into the requestUri but it also did not help.
Thanks
Try use Percent-encoding(https://en.wikipedia.org/wiki/Percent-encoding) for connectionToken and connectionData

Remote access to ArangoDB through Java Interface

I have developed a Java application that uses ArangoDB as backend database (Used ArangoDB Java-Driver/Interface to access ArangoDB).
Everything is good until my ArangoDB and Application resides on same machine.
Once i moved ArangoDB to remote machine(Dedicated Server), my application is unable to access it :(
I have given my remote machine details(ArangoDB Server) in some properties file and feeding that file location to ArangoConfigure Constructor while creating ArangoDriver Object. But still i'm unable to access ArangoDB :(
Small snippet of my code is below:
protected static ArangoConfigure getConfiguration() {
//ArangoConfigure configure = new ArangoConfigure();
ArangoConfigure configure = new
ArangoConfigure("/Volumes/Official/ZLabs/arangodb.properties");
configure.init();
return configure; }
protected static ArangoDriver getArangoDriver(ArangoConfigure
configuration) { return new ArangoDriver(configuration); }
Please help me in this regard.
Awaiting your response.
Thanks & Best Regards,
- Mahi
First of all thank you #dothebart for all your help.
#dothebart, I have checked all the details that you have mentioned, before i posted here. Only thing is missed is HTTP connectivity thanks for pointing that.
Actually the below code change has fixed the problem for me.
Earlier code:
ArangoConfigure configure = new ArangoConfigure("/home/arango.properties");
configure.init();
ArangoDriver driver = new ArangoDriver(configuration);
Modified Code:
ArangoConfigure configure = new ArangoConfigure("/home/arango.properties");
ArangoHost hostObj = new ArangoHost(<IP-Address>, 8529);
configure.setArangoHost(hostObj);
configure.setUser(<user-name>);
configure.setPassword(<password>);
configure.init();
ArangoDriver driver = new ArangoDriver(configuration);
Setting up of host, username and password again is making it to work :(
File has all the details, then why should i provide them again.. I didn't understand that.
#dothebart i'm unable to find the log file, please let me know where can i find it.
If the Aranngodb Java driver fails to open or parse /Volumes/Official/ZLabs/arangodb.properties it issues a log message.
If arangodb properties looks like that:
port=8529
host=192.168.22.17
user=root
password=OpenSesame
enableCURLLogger=false
You start walking up the OSI model to debug TCP connection problems to evade possible connection issues due to firewals, routing etc.
One uses the commonly available telnet command to test the availability of the server:
telnet 192.168.22.17 8529
Trying 192.168.22.17...
If it sits there forever, you most probably have a firewall filtering you away, you finaly will get:
telnet: Unable to connect to remote host: Connection timed out
If it immediately exits with:
telnet: Unable to connect to remote host: Connection refused
It seems the server doesn't answer.
On the server side you then can check whether the service has bound the port (8529) you're trying to connect:
netstat -alpnt |grep 8529
tcp 0 0 0.0.0.0:8529 0.0.0.0:* LISTEN 19912/arangod
If you instead see it binding 127.0.0.1:8529 you won't be able to connect it remotely and need to change arangod.conf like this:
[server]
endpoint = tcp://0.0.0.0:8529
And then restart ArangoDB. Then, you should be able to see something like this:
telnet 192.168.22.17 8529
Trying 192.168.22.17...
Connected to 192.168.22.17.
Escape character is '^]'. <start to type now: >
GET / HTTP/1.0
<server should reply:>
HTTP/1.1 301 Moved Permanently
Location: /_db/_system/_admin/aardvark/index.html
Content-Type: text/html
Server: ArangoDB
Connection: Close
Content-Length: 197
<html><head><title>Moved</title></head><body><h1>Moved</h1>
<p>This page has moved to /_db/_system/_admin/aardvark/index.html.
</p></body></html>Connection closed by foreign host.
This looks like the properties-file isn't found in the classpath.
The path of the log-file should be configured in your log-configuration-file in your project.
Your project may use for example Logback (logback.xml) or another slf4j implementation.

The application can't connect with a solr engine on a different computer

I run my Solr engine on Ubuntu 14.04 in VirtualBox. The guest operating system is connect to local network. It has this IP address: 192.168.10.102.
I'm trying to connect with Solr engine using my browser. I'm going to http://192.168.10.102:8983/solr/ and everything is works.
I wrote an application in Java (with SolrJ). I try to connect to the Solr engine and delete everything. The code looks like this:
server = new HttpSolrServer("http://192.168.10.102:8983/solr/");
server.deleteByQuery("*:*");
server.commit();
Sadly I get an exception:
[main] INFO org.apache.solr.client.solrj.impl.HttpClientUtil -
Creating new http client,
config:maxConnections=128&maxConnectionsPerHost=32&followRedirects=false
Exception in thread "main" org.apache.solr.common.SolrException:
Server at http://192.168.10.102:8983/solr returned non ok status:404,
message:Not Found at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:372)
at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
at
org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)
at
org.apache.solr.client.solrj.SolrServer.deleteByQuery(SolrServer.java:285)
at
org.apache.solr.client.solrj.SolrServer.deleteByQuery(SolrServer.java:271)
...
Everything is good when I comment deleteByQuery() and commit() functions.
How can I solve it?
You have to create any collection your url should look like http://192.168.10.102:8983/solr/collection1 and then you can try do something

Hessian: Java Client can't connect to php server

I am using Hessian Binary Protocol. It works fine when
CASE I:
Server
-- Java
Client
-- Java
-- PHP
CASE II:
Server
-- PHP
Client
-- PHP
But it throws exception
java.io.IOException: Server returned HTTP response code: 500 for URL
when
CASE III:
Server
-- PHP
Client
-- JAVA
I have googled a lot & found this https://code.google.com/p/hessianphp/issues/detail?id=20
Any help ?
Hessian uses v1 as default. It will give you error in the case you're using. However, HessianProxyFactory can be easily switched to v2 mode, like I demonstrate here in the following sample code:
HessianProxyFactory factory = new HessianProxyFactory();
factory.setHessian2Request(true);
// Do something
Source: Hessdroid
Hope that will work for you!

Categories