在尝试使用Powershell通过Web Service Proxy与Web Service进行交互时,我面临这样的效果:Web Service的方法返回的对象被解码,因此它们缺乏深度-属性中缺少嵌套的聚合数据类型返回数据。我正在获取$ null值。 string , int 和 bool 之类的原始类型似乎可以正确解码。
使用的代码:
$SOAPBundleAdmin = New-WebServiceProxy -Uri "http://$ZCMServer/zenworks-bundleadmin/?wsdl" -Credential $ZenCredential -Class BundleAdmin -Namespace Zenworks
$MyBundle = $SOAPBundleAdmin.getByUID("/Bundles/Applications/SetupStore/ADOBE/Adobe-Test-1234-x86")
现在,ActionSets是5个对象的实际数组,但此处为空:
$MyBundle | gm -Name ActionSets
TypeName: Zenworks.Bundle
Name MemberType Definition
---- ---------- ----------
ActionSets Property Zenworks.ActionSet[] ActionSets {get;set;}
$null -eq $MyBundle.ActionSets
True
CreationDate是一个System.DateTime,并且显然已设置为零:
$MyBundle.CreationDate
Monday, January 1, 0001 12:00:00 AM
查看为相应请求返回的HTTP数据,我看不到任何明显的问题:
<ns3:ActionSets xmlns="http://novell.com/zenworks/datamodel/objects/actions" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/actions">
<Id>941dc9d74b4244c955502a00abbdad9c</Id>
<Type>Distribution</Type>
<Version>1</Version>
<Modified>false</Modified>
<Actions>
<Id>5afec5b3c4c9c026c34f1e7080d02220</Id>
<Type>Distribute Action</Type>
<ContinueOnFailure>false</ContinueOnFailure>
<Enabled>true</Enabled>
<actionUniqueId>f873d55e0de647c1ccf4b9899485d0b4</actionUniqueId>
</Actions>
</ns3:ActionSets>
<!-- [... 4 more ActionSets following...] -->
<ns2:CreationDate>2018-12-07T13:47:04</ns2:CreationDate>
为什么响应未正确解码?最终,我的目标是能够获得“健康”的对象,这些对象可以馈入Web服务类的设置器/更新方法。当前,它们似乎已瘫痪,并被Web服务拒绝,并带有参数语法错误的指示。
我愿意使用与WebServiceProxy不同的访问方法,但是我需要知道这里发生了什么以及为什么。
完整的SOAP响应供参考:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Content-Length: 14609
Date: Fri, 07 Dec 2018 14:40:01 GMT
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><SOAP-ENV:Body><ns1:getByUIDResponse xmlns="http://novell.com/zenworks/datamodel/services/bundles/soap" xmlns:ns1="http://novell.com/zenworks/datamodel/services/bundles/soap"><return xmlns:ns2="http://novell.com/zenworks/datamodel/objects/bundles" xsi:type="ns2:Bundle"><ns3:UID xmlns="http://novell.com/zenworks/datamodel/objects" xmlns:ns3="http://novell.com/zenworks/datamodel/objects">ad564657da13f6adb89bc24546d329ff</ns3:UID><ns3:Name xmlns="http://novell.com/zenworks/datamodel/objects" xmlns:ns3="http://novell.com/zenworks/datamodel/objects">Adobe-Test-1234-x86</ns3:Name><ns3:InternalName xmlns="http://novell.com/zenworks/datamodel/objects" xmlns:ns3="http://novell.com/zenworks/datamodel/objects">Adobe-Test-1234-x86</ns3:InternalName><ns3:ParentUID xmlns="http://novell.com/zenworks/datamodel/objects" xmlns:ns3="http://novell.com/zenworks/datamodel/objects">fe672af189fbd66efe4d8541812015de</ns3:ParentUID><ns3:Path xmlns="http://novell.com/zenworks/datamodel/objects" xmlns:ns3="http://novell.com/zenworks/datamodel/objects">/Bundles/Applications/SetupStore/ADOBE/Adobe-Test-1234-x86</ns3:Path><ns3:InternalPath xmlns="http://novell.com/zenworks/datamodel/objects" xmlns:ns3="http://novell.com/zenworks/datamodel/objects">/~bundles~/Applications/SetupStore/ADOBE/Adobe-Test-1234-x86</ns3:InternalPath><ns3:AdminID xmlns="http://novell.com/zenworks/datamodel/objects" xmlns:ns3="http://novell.com/zenworks/datamodel/objects">Bundles</ns3:AdminID><ns3:Description xmlns="http://novell.com/zenworks/datamodel/objects" xmlns:ns3="http://novell.com/zenworks/datamodel/objects">Testbundle für die Überprüfung der AD-Gruppenerstellung
</ns3:Description><ns3:PrimaryType xmlns="http://novell.com/zenworks/datamodel/objects" xmlns:ns3="http://novell.com/zenworks/datamodel/objects">Bundle</ns3:PrimaryType><ns3:SubType xmlns="http://novell.com/zenworks/datamodel/objects" xmlns:ns3="http://novell.com/zenworks/datamodel/objects">Windows Bundle</ns3:SubType><ns3:GeneralType xmlns="http://novell.com/zenworks/datamodel/objects" xmlns:ns3="http://novell.com/zenworks/datamodel/objects">2</ns3:GeneralType><ns3:Deletable xmlns="http://novell.com/zenworks/datamodel/objects" xmlns:ns3="http://novell.com/zenworks/datamodel/objects">true</ns3:Deletable><ns3:Undeletable xmlns="http://novell.com/zenworks/datamodel/objects" xmlns:ns3="http://novell.com/zenworks/datamodel/objects">false</ns3:Undeletable><ns3:ErrorWarningStatus xmlns="http://novell.com/zenworks/datamodel/objects" xmlns:ns3="http://novell.com/zenworks/datamodel/objects">1</ns3:ErrorWarningStatus><ns3:ComplianceStatus xmlns="http://novell.com/zenworks/datamodel/objects" xmlns:ns3="http://novell.com/zenworks/datamodel/objects">1</ns3:ComplianceStatus><ns3:IsEnabled xmlns="http://novell.com/zenworks/datamodel/objects/assignablecontent" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/assignablecontent">true</ns3:IsEnabled><ns3:Version xmlns="http://novell.com/zenworks/datamodel/objects/assignablecontent" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/assignablecontent">1</ns3:Version><ns3:Revision xmlns="http://novell.com/zenworks/datamodel/objects/assignablecontent" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/assignablecontent">0</ns3:Revision><ns3:ContentInfoVer xmlns="http://novell.com/zenworks/datamodel/objects/assignablecontent" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/assignablecontent">0</ns3:ContentInfoVer><ns3:ContentPriority xmlns="http://novell.com/zenworks/datamodel/objects/assignablecontent" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/assignablecontent">0</ns3:ContentPriority><ns3:NextRevision xmlns="http://novell.com/zenworks/datamodel/objects/assignablecontent" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/assignablecontent">0</ns3:NextRevision><ns3:SysReqs xmlns="http://novell.com/zenworks/datamodel/objects/assignablecontent" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/assignablecontent"><ns1:SysReqs Conjunction="OR" xmlns:ns1="http://www.novell.com/ZENworks/Reqs/v1.0"><Req Type="GroupReq" xmlns="http://www.novell.com/ZENworks/Reqs/v1.0"><Data><ns1:GroupReq Conjunction="AND"><Req Type="BundleInstalledReq"><Data><ns1:BundleInstalledReq><Value>true</Value><Name>1af11e5a2a2b96fa403637dcc2b2f69f</Name><DisplayName>/Bundles/Applications/SetupStore/ADOBE/Adobe-Acrobat_Pro_DC-18.011.20040-x64</DisplayName></ns1:BundleInstalledReq></Data></Req></ns1:GroupReq></Data></Req></ns1:SysReqs></ns3:SysReqs><ns3:Replication xmlns="http://novell.com/zenworks/datamodel/objects/assignablecontent" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/assignablecontent">2</ns3:Replication><ns3:Sandbox xmlns="http://novell.com/zenworks/datamodel/objects/assignablecontent" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/assignablecontent">false</ns3:Sandbox><ns3:SatelliteRep xmlns="http://novell.com/zenworks/datamodel/objects/assignablecontent" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/assignablecontent">1</ns3:SatelliteRep><ns3:Inheritance xmlns="http://novell.com/zenworks/datamodel/objects/assignablecontent" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/assignablecontent">15</ns3:Inheritance><ns3:ContentTypeTags xmlns="http://novell.com/zenworks/datamodel/objects/assignablecontent" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/assignablecontent">Windows-Bundle</ns3:ContentTypeTags><ns3:ActionSets xmlns="http://novell.com/zenworks/datamodel/objects/actions" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/actions"><Id>941dc9d74b4244c955502a00abbdad9c</Id><Type>Distribution</Type><Version>1</Version><Modified>false</Modified><Actions><Id>5afec5b3c4c9c026c34f1e7080d02220</Id><Type>Distribute Action</Type><ContinueOnFailure>false</ContinueOnFailure><Enabled>true</Enabled><actionUniqueId>f873d55e0de647c1ccf4b9899485d0b4</actionUniqueId></Actions></ns3:ActionSets><ns3:ActionSets xmlns="http://novell.com/zenworks/datamodel/objects/actions" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/actions"><Id>00c88df0335ae1babed1bece5f51b4bb</Id><Type>Install</Type><Version>2</Version><Modified>false</Modified><Data><ns1:Install xmlns="http://novell.com/zenworks/apps/appSchema" xmlns:ns1="http://novell.com/zenworks/apps/appSchema"><InstallOption>InstallPerMachine</InstallOption><AllowedPostpones>3</AllowedPostpones></ns1:Install></Data><Actions><Id>4cee4b41bf61c3101794a9eaaf192772</Id><Name>Skript ausführen</Name><Type>Run Script Action</Type><Data><ns1:RunScriptActionHandlerData xmlns:ns1="http://www.novell.com/ZENworks/Actions"><Exec maxTimeToWait="-1" terminateProgram="false" xmlns="http://www.novell.com/ZENworks/Actions"><ns2:Script extension=".bat" xmlns:ns2="http://www.novell.com/ZENworks/Controls">echo bla</ns2:Script><ns2:ProgramExecutor arguments="" path="" xmlns:ns2="http://www.novell.com/ZENworks/Controls"/><ns2:AdvancedSettings xmlns:ns2="http://www.novell.com/ZENworks/Controls"><Priority xmlns="http://www.novell.com/ZENworks/Controls">Normal</Priority><RunAs xmlns="http://www.novell.com/ZENworks/Controls">System</RunAs></ns2:AdvancedSettings></Exec></ns1:RunScriptActionHandlerData></Data><ContinueOnFailure>false</ContinueOnFailure><Enabled>true</Enabled><Properties>Impersonation=SYSTEM;</Properties><SysReqs><ns1:SysReqs Conjunction="OR" xmlns:ns1="http://www.novell.com/ZENworks/Reqs/v1.0"><Req Type="GroupReq" xmlns="http://www.novell.com/ZENworks/Reqs/v1.0"><Data><ns1:GroupReq Conjunction="AND"><Req Type="ArchitectureReq"><Data><ns1:ArchitectureReq ValueType="INT_TYPE"><Operator>Equals</Operator><Value>64</Value><Magnitude>NONE</Magnitude></ns1:ArchitectureReq></Data></Req></ns1:GroupReq></Data></Req></ns1:SysReqs></SysReqs><reqsFailAction>0</reqsFailAction><actionUniqueId>3901084d165cec94bb531304adc150cb</actionUniqueId></Actions><Actions><Id>c8f77703d9a9c053155cbfb48ee95dbe</Id><Name>Copy File(s)</Name><Type>Copy Files Action</Type><Data><ns1:CopyFilesData xmlns:ns1="http://www.novell.com/ZENworks/Actions/v1.0"><File xmlns="http://www.novell.com/ZENworks/Actions/v1.0"><FileName>file1.txt</FileName><DestDir>c:\Program Files\</DestDir><CreateFilesAsLinks>false</CreateFilesAsLinks><FileAttributes><FileAttribute Name="Hidden" default="false">false</FileAttribute><FileAttribute Name="ReadOnly" default="false">false</FileAttribute></FileAttributes><DestFileName>file1.txt</DestFileName><SourceDir>c:\</SourceDir><CopyOption>CopyAlways</CopyOption></File><ImpersonateCopy xmlns="http://www.novell.com/ZENworks/Actions/v1.0">DYNAMIC_ADMIN_USER</ImpersonateCopy><ImpersonateData xmlns="http://www.novell.com/ZENworks/Actions/v1.0"><ns2:CredentialVault xmlns:ns2="http://www.novell.com/ZENworks/Actions/Impersonate"><Credential xmlns="http://www.novell.com/ZENworks/Actions/Impersonate">346966c8458107d86d545c8477346f94</Credential></ns2:CredentialVault></ImpersonateData></ns1:CopyFilesData></Data><ContinueOnFailure>false</ContinueOnFailure><Enabled>true</Enabled><reqsFailAction>0</reqsFailAction><actionUniqueId>fbd862b88b282b3f4baf3e3fc10eb951</actionUniqueId></Actions><Actions><Id>e43145ca9e1c6701b1852dcf0d5afa03</Id><Name>testRun Script</Name><Type>Run Script Action</Type><Data><ns1:RunScriptActionHandlerData xmlns="http://www.novell.com/ZENworks/Actions" xmlns:ns1="http://www.novell.com/ZENworks/Actions"><Exec maxTimeToWait="0" terminateProgram="false"><ns2:Script extension=".bat" xmlns="http://www.novell.com/ZENworks/Controls" xmlns:ns2="http://www.novell.com/ZENworks/Controls">echo test</ns2:Script><ns2:ProgramExecutor arguments="" path="" xmlns="http://www.novell.com/ZENworks/Controls" xmlns:ns2="http://www.novell.com/ZENworks/Controls"/><ns2:AdvancedSettings xmlns="http://www.novell.com/ZENworks/Controls" xmlns:ns2="http://www.novell.com/ZENworks/Controls"><Priority>Normal</Priority><RunAs>User</RunAs></ns2:AdvancedSettings></Exec></ns1:RunScriptActionHandlerData></Data><ContinueOnFailure>false</ContinueOnFailure><Enabled>true</Enabled><Properties>Impersonation=USER;</Properties><reqsFailAction>0</reqsFailAction><actionUniqueId>c72662a3fcb693be7a7568f8e8513d1b</actionUniqueId></Actions></ns3:ActionSets><ns3:ActionSets xmlns="http://novell.com/zenworks/datamodel/objects/actions" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/actions"><Id>af3a2748e3bced075da9ae36535f6007</Id><Type>Launch</Type><Version>1</Version><Modified>false</Modified><Data><ns1:Launch xmlns="http://novell.com/zenworks/apps/appSchema" xmlns:ns1="http://novell.com/zenworks/apps/appSchema"/></Data></ns3:ActionSets><ns3:ActionSets xmlns="http://novell.com/zenworks/datamodel/objects/actions" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/actions"><Id>b468194e595222db79849096ac4be821</Id><Type>Verify</Type><Version>1</Version><Modified>false</Modified><Actions><Id>227fd91c3108a1f5dd24f04d606ae873</Id><Type>Verify Install</Type><ContinueOnFailure>false</ContinueOnFailure><Enabled>true</Enabled><actionUniqueId>d2883f62cf89a7e56d1c39c46ed087f4</actionUniqueId></Actions></ns3:ActionSets><ns3:ActionSets xmlns="http://novell.com/zenworks/datamodel/objects/actions" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/actions"><Id>578c606494f409e1c9c14ba27017359e</Id><Type>Uninstall</Type><Version>1</Version><Modified>false</Modified><Data><ns1:Uninstall xmlns="http://novell.com/zenworks/apps/appSchema" xmlns:ns1="http://novell.com/zenworks/apps/appSchema"><Enabled>true</Enabled><AllowManual>true</AllowManual><DaysBeforeUninstallWhenNotUsed>-1</DaysBeforeUninstallWhenNotUsed><IgnoreChainedDependencies>false</IgnoreChainedDependencies><Any><IgnoreUninstallAfterUnassociation>false</IgnoreUninstallAfterUnassociation><DisplayUninstallMessage>false</DisplayUninstallMessage><AllowToCancelUninstall>false</AllowToCancelUninstall><ExtendAny><UninstallOnBlocked>false</UninstallOnBlocked></ExtendAny></Any></ns1:Uninstall></Data><Actions><Id>da920edf98e8c3092cdaea5ef38277f1</Id><Name>Run Script</Name><Type>Run Script Action</Type><Data><ns1:RunScriptActionHandlerData xmlns:ns1="http://www.novell.com/ZENworks/Actions"><Exec maxTimeToWait="-1" terminateProgram="false" xmlns="http://www.novell.com/ZENworks/Actions"><ns2:Script extension=".bat" xmlns:ns2="http://www.novell.com/ZENworks/Controls">echo uninstall</ns2:Script><ns2:ProgramExecutor arguments="" path="" xmlns:ns2="http://www.novell.com/ZENworks/Controls"/><ns2:AdvancedSettings xmlns:ns2="http://www.novell.com/ZENworks/Controls"><Priority xmlns="http://www.novell.com/ZENworks/Controls">Normal</Priority><RunAs xmlns="http://www.novell.com/ZENworks/Controls">System</RunAs></ns2:AdvancedSettings></Exec></ns1:RunScriptActionHandlerData></Data><ContinueOnFailure>false</ContinueOnFailure><Enabled>true</Enabled><Properties>Impersonation=SYSTEM;</Properties><reqsFailAction>0</reqsFailAction><actionUniqueId>031c425f7fa970697dc1b4444a6bb9c3</actionUniqueId></Actions></ns3:ActionSets><ns3:ActionSets xmlns="http://novell.com/zenworks/datamodel/objects/actions" xmlns:ns3="http://novell.com/zenworks/datamodel/objects/actions"><Id>480e7a4d028e739fe8771f9e3bc9a547</Id><Type>Terminate</Type><Version>1</Version><Modified>false</Modified><Data><ns1:Terminate xmlns="http://novell.com/zenworks/apps/appSchema" xmlns:ns1="http://novell.com/zenworks/apps/appSchema"><Enabled>true</Enabled></ns1:Terminate></Data><Actions><Id>4e05304c178127186c65398a67e0d114</Id><Type>Terminate Action Prompt</Type><ContinueOnFailure>false</ContinueOnFailure><Enabled>true</Enabled><actionUniqueId>dceab3f032e4bfa06c5b6203a4d2c12f</actionUniqueId></Actions><Actions><Id>43bcbd5fe1e3e911eb6db2dce16e808f</Id><Type>Terminate Action</Type><ContinueOnFailure>false</ContinueOnFailure><Enabled>true</Enabled><actionUniqueId>bd949abd4a6b53945bf63c42b7c07a7e</actionUniqueId></Actions></ns3:ActionSets><ns2:DisplayName>Adobe-Test-1234-x86</ns2:DisplayName><ns2:CreationDate>2018-12-07T13:47:04</ns2:CreationDate><ns2:Data><ns1:ApplicationBundleData xmlns="http://novell.com/zenworks/datamodel/objects/bundles" xmlns:ns1="http://novell.com/zenworks/datamodel/objects/bundles"><AlwaysShowIcon>false</AlwaysShowIcon><ShowProgress>false</ShowProgress><ForceRunOrder>-1</ForceRunOrder><WaitOnForceRun>false</WaitOnForceRun></ns1:ApplicationBundleData></ns2:Data><ns2:LicenseTrackingEnabled>false</ns2:LicenseTrackingEnabled></return></ns1:getByUIDResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>