XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login
    1. Home
    2. Serwetka
    3. Posts
    S
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: Java SDK, XmlRpcClientException: Failed to parse server's response: Duplicate name: restrict_vtpm

      @pxn said in Java SDK, XmlRpcClientException: Failed to parse server's response: Duplicate name: restrict_vtpm:

      If you still encounter this issue - I found the way to bypass it.
      You can create your own mapper by extending on RecursiveTypeParserImpl and just copy-paste logic from MapParser (package org.apache.xmlrpc.parser;), except that logic of checking duplication, then you can inject custom parser to your custom factory (Extend TypeFactoryImpl and override getParser method). And inject this Factory to your client

      new XmlRpcClient().setTypeFactory(new CustomFactory(client));
      

      This works fine for me, I hope this could help you.

      Alex

      posted in REST API
      S
      Serwetka
    • RE: Java SDK, XmlRpcClientException: Failed to parse server's response: Duplicate name: restrict_vtpm

      @Danp
      I'm using XCP-ng 8.3 Latest on VmWare, I'm trying to get all host on my environment. Yes, I'm using the Xenserver SDK to get all hosts, and for such purposes this method used to work great:

      public static Map<Host, Record> getAllRecords(Connection var0) throws Types.BadServerResponse, Types.XenAPIException, XmlRpcException {
              String var1 = "host.get_all_records";
              String var2 = var0.getSessionReference();
              Object[] var3 = new Object[]{Marshalling.toXMLRPC(var2)};
              Map var4 = var0.dispatch(var1, var3);
              Object var5 = var4.get("Value");
              return Types.toMapOfHostHostRecord(var5);
          }
      

      From Host class from Xenserver SDK, but with 8.3 it doesn't work.

      posted in REST API
      S
      Serwetka
    • Java SDK, XmlRpcClientException: Failed to parse server's response: Duplicate name: restrict_vtpm

      Hi!

      The issue concerns working with the XenServer SDK in Java, problem arose upon starting work with the latest version XCP 8.3, and error occurred:

      Caused by: org.apache.xmlrpc.client.XmlRpcClientException: Failed to parse server's response: Duplicate name: restrict_vtpm
      	at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:188) ~[engine.jar:?]
      	at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156) ~[engine.jar:?]
      	at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143) ~[engine.jar:?]
      	at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69) ~[engine.jar:?]
      	at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56) ~[engine.jar:?]
      	at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167) ~[engine.jar:?]
      	at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:137) ~[engine.jar:?]
      	at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:126) ~[engine.jar:?]
      	at com.xensource.xenapi.Connection.dispatch(Connection.java:216) ~[engine.jar:?]
      	at com.xensource.xenapi.Host.getAllRecords(Host.java:3831) ~[engine.jar:?]
      

      The API sends this value twice in the method:

      Host.getAllRecords(connector)
      (package com.xensource.xenapi;)

      Everything else happens under the hood of the library, and I don't have access there, but when debugging, I did indeed discover that the second restrict_vtpm field is being returned.

      restrict.png

      I found the MapParser (package org.apache.xmlrpc.parser;) addResult method doesn't allow working with two identical fields:

      protected void addResult(Object pResult) throws SAXException {
      	    if (inName) {
      	        nameObject = pResult;
              } else {
                  if (nameObject == null) {
          			throw new SAXParseException("Invalid state: Expected name",
          										getDocumentLocator());
          		} else {
          			if (map.containsKey(nameObject)) {
          				throw new SAXParseException("Duplicate name: " + nameObject,
          											getDocumentLocator());
          			} else {
          				map.put(nameObject, pResult);
          			}
          		}
              }
      	}
      

      So, the Java libraries don't allow this behavior.

      I started looking for this setting in XCP UI and CLI but couldn't find any specific restriction related to vTPM. My searches also didn't yield any results.

      Thus, I have no access to the internals of the library, nor do I have control over this setting. Could you suggest please what could be done in this case? Could this issue be related to my use of an old version of your SDK (xenserver-7.6.0)?

      If so, is there any way I can fix it without updating the library? (I have too many dependencies tied to it already.)

      Thanks in advance and have a nice day!

      posted in REST API
      S
      Serwetka