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!
Related
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
We have implemented webservice call using JAX-WS RI 2.1.6 in JDK 6 now problem comes when we enable https webservice call stops reaching server and java reports following error,
javax.xml.ws.WebServiceException: java.io.IOException: Async IO
operation failed (3), reason: RC: 55 The specified network resource
or device is no longer available.
Now I have tested this within SoapUI and response from the service is received there.
Looked into various solution where it tells us to provide timeout settings but nothing seems work.
#WebEndpoint(name = "RulesSoap")
public RulesSoap getRulesSoap() {
((BindingProvider)super.getPort(new QName("urn:decision:Rules", "RulesSoap"), RulesSoap.class)).getRequestContext().put("com.sun.xml.internal.ws.connect.timeout", 1000);
((BindingProvider)super.getPort(new QName("urn:decision:Rules", "RulesSoap"), RulesSoap.class)).getRequestContext().put("com.sun.xml.internal.ws.request.timeout", 1000);
return super.getPort(new QName("urn:decision:Rules", "RulesSoap"), RulesSoap.class);
}
And just for information JAX-WS implementation is following few simple lines,
of course we submit all necessary data into respective stubs and all but I am not submitting here because our http calls are getting through,
Rules rules = new Rules(new URL(url), new QName("urn:decision:Rules", "Rules"));
RulesSoap rulesSoap = rules.getRulesSoap();
CorticonResponse response = rulesSoap.processRequest(request);
Note : Our application server WebSphere Application Server and Version 7.0.0.19
Thanks in Advance.
After lots of efforts we resolved this. I will provide steps if anything related to this happens how to find root cause,
Step 1 :
First of all we enabled soap tracing in WebSphere Application Server by following setting,
Admin Console > Servers > Server Types > WebSphere Application Servers >
{your server} > Troubleshooting > Change Log Detail Levels > Runtime
In run time please put this , *=info: com.ibm.ws.websvcs.*=all: org.apache.axis2.jaxws.*=all
This step will create trace.log file in your logs folder.
Now any web service request which goes out of your server will add logs to this file and necessary props like endpoint, request, response etc.
Step 2 :
Reading this trace.log file we found following endpoint,
PropertyValid 1 org.apache.axis2.jaxws.client.PropertyValidator validate validate property=(javax.xml.ws.service.endpoint.address) with value=(http://uxm.solutions.lnet.com:9445/axis/dswsdl/Rules/1/0)
HTTPConnectio 3 resetConnection : http://uxm.solutions.lnet.com:9445/axis/dswsdl/Rules/1/0 Persistent : true
Now if you notice here that our soap has endpoint address javax.xml.ws.service.endpoint.address where protocol is still using http which causes to fail ssl handshake.
Step 3 :
Solution for this is to override endpoint inside your soap stubs which can be implemented by adding following line,
RulesSoap rulesSoap = rules.getRulesSoap();
((BindingProvider)rulesSoap).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "https://uxm.solutions.lnet.com:9445/axis/dswsdl/Rules/1/0");
Conclusion :
So here is what i think even we pass https url while we are creating objects but still does not take this https url on runtime, to me this looks like stubs creation issue with JAX-WS.
Thanks.
What protocol /ciphers are you using? You have mentioned there is connection to webservice on WAS7 with JDK6 and Java 6 does not support TLS1.2 (and TLS1.1 only from certain fixpack).
See this:
How to use TLS 1.2 in Java 6
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!
I'm trying to create SSL connection to a website (https://www.otten-markenshop.de/), and using browser or curl it works, but neither wget, no Java manages to connect. I am mostly interested in why does Java code fail.
Here are the error details:
Using WGET:
wget https://www.otten-markenshop.de/
results in
Resolving www.otten-markenshop.de... 217.24.213.167
Connecting to www.otten-markenshop.de|217.24.213.167|:443... connected.
ERROR: certificate common name “www.plentymarkets.eu” doesn’t match requested
host name “www.otten-markenshop.de”.
Using Java:
public static void main(String[] args) throws IOException
{
URL url = new URL("https://www.otten-markenshop.de");
URLConnection connection = url.openConnection();
connection.getInputStream();
}
results in:
Exception in thread "main" javax.net.ssl.SSLHandshakeException:
java.security.cert.CertificateException: No subject alternative DNS
name matching www.otten-markenshop.de found.
What else I have noticed is that certificate I receive in browser is different from the certificate I receive when running Java program:
in browser:
Common Name (CN):
www.otten-markenshop.de
Subject Alternative Name:
DNS Name=www.otten-markenshop.de
DNS Name=otten-markenshop.de
in Java:
Common Name (CN):
www.plentymarkets.eu
Subject Alternative Name:
And the certificate I get in Java is the same as I would receive in browser if I try to access the host by IP address: https://217.24.213.167
Thus it appears that server has multiple certificates installed and uses virtual hosts to detect which certificate should be used. But for some reason this detection does not work when client is Java or wget.
Any ideas why is this happening?
P.S. I don't have access to the destination server to see how it is configured.
P.P.S. I am interested more in understanding why the simple Java code does not work, rather than making it work by, for instance, disabling the SSL verification. After all I can connect to the mentioned URL over HTTP without any issues.
Having multiple certificates on the same IP address and port relies on Server Name Indication.
Your server supports it, but your client needs to support it too.
Client-side support for SNI was only introduced in Java in Java 7 (see release notes)(*). I guess you're using Java 6 or below, otherwise your simple example with URLConnection should work out of the box like this.
(You may also need additional settings if you're using another client library, such as Apache HTTP Client, depending on the version.)
(*) And this was introduced on the server side in Java 8, but that's not really your problem here.
I am trying to connect to Mercury mail server with a java application and I am using JavaMail api. The connection is not successful and I’m getting this error in the log:
EHLO x.x.x.x
554 Invalid HELO format
Which means that it connects to the server but the helo format is not something that sever likes. I've tired to debug it and I got to this code in JavaMail “SMTPTransport” class which says:
serverOutput.write(cmdBytes);
serverOutput.write(CRLF);
serverOutput.flush();
and according to code:
private static final byte[] CRLF = { (byte)'\r', (byte)'\n' };
which seems consistent with RFC 821
I know that on windows \n has different meaning but I am not sure if this really is the root of problem? If it not then what can cause this?
I checked mail server with mail client and it works fine and I checked the code with James mails server and it also works fine!
JavaMail API version is: 1.4.5 (latest release)
Mercury/32 : 4.7
I did a Google search on 554 Invalid HELO format and got a ton of hits about your specific Mercury problem. It's a bug.
http://community.pmail.com/forums/thread/4136.aspx
http://www.mantisbt.org/bugs/view.php?id=9645
http://ellislab.com/codeigniter/forums/viewthread/153130/
etc...
You might need to check the logs on the server to figure out what it's really complaining about, but... One thing you can try is setting the mail.stmp.localhost property to the correct DNS host name for your machine. From the debug output it looks like your machine is unable to determine its own name and so is sending the IP address instead.
For me in a web project the PHPMailer() class was forcing Auth. Changing the Auth to false fixed it. Maybe check similar option for setting Auth to false in your language.
This is what I changed in my PHP code from true to false and adding sendmail_from in the php.ini file
$mail = new PHPMailer();
$mail->SMTPAuth = false;