VMware Cloud Community
corneliuLungoci
Contributor
Contributor

vCloud 5.1 SDK i18n

Hello,

I am trying to create a catalog with japanese characters in the name using the vCloud 5.1 sdk, and i always get this error message:

com.vmware.vcloud.sdk.VCloudException: validation error on field 'name': String value has invalid format.

I have successfully created catalogs with english characters using sdk. Also, from the vCloud web UI i can create catalog with japanese characters in the name.

Did anyone try to use japanese characters with the vCloud 5.1 sdk?

Or does anyone know if the sdk supports i18n?

Thank you,

Corneliu

0 Kudos
4 Replies
rkamal
VMware Employee
VMware Employee

Hi,

I was able to create a catalog with this name - カタログのユーザー

Attached the XML requests and responses generated from the Java SDK logs.

Dec 18, 2012 10:57:38 AM com.vmware.vcloud.sdk.RestUtil post
Dec 18, 2012 10:57:38 AM com.vmware.vcloud.sdk.RestUtil post
INFO: POST Request Body - <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
Dec 18, 2012 10:57:38 AM com.vmware.vcloud.sdk.RestUtil post
INFO: POST Request Content Type - application/vnd.vmware.admin.catalog+xml
Dec 18, 2012 10:57:39 AM com.vmware.vcloud.sdk.RestUtil post
INFO: Status Code - 201
Dec 18, 2012 10:57:39 AM com.vmware.vcloud.sdk.RestUtil post
INFO: Status - Created
Dec 18, 2012 10:57:39 AM com.vmware.vcloud.sdk.RestUtil post
INFO: Response - <?xml version="1.0" encoding="UTF-8"?>
<AdminCatalog xmlns="http://www.vmware.com/vcloud/v1.5" name="カタログのユーザー" id="urn:vcloud:catalog:7f51f163-f315-4de4-ab4c-231ef282f828" type="application/vnd.vmware.admin.catalog+xml" href="https://10.132.99.139/api/admin/catalog/7f51f163-f315-4de4-ab4c-231ef282f828" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://10.132.99.139/api/v1.5/schema/master.xsd">
    <Link rel="up" type="application/vnd.vmware.admin.organization+xml" href="https://10.132.99.139/api/admin/org/f707ba7e-3124-4375-9185-8cdc058dba4f"/>
    <Link rel="alternate" type="application/vnd.vmware.vcloud.catalog+xml" href="https://10.132.99.139/api/catalog/7f51f163-f315-4de4-ab4c-231ef282f828"/>
    <Link rel="down" type="application/vnd.vmware.vcloud.owner+xml" href="https://10.132.99.139/api/admin/catalog/7f51f163-f315-4de4-ab4c-231ef282f828/owner"/>
    <Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://10.132.99.139/api/admin/catalog/7f51f163-f315-4de4-ab4c-231ef282f828/metadata"/>
    <Link rel="add" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://10.132.99.139/api/catalog/7f51f163-f315-4de4-ab4c-231ef282f828/catalogItems"/>
    <Link rel="edit" type="application/vnd.vmware.admin.catalog+xml" href="https://10.132.99.139/api/admin/catalog/7f51f163-f315-4de4-ab4c-231ef282f828"/>
    <Tasks>
        <Task status="running" startTime="2012-12-18T10:57:25.766-08:00" serviceNamespace="com.vmware.vcloud" operationName="catalogCreateCatalog" operation="Creating Catalog カタログのユーザー(7f51f163-f315-4de4-ab4c-231ef282f828)" expiryTime="2013-03-18T10:57:25.766-07:00" cancelRequested="false" name="task" id="urn:vcloud:task:e48f45ae-0d6a-4ef9-b08d-d6370c6cecdf" type="application/vnd.vmware.vcloud.task+xml" href="https://10.132.99.139/api/task/e48f45ae-0d6a-4ef9-b08d-d6370c6cecdf">
            <Link rel="task:cancel" href="https://10.132.99.139/api/task/e48f45ae-0d6a-4ef9-b08d-d6370c6cecdf/action/cancel"/>
            <Owner type="application/vnd.vmware.admin.catalog+xml" name="カタログのユーザー" href="https://10.132.99.139/api/admin/catalog/7f51f163-f315-4de4-ab4c-231ef282f828"/>
            <User type="application/vnd.vmware.admin.user+xml" name="system" href="https://10.132.99.139/api/admin/user/2e37a255-fe53-4cdc-9c0d-935e9aed6f9c"/>
            <Organization type="application/vnd.vmware.vcloud.org+xml" name="cloudOrg" href="https://10.132.99.139/api/org/f707ba7e-3124-4375-9185-8cdc058dba4f"/>
            <Progress>0</Progress>
            <Details/>
        </Task>
    </Tasks>
    <CatalogItems/>
    <IsPublished>false</IsPublished>
</AdminCatalog>

Regards,

Rajesh Kamal.

0 Kudos
corneliuLungoci
Contributor
Contributor

Hello,

Thank you for your answer.

I am still not able to do this.

This is the java code that i am using to create the catalog:

            AdminOrganization aOrg = getAdminOrganization(organizationName)

            AdminCatalogType catalogType = new AdminCatalogType();
            catalogType.setName(catalogName);
            catalogType.setDescription(desc);
            catalogType.setIsPublished(isPublished);

            aOrg.createCatalog(catalogType)

The catalogName is: "カタログ"

But the request body looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<ns6:AdminCatalog xmlns="http://www.vmware.com/vcloud/versions" xmlns:ns2="http://schemas.dmtf.org/ovf/envelope/1"

xmlns:ns3="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"

xmlns:ns4="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ns5="http://schemas.dmtf.org/wbem/wscim/1/cim-

schema/2/CIM_ResourceAllocationSettingData" xmlns:ns6="http://www.vmware.com/vcloud/v1.5" xmlns:ns7="http://www.vmware.com/schema/ovf"

xmlns:ns8="http://schemas.dmtf.org/ovf/environment/1" xmlns:ns9="http://www.vmware.com/vcloud/extension/v1.5" name="カタログ">

    <ns6:IsPublished>false</ns6:IsPublished>

</ns6:AdminCatalog>

So i gess that the SDK, when generates the request body, transforms the name from "カタログ" to "カタログ".

I am using the vCloud sdk 5.1

Am i doing something wrong? Should i set any property that i am missing, or am i using the wrong sdk?

Corneliu

0 Kudos
corneliuLungoci
Contributor
Contributor

Hello,

After a investigating this in more detail, I've came to the following conclusion:

The vCloud Java SDK 5.1 uses the default JVM encoding when it builds the request xml.

I have tested the following code:

             AdminOrganization aOrg = getAdminOrganization(organizationName)

            AdminCatalogType catalogType = new AdminCatalogType();
            catalogType.setName(catalogName);
            catalogType.setDescription(desc);
            catalogType.setIsPublished(isPublished);

            aOrg.createCatalog(catalogType)

If it executed in a JVM with default encoding "UTF-8" - the code works just fine with japaneese characters.

If the same code is executed in a JVM with default encoding "windows-1252" - the request body is built wrong.(the string "カタログ" is transformed in "カタログ").

The default character set of the JVM is that of the system it's running on.

So, after this investigation, my assumption is that the Java SDK is dependent on the system it is running on.

Is there a way i can force the sdk not to use the default JVM charset?

Thank you,

Corneliu

0 Kudos
IonutVranau
Contributor
Contributor

I am facing the same issue. As corneliu said, is there a way to force the sdk not to use the default JVM charset?

0 Kudos