Programmatically creating VM from already created image using Java

Hello.
I am writing a Java program to create VMs from already created VM images. I was able to create through the web portal.
I am using the API given here http://msdn.microsoft.com/en-us/library/jj157194.aspx
The request sent is
<?xml version="1.0" encoding="UTF-8"?>
<Deployment xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Name>mltestdeploy</Name>
<DeploymentSlot>Production</DeploymentSlot>
<Label>ZGVwbG95bWVudF9tbHRlc3RkZXBsb3k=</Label>
<RoleList>
<Role>
<RoleName>mltesthost</RoleName>
  <RoleType>PersistentVMRole</RoleType>
<VMImageName>ml-centos-image</VMImageName>
</Role>
</RoleList>
</Deployment>
"ml-centos-name" is an existing image with that name and I have used this to create another VM from this image.
I have already created the required cloud service as required by this API.
I am getting error 400 with text as "Bad Request". This means some parameter is wrong.
Any help is very much appreciated.
-Siva

Now instead of the VMImageName, I used SourceImageName as given in the example.
The XML body now looks like
<Deployment xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Name>mltestdeploy</Name>
<DeploymentSlot>Production</DeploymentSlot>
<Label>ZGVwbG95bWVudF9tbHRlc3RkZXBsb3k=</Label>
<RoleList>
<Role>
<RoleName>mltesthost</RoleName>
<RoleType>PersistentVMRole</RoleType>
<ConfigurationSets>
<ConfigurationSet i:type="LinuxProvisioningConfigurationSet">
<ConfigurationSetType>LinuxProvisioningConfiguration</ConfigurationSetType>
<HostName>mltesthost</HostName>
<UserName>mladmin</UserName>
<UserPassword>password</UserPassword>
<DisableSshPasswordAuthentication>false</DisableSshPasswordAuthentication>
</ConfigurationSet>
</ConfigurationSets>
<OSVirtualHardDisk>
<MediaLink>http://portalvhds7dplkth082kmh.blob.core.windows.net/vhds/1v5wpayu.pwl201404160535060424.vhd</MediaLink>
<SourceImageName>ml-centos-image</SourceImageName>
</OSVirtualHardDisk>
</Role>
</RoleList>
</Deployment>
Even now I get the same 'Bad Request' error.
Is there any way to find out which element is causing this Bad Request error? Thanks

Similar Messages

  • Creating image using swing

    Hi,
    I want to create a image of the data in a tabular format.Can we create image using swing. or i require any other api for it.
    Can any one help me.
    Thanks in advance!!

    1. create a TableModel populated with your data
    2. create a JTable based on that model
    3. get the preferred size of that table
    4. create a BufferedImage of the same size
    5. get the Graphics of that image
    6. set the JTable's size to its preferred size
    7. pass the Graphics object to the table's paint() method
    8. dispose the Graphics object

  • How to save report in PersonalCategory  after creating it using java panel?

    Hi,
    Anybody knows How to save report in PersonalCategory  after creating it using java panel?
    I dont want to save it in public folder. I want to save report (webi) in user's personal category.
    can anybody send me source code?
    It will help me a lot.
    Thanks in advance
    Amol Mali

    Hi teda,
    i'm assuming that you have seen my post that i did successfuly save report in user's personal category.
    Actually the report is created in webi java panel using RE SDK and  is saved in Report Sample Folder then i'm saving it in user's personal category by following code
    string query = "Select SI_PERSONAL_CATEGORIES From CI_INFOOBJECTS Where "
                         + "SI_INSTANCE=0 And SI_ID=" + reportID;
                    InfoObjects infoObjects = infoStore.Query(query);
                    InfoObject infoObject = infoObjects[1];
                    Webi wreport = (Webi)infoObject;
                    ObjectRelativeIDs personalIDs = wreport.PersonalCategories;
                /personalIDs.Add(Convert.ToInt32(categoryID));
                   infoStore.Commit(infoObjects);
    But the report is presents in the Folder also and in user's personal category also.
    I dont want the report to be in the folder (Report Sample) if i saved it in user's personal category.
    How can i do that?
    any idea.
    Please help me.
    Thanks in advance
    Amol Mali
    Edited by: amol mali on Jan 9, 2009 7:55 PM

  • Is is possible to create Socket using Java Stored Procedures/Function(Ora)?

    Hello Friends,
    Is is possible to create Socket using Java Stored Procedures/Function in Oracle?
    OR
    How I can send a message from oracle to Java Desktop Application which is working like server program?
    Please Guide !!

    J3Ganesh wrote:
    Hello Friends,
    Is is possible to create Socket using Java Stored Procedures/Function in Oracle?No, Oracle was very careful to take that feature out of the JDK provided in Oracle 10/11, but you can buy that feature back for, if I remember correctly, about 5000 dollars. (I actually raised a service request on this and then told my rep what I thought about the answer I received--some thing along the line of money grubbing so and so....)
    How I can send a message from oracle to Java Desktop Application which is working like server program?You can make a table and poll it from time to time from the Java side and write and commit what ever you want to the table. I do not know any way to send a signal from Oracle DB an external Java application--Java or PL/SQL stored procedure.

  • How to get the values from struct data type using java code..?

    Hi ,
    I am newer to java.
    we are using oracle database.
    How to get the data from struct data type using java code.
    Thanks in Advance.
    Regards,
    kumar

    Hi Rajeev,
    To retrieve a FilterContainer you will need to traverse the report structure:
    ReportStructure boReportStructure = boDocumentInstance.getStructure();
    ReportContainer boReportContainer = (ReportContainer) boReportStructure.getReportElement(0);
    FilterContainer boFilterContainer = null;
    if (boReportContainer.hasFilter()) {
         boFilterContainer = boReportContainer.getFilter();
    } else {
         boFilterContainer = boReportContainer.createFilter(LogicalOperator.AND);
    Calling boDocumentInstance.getStructure() will retrieve the entire structure for the document.
    Calling boReportStructure.getReportElement(0) will retrieve the structure for the first report of the document.
    Hope this helps.
    Regards,
    Dan

  • How to resize image using java imageio

    Hello ,
    I want to know how to resize image using java imageio.
    I dont want to use java awt because i am writing a web application.
    help is very much needed
    thank you.

    Just use an AffineTransform !
    Its much easier

  • Create Image using MDT 2013

    Hi ,
    I am quite new for MDT 2013. I have recently installed MDT 2013 in my Windows Server 2012.
    Now , I do have about 10 physical machine with different hardware specification inside. I have installed Windows 8.1 with all required software in it and now I want to distribute the same image in all 10 another physical machine.
    Can anyone provide me the steps to implement this...
    Do I need to create the image using image x software and then use it as a standard image to be deploy it in rest of the systems..
    Thank you...

    I was getting exact same error.
    here is what I did to fix it.
    You need to do all this in a virtual envinronment.
    1- import Windows 8.1 x64 from the DVD and add it to your listed os in MDT
    2- create standard task sequence and select the OS you imported in step one. you need to add suspend to your TS ( look it up on how to )
    3- For some reason WinPe x64 bit kept giving error during deployment so I used WinPe x86.
    4- import Winpe x86 boot.wim into your WDS if you use Pxe boot or create a boot disk from the ISO and boot your VM from it.
    5- deploy windows 8.1 x64 to your VM ,make sure to select " capture image ".
    make all the necessary changes when windows is installed  and MDT  suspends the deployment, take snapshot of your VM , and then cintinue the deployment to finish the capture.
    6- import the new captured image into MDT
    7- creates new standard TS or modify your existing one to deploy the newly captured image.
    8- update your deployment share and start the deployment of your new image.

  • How can I programmatically create and use a global variable?

    I have an app where the number of AI DAQmx tasks I create are specified in a config file.  I have a monitor task that periodically looks at the latest values from all DAQ tasks.  I've been doing this with a set of global variables because it was the simplest way to do it.  But to do this, I have to explicitly create a separate AI task that uses the hard-coded global variable name for the DAQmx samples.  I would prefer to only write one VI for the DAQ loop that writes to a global variable that I programmatically create based on the config file.  The only solution I can think of is to use a global variable "pool" that is sized bigger than I expect to need, and then have a big switch case to select which one I want based on the task index.  But this sounds pretty silly.

    I tend to agree with Ben. I don't buy the concept of taking the asy way out (globals) because it very rarely will things remain static. You almost always have to extend the features and functionality of an application and then you will run into issues with sloppy and lazy implementations. The solutions offered may require a little time to learn but once you do it doesn't really require any extra effort.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Creating reports using java

    hello java fanatics! :D
    im a vb programmer and created an ActiveX Printer Control. this ActiveX is downloaded on the client browsers (IE) and called by my vbscript for me to access its functions. but my problem is that... it only works on IE!
    one of my friend told me that the only way i can resolve this issue is recode my ActiveX Printer Control in JAVA (applet). i've done some research about it but i cant find a specific tutorial on how can i print on the client side using JAVA applet.
    i've done some CSS reports but my reports should be 8.5 X 5.5 inch. is it possible also to set some custom page layout in JAVA?

    It seems that you already have the material to be printed in the final format and you just want to send them to the printer.
    If you want to do printing yourself you can use java print api
    its in java.awt.print and javax.print packages.
    If you search for tutorials for java print api you'll get what you want.
    But if you want just to get the job done the best way is to write a serverside program (a Servlet) to display the content that need to be printed on the browser. So the user can directly use File->Print command or you can even put a print button on the page which executes the javascript print command
    or just execute it automatically by adding a javascript at the bottom of the page.

  • How to extract the number from image using java

    Hello every one
    i want to develope a project which can extract the number from image
    that i can use as inter or String or char.
    Is there any API in java which provide this type of facility.
    right now i m using java 5
    thanks in Advance
    Jignesh

    In my project i have a image in that i have a
    co-ordinate (x,y) I am still puzzled as to what you seek. It sounds to me like you have a point (x, y) represented by p. in java it's just p.getX() p.getY()
    i want to convert that cordinate to numeric form,
    i mena i want to use that cordinate in somewhere else
    in project.point.getX() point.getY()
    So need to convert it into numeric form u can called
    it OCR also.OCR is optical character recognition. If I want out and took a picture of the US Declaration of Independence and then wanted the words on the parchement in the picture in text form, then I would run the picture through a software program and it would try to optically recognise what lettering and number were present in the picture. In the end, I would have a text of what is written on the US Declaration of Independence.
    Is that what you want?

  • How to create Webservice using java

    Hi Experts,
          I am very new to Visual composer, can any one of you suggest how to create a webservice using java so that i can use that webservice in Visual Composer application.If it is possible please give me detailed description about it.
    Regards,
    Prasanna.

    Hi Prasanna,
    See if my article is of any use to you:
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/b00917dc-ead4-2910-3ebb-b0a63e49ef10">How to Create a Web Service using an Enterprise JavaBean</a>
    For creating Web Services, you won't need to do the MS SQL Part explained in my doc. You can just concentrate on the part where i explain how to create a Web Service using an EJB.
    Bye
    Ankur

  • Creating links using Java

    I am using Java code to develop an FAQ tool. I would like to provide links (html links) in the applet. When user clicks on the link the appropriate URL should open in the browser (same like the anchor tag of HTML.) Can anybody suggest how this can be done?

    In the applet,
    "getAppletContext().showDocument(yourUrl);" will show
    the document pointed by the URL yourUrl in the browser
    window. See the api docs of java.applet.AppletContext
    for overloads / instructions.ThanQ.
    Once more doubt, is it possible to open the link in a new browser window instead of the same window where the applet is running?

  • How do I overlay n number of  bitmap images using Java.

    Hi All,
    I have a task of creating a composite bitmap or a .gif image from "n" number of bitmap images , so that the resulting composite image will look like as if all those "n" images were placed side by side . How can I achieve this ? Can you point me to some place where I can understand the concepts behind this?

    Create a new BufferedImage with the dimensions of all the images you want combined, then paint all the images into it through the Graphics object you can obtain from the BufferedImage. Then write out the image using the ImageIO class.

  • How to get pdf file from sap presentation server using java connector

    Hi Friends,
    with the below code i am able to get po details in pdf in presentation server.
    DATA : w_url TYPE string
           VALUE 'C:\Documents and Settings\1011\Solutions\web\files\podet.pdf'.
    CALL FUNCTION 'ECP_PDF_DISPLAY'
            EXPORTING
              purchase_order       = i_ponum
           IMPORTING
      PDF_BYTECOUNT        =
             pdf                  = file  " data in Xsting format
    *Converting Xstring to binary_tab
          CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
            EXPORTING
              buffer                = file
      APPEND_TO_TABLE       = ' '
    IMPORTING
      OUTPUT_LENGTH         =
            TABLES
              binary_tab            = it_bin " data in binary format
    **Downloading into PDF file
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
      BIN_FILESIZE                    =
              filename                        = w_url
              filetype                        = 'BIN'
             TABLES
              data_tab                        = it_bin
    when i am using java connector , to retirve the file from presentation server , the follwoing error i am getting...
    init:
    deps-jar:
    compile-single:
    run-single:
    com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Error in Control Framework
            at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeExecute(Native Method)
            at com.sap.mw.jco.rfc.MiddlewareRFC$Client.execute(MiddlewareRFC.java:1244)
            at com.sap.mw.jco.JCO$Client.execute(JCO.java:3842)
            at com.sap.mw.jco.JCO$Client.execute(JCO.java:3287)
            at PdfGen.<init>(PdfGen.java:35)
            at PdfGen.main(PdfGen.java:78)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 1 second)
    i debugged too, problem with <b>gui_download......</b>
    I am very glad to all with your suggestions!!
    Regards,
    Madhu..!!

    Hi
    You can try to create an external command (transaction SM69).......sorry I've forgotten,,,,they works on application
    How do you call CL_GUI_FRONTEND_SERVICES=>EXECUTE?
    Max
    Edited by: max bianchi on Oct 13, 2011 10:27 AM

  • How to convert JPEG - PNG images using java?

    Hi,
    Has anyone done this before?
    Can you provide me with a sample code or point me to the direction on how this can be done?
    Are there any existing Java technology that supports this?
    Most grateful. Thanks.

    It's should be easy using Java Advanced Imaging (JAI). Try this.
    import javax.media.jai.JAI;
    import javax.media.jai.RenderedOp;
    public class convert {
      static public void main(String[] args) {
        String inName = args[0];
        String outName = args[1];
        RenderedOp source = JAI.create("fileload", inName);
        JAI.create("filestore", source, outName, "PNG", null);
        System.exit(0);
    }

Maybe you are looking for