我试图发送使用AMF连接API,但得到以下错误,如下图所示AMF消息。
ClientStatusException
message: Unsupported AMF version
我使用BlazeDS的核心 - 4.0.1.21287.jar用于这一目的。
以下是我的代码。
String url = "https://10.222.73.251:9443/vsphere-client/#";
try {
amfConnection.connect(url);
System.out.println(amfConnection.getUrl());
} catch (ClientStatusException cse) {
System.out.println("Error connecting url: " + cse);
return;
}
try {
amfConnection.addHttpRequestHeader("Cookie",
"6250CED9FBC7D5894B79973DEC1503A6");
amfConnection.addHttpRequestHeader("Content-type",
"application/x-amf");
amfConnection.setAmfTrace(new AmfTrace());
//amfConnection.setObjectEncoding(3);
System.out.println(amfConnection.getObjectEncoding());
CommandMessage cmsg = new CommandMessage();
cmsg.setOperation(CommandMessage.CLIENT_PING_OPERATION);
cmsg.setMessageId(UUIDUtils.createUUID());
cmsg.setHeader(Message.FLEX_CLIENT_ID_HEADER, "706E5399-D81A-11C8-11F7-BE5F1940632E");
cmsg.setHeader(Message.ENDPOINT_HEADER, "amf");
AcknowledgeMessage ack = (AcknowledgeMessage)amfConnection.call(null, cmsg);
任何帮助表示赞赏。 :)