Azureによって公開されているRESTAPIを使用して、JavaのHTTPClientを介して仮想マシンを作成しようとしています。次のリクエストURLとXMLを使用していますが、「不正なリクエスト」の応答があります。
https://management.core.windows.net/ {subscription-id} / services / hostsedservices/{既存のホスティングサービス名}/deployments
<Deployment xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Name>TestVMAnandP</Name>
<Label>bXl2bQ==</Label>
<RoleList>
<Role>
<RoleName>TestVMAnandP</RoleName>
<RoleType>PersistentVMRole</RoleType>
<ConfigurationSets>
<ConfigurationSet>
<ConfigurationSetType>LinuxProvisioningConfiguration</ConfigurationSetType>
<HostName>TestVMAnandP</HostName>
<UserName>root</UserName>
<UserPassword>test</UserPassword>
</ConfigurationSet>
</ConfigurationSets>
<DataVirtualHardDisks>
<DataVirtualHardDisk>
<Lun>10</Lun>
<LogicalDiskSizeInGB>50</LogicalDiskSizeInGB>
</DataVirtualHardDisk>
</DataVirtualHardDisks>
<OSVirtualHardDisk>
<SourceImageName>srini2-srini2-2012-08-23.vhd</SourceImageName>
<MediaLink>http://sriniteststore.blob.core.windows.net/vhds/srini2-srini2-2012-08-23.vhd</MediaLink>
</OSVirtualHardDisk>
<RoleSize>ExtraSmall</RoleSize>
</Role>
</RoleList>
<VirtualNetworkName>MyNetwork</VirtualNetworkName>
</Deployment>
URLでvm名と同じサービス名を付けようとすると、404エラーが発生します。Webで提供されているサンプルのほとんどを値を置き換えて試しましたが、すべてが400エラーになります。助けがあればいいのにと思います。
エラー:
私が得ている2つの異なる種類のエラー:
Error 1 : When i use new <service-name> inside the below URL .management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deployments/ ------------------------------------------------------------------- Response message--->Not Found---404
java.io.FileNotFoundException: management.core.windows.net/84cc18f5-5bdd-4c95-9d69-862c12c53507/services/hostedservices/anand/deployments
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
Caused by: java.io.FileNotFoundException: management.core.windows.net/84cc18f5-5bdd-4c95-9d69-862c12c53507/services/hostedservices/anand/deployments
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
Error 2 : when i use an existing available <service-name> in the below URL management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deployments/
Response message--->Bad Request---400
java.io.IOException: Server returned HTTP response code: 400 for URL: management.core.windows.net/84cc18f5-5bdd-4c95-9d69-862c12c53507/services/hostedservices/azurecogservice/deployments
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: management.core.windows.net/84cc18f5-5bdd-4c95-9d69-862c12c53507/services/hostedservices/azurecogservice/deployments
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
---------------------有効なXML--------------------------- ----------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Deployment xmlns="http://schemas.microsoft.com/windowsazure">
<Name>190bed4a</Name>
<DeploymentSlot>Production</DeploymentSlot>
<Label>190bed4a</Label>
<RoleList>
<Role>
<RoleName>SuseOpenVm_rolec8fc</RoleName>
<RoleType>PersistentVMRole</RoleType>
<ConfigurationSets>
<ConfigurationSet>
<ConfigurationSetType>LinuxProvisioningConfiguration
</ConfigurationSetType>
<HostName>SuseOpenVm_rolec8fc</HostName>
<UserName>anandsrinivasan</UserName>
<UserPassword>Cloud360</UserPassword>
<DisableSshPasswordAuthentication>false</DisableSshPasswordAuthentication>
</ConfigurationSet>
<ConfigurationSet>
<ConfigurationSetType>NetworkConfiguration</ConfigurationSetType>
<DisableSshPasswordAuthentication>false</DisableSshPasswordAuthentication>
<InputEndpoints>
<InputEndpoint>
<LocalPort>22</LocalPort>
<Name>SSH</Name>
<Port>22</Port>
<Protocol>TCP</Protocol>
</InputEndpoint>
</InputEndpoints>
</ConfigurationSet>
</ConfigurationSets>
<OSVirtualHardDisk>
<MediaLink>https://portalvhdsvf842yxvkhbg4.blob.core.windows.net/vhds/190bed4a.vhd</MediaLink>
<SourceImageName>SUSE__openSUSE-12-1-20120603-en-us-30GB.vhd</SourceImageName>
</OSVirtualHardDisk>
<RoleSize>Small</RoleSize>
</Role>
</RoleList>
<VirtualNetworkName>anand360NW</VirtualNetworkName>
</Deployment>