Need help in updating (windows unattend.xml) xml file with powershell - powershell

Here's my XML file: I would prefer to read the xml and then modify the computername to say newcompname and write it back to file
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<servicing>
</servicing>
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ComputerName>testserver007</ComputerName>
<RegisteredOrganization>MyOrganization</RegisteredOrganization>
<RegisteredOwner>Admin</RegisteredOwner>
<ShowWindowsLive>false</ShowWindowsLive>
</component>
<component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<fDenyTSConnections>false</fDenyTSConnections>
</component>
<component name="Microsoft-Windows-TerminalServices-RDP-WinStationExtensions" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserAuthentication>1</UserAuthentication>
</component>
<component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Interfaces>
<Interface wcm:action="add">
<Ipv4Settings>
<DhcpEnabled>false</DhcpEnabled>
<RouterDiscoveryEnabled>false</RouterDiscoveryEnabled>
<Metric>10</Metric>
</Ipv4Settings>
<Identifier>Local Area Connection</Identifier>
<Routes>
<Route wcm:action="add">
<Identifier>1</Identifier>
<Metric>10</Metric>
<NextHopAddress>192.168.2.247</NextHopAddress>
<Prefix>0.0.0.0/0</Prefix>
</Route>
</Routes>
<UnicastIpAddresses>
<IpAddress wcm:action="add" wcm:keyValue="1">192.168.2.101/24</IpAddress>
</UnicastIpAddresses>
</Interface>
</Interfaces>
</component>
<component name="Microsoft-Windows-DNS-Client" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Interfaces>
<Interface wcm:action="add">
<DNSServerSearchOrder>
<IpAddress wcm:action="add" wcm:keyValue="1">192.168.2.75</IpAddress>
<IpAddress wcm:action="add" wcm:keyValue="2">192.168.2.76</IpAddress>
</DNSServerSearchOrder>
<Identifier>Local Area Connection</Identifier>
<EnableAdapterDomainNameRegistration>true</EnableAdapterDomainNameRegistration>
<DisableDynamicUpdate>false</DisableDynamicUpdate>
</Interface>
</Interfaces>
</component>
<component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon>
</component>
<component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<InputLocale>0809:00000809</InputLocale>
<SystemLocale>en-GB</SystemLocale>
<UILanguage>en-US</UILanguage>
<UserLocale>en-GB</UserLocale>
</component>
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<AutoLogon>
<Password>
<Value>RgBvAG4ANgBIADAAbQBlAFAAYQBzAHMAdwBvAHIAZAA=</Value>
<PlainText>false</PlainText>
</Password>
<Domain>testserver007</Domain>
<Enabled>true</Enabled>
<LogonCount>5</LogonCount>
<Username>Administrator</Username>
</AutoLogon>
<FirstLogonCommands>
<SynchronousCommand>
<Order>1</Order>
<!-- Post Build Script 1 -->
<CommandLine>cmd.exe /C C:\BuildScripts\firsttest.cmd</CommandLine>
</SynchronousCommand>
</FirstLogonCommands>
<Display>
<ColorDepth>32</ColorDepth>
<HorizontalResolution>1024</HorizontalResolution>
<VerticalResolution>768</VerticalResolution>
</Display>
<OOBE>
<HideEULAPage>true</HideEULAPage>
<ProtectYourPC>3</ProtectYourPC>
<NetworkLocation>Other</NetworkLocation>
</OOBE>
<UserAccounts>
<AdministratorPassword>
<Value>RgBvAG4ANgBIADAAbQBlAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value>
<PlainText>false</PlainText>
</AdministratorPassword>
</UserAccounts>
<RegisteredOrganization>MyOrganization</RegisteredOrganization>
<RegisteredOwner>Admin</RegisteredOwner>
<TimeZone>GMT Standard Time</TimeZone>
<LogonCommands>
<AsynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /C C:\Scripts\test.cmd</CommandLine>
<Description>test command</Description>
<Order>2</Order>
<RequiresUserInput>true</RequiresUserInput>
</AsynchronousCommand>
</LogonCommands>
</component>
</settings>
<cpi:offlineImage cpi:source="catalog:d:/win2008r2instfiles/sources/install_windows server 2008 r2 serverstandard.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>

you can use a variety of techniques whether iterating through the nodes like the following example, calling select-xml with an XPATH query to find the node and then change the value, or $xml.selectNodes(...). Normally i'd go the xpath route, but with the namespace included and it being simple XML this was the easiest way to demonstrate it in PowerShell
$xml = [xml]#"
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">#
<servicing></servicing>
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ComputerName>testserver007</ComputerName>
<RegisteredOrganization>MyOrg</RegisteredOrganization>
<RegisteredOwner>Admin</RegisteredOwner>
<ShowWindowsLive>false</ShowWindowsLive>
</component>
</settings>
</unattend>
"#
#presuming multiple settings tags, with multiplecomponents
$xml.unattend | foreach { $_.settings } | foreach { $_.component.computername = "newname" }
$xml.save("c:\temp\test.xml")

Related

Start OrientDB studio for plocal DB

I'm able to start my orientDb (2.2.6) instance using a plocal connection and able to add vertices to the DB but I can't access the studio. When I go to http://localhost:2480, the page is blank. Isn't studio ready and available 'out of the box'?
orientdb-server-config.xml is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<orient-server>
<network>
<protocols>
<protocol implementation="com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary" name="binary"/>
<protocol name="http" implementation="com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpDb"/>
</protocols>
<listeners>
<listener protocol="binary" socket="default" port-range="2424-2430" ip-address="0.0.0.0"/>
<listener protocol="http" port-range="2480-2485" ip-address="0.0.0.0">
<commands>
<command implementation="com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent" pattern="GET|www GET|studio/ GET| GET|*.htm GET|*.html GET|*.xml GET|*.jpeg GET|*.jpg GET|*.png GET|*.gif GET|*.js GET|*.css GET|*.swf GET|*.ico GET|*.txt GET|*.otf GET|*.pjs GET|*.svg">
<parameters>
<entry value="Cache-Control: no-cache, no-store, max-age=0, must-revalidate\r\nPragma: no-cache" name="http.cache:*.htm *.html"/>
<entry value="Cache-Control: max-age=120" name="http.cache:default"/>
</parameters>
</command>
</commands>
</listener>
</listeners>
</network>
<users>
<user resources="*" password="root" name="root"/>
<user resources="connect,server.listDatabases,server.dblist" password="guest" name="guest"/>
</users>
<properties>
<entry value="1" name="db.pool.min"/>
<entry value="50" name="db.pool.max"/>
<entry value="true" name="profiler.enabled"/>
</properties>
</orient-server>
I get these warnings whenever I try to access localhost:2480 from Chrome:
2016-09-28 16:56:01:756 WARNI path variable points to 'src/site' but it doesn't exists [OServerCommandGetStaticContent]
2016-09-28 16:56:01:756 WARNI path variable points to 'src/site' but it isn't a directory [OServerCommandGetStaticContent]
What am I missing?

Access Denied when deploying ASP.net 5

I'm trying to deploy an ASP.net 5 website to my local service fabric dev cluster but get an Access Denied exception on every deploy. I know that the problem is with the web service because when I remove it from the deployment my other service is deployed without any error
This exception looks like it is trying to delete a file, but which one and why wouldn't it have access?
6>. 'E:\Github\Flow.Server\Flow.Server.Fabric\Scripts\Deploy-FabricApplication.ps1' -ApplicationPackagePath 'E:\Github\Flow.Server\Flow.Server.Fabric\pkg\Debug' -PublishProfileFile 'E:\Github\Flow.Server\Flow.Server.Fabric\PublishProfiles\Local.xml' -DeployOnly:$true -UnregisterUnusedApplicationVersionsAfterUpgrade $false -OverrideUpgradeBehavior 'None' -OverwriteBehavior 'Always' -ErrorAction Stop
6>Message : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
6>Data : {}
6>InnerException :
6>TargetSite : Void RunInMTA(System.Action)
6>StackTrace : at System.Fabric.Interop.Utility.RunInMTA(Action action)
6> at System.Fabric.Common.FabricDirectory.Delete(String path, Boolean recursive, Boolean
6> deleteReadOnlyFiles)
6> at Microsoft.ServiceFabric.Powershell.ApplicationCmdletBase.TestApplicationPackage(String
6> applicationPackagePath, Hashtable applicationParameters, String imageStoreConnectionString)
6> at System.Management.Automation.CommandProcessor.ProcessRecord()
6>HelpLink :
6>Source : System.Fabric
6>HResult : -2147024891
Here is my ApplicationManifest
<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="Flow.Server.FabricType" ApplicationTypeVersion="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<Parameters>
<Parameter Name="Silo_InstanceCount" DefaultValue="-1" />
</Parameters>
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="Flow.Server.Fabric.WebApi" ServiceManifestVersion="1.0.0" />
</ServiceManifestImport>
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="Flow.Server.Fabric.SiloPkg" ServiceManifestVersion="1.0.0" />
<ConfigOverrides />
</ServiceManifestImport>
<DefaultServices>
<Service Name="Flow.Server.Fabric.WebApiService">
<StatelessService ServiceTypeName="Flow.Server.Fabric.WebApiType">
<SingletonPartition />
</StatelessService>
</Service>
<Service Name="Flow.Server.Fabric.Silo">
<StatelessService ServiceTypeName="Flow.Server.Fabric.SiloType" InstanceCount="[Silo_InstanceCount]">
<SingletonPartition />
</StatelessService>
</Service>
</DefaultServices>
</ApplicationManifest>
And here is the ServiceManifest
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="Flow.Server.Fabric.WebApi" Version="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<ServiceTypes>
<StatelessServiceType ServiceTypeName="Flow.Server.Fabric.WebApiType">
<Extensions>
<Extension Name="__GeneratedServiceType__">
<GeneratedNames xmlns="http://schemas.microsoft.com/2015/03/fabact-no-schema">
<DefaultService Name="Flow.Server.Fabric.WebApiService" />
<ServiceEndpoint Name="Flow.Server.Fabric.WebApiTypeEndpoint" />
</GeneratedNames>
</Extension>
</Extensions>
</StatelessServiceType>
</ServiceTypes>
<CodePackage Name="C" Version="1.0.0">
<EntryPoint>
<ExeHost>
<Program>approot\runtimes\dnx-clr-win-x64.1.0.0-rc1-update1\bin\dnx.exe</Program>
<Arguments>--appbase approot\src\Flow.Server.Fabric.WebApi Microsoft.Dnx.ApplicationHost Microsoft.ServiceFabric.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener</Arguments>
<WorkingFolder>CodePackage</WorkingFolder>
<ConsoleRedirection FileRetentionCount="5" FileMaxSizeInKb="2048" />
</ExeHost>
</EntryPoint>
</CodePackage>
<Resources>
<Endpoints>
<Endpoint Name="Flow.Server.Fabric.WebApiTypeEndpoint" Protocol="http" Type="Input" />
</Endpoints>
</Resources>
</ServiceManifest>

How to get a variable from WSDL with mule setvariable and datamapper? Message payload is of type: HashMap

It should be simple but I can't set it working. My XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ws="http://www.mulesoft.org/schema/mule/ws" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.6.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ws http://www.mulesoft.org/schema/mule/ws/current/mule-ws.xsd
http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<ws:consumer-config name="Web_Service_Consumer" wsdlLocation="http://procese/sysworkflow/en/classic/services/wsdl2" service="ProcessMakerService" port="ProcessMakerServiceSoap" serviceAddress="http://procese:80/sysworkflow/en/classic/services/soap2" doc:name="Web Service Consumer"/>
<data-mapper:config name="JSON_To_XML" transformationGraphPath="json_to_xml.grf" doc:name="JSON_To_XML"/>
<flow name="ws_pm_login3Flow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<set-payload value="#[{"userid":"xyz.qwe", "password":"12345"}]" doc:name="Set Payload"/>
<data-mapper:transform config-ref="JSON_To_XML" doc:name="JSON To XML"/>
<ws:consumer config-ref="Web_Service_Consumer" operation="login" doc:name="Web Service Consumer"/>
</flow>
</mule>
The WS is working fine.
The mapper file json_to_xml.grf looks like:
<?xml version="1.0" encoding="UTF-8"?><Graph __version="3.5.0" author="abc" created="Tue Apr 21 13:27:56 EEST 2015" description="JSON To XML" guiVersion="3.4.4.P" id="1429614596881" licenseCode="Unlicensed" licenseType="Unknown" modified="Tue Apr 21 13:27:56 EEST 2015" modifiedBy="abc" name="JSON_To_XML" revision="1.0" showComponentDetails="false">
<Global>
<Metadata __index="0" __referenceCounter="1" __sourcePath="{}/login" _dataStructure="OBJECT" _id="__id" _type="Input" id="e941872a-c0e5-4148-ac8c-6010c4dad903">
<Record fieldDelimiter="," name="login" recordDelimiter="\n\\|\r\n\\|\r" type="delimited">
<Field __artificialType="_id" __systemManaged="true" name="__id" type="string"/>
<Field __index="1" __sourcePath="{}/login/password" containerType="SINGLE" label="password" name="password" type="string"/>
<Field __index="0" __sourcePath="{}/login/userid" containerType="SINGLE" label="userid" name="userid" type="string"/>
</Record>
</Metadata>
<Metadata __index="0" __referenceCounter="1" __sourcePath="{}/login" _dataStructure="OBJECT" _id="__id" _type="Output" id="d9e5b0f6-b757-46cb-89bf-a7662be5c77f">
<Record fieldDelimiter="," name="login" recordDelimiter="\n\\|\r\n\\|\r" type="delimited">
<Field __artificialType="_id" __systemManaged="true" name="__id" type="string"/>
<Field __index="0" __sourcePath="{}/login/password" containerType="SINGLE" label="password" name="password" type="string"/>
<Field __index="1" __sourcePath="{}/login/userid" containerType="SINGLE" label="userid" name="userid" type="string"/>
</Record>
</Metadata>
<Dictionary>
<Entry id="DictionaryEntry0" input="true" name="inputPayload" output="false" type="object"/>
<Entry id="DictionaryEntry1" input="false" name="outputPayload" output="true" type="object"/>
</Dictionary>
</Global>
<Phase number="0">
<Node cacheInMemory="true" charset="UTF-8" enabled="enabled" fileURL="dict:outputPayload" guiName="XML WRITER" guiX="900" guiY="20" id="EXT_XML_WRITER0" type="EXT_XML_WRITER">
<attr name="mapping"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<login xmlns:clover="http://www.cloveretl.com/ns/xmlmapping" clover:inPort="0">
<password>$0.password</password>
<userid>$0.userid</userid>
</login>]]></attr>
<attr name="_data_format"><![CDATA[XML]]></attr>
</Node>
<Node enabled="enabled" guiName="Foreach 'login' -> 'login'" guiX="460" guiY="20" id="FOREACH_LOGIN_LOGIN" transformClass="com.mulesoft.datamapper.transform.MelRecordTransform" type="REFORMAT">
<attr name="melScript"><![CDATA[//MEL
//START -> DO NOT REMOVE
output.__id = input.__id;
//END -> DO NOT REMOVE
output.password = input.password;
output.userid = input.userid;
]]></attr>
</Node>
<Node charset="UTF-8" enabled="enabled" fileURL="dict:inputPayload" guiName="JSON READER" guiX="20" guiY="20" id="JSON_READER0" type="JSON_READER">
<attr name="mapping"><![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Context xpath="/root">
<Context outPort="0" sequenceField="__id" xpath="object">
<Mapping cloverField="password" trim="true" xpath="password"/>
<Mapping cloverField="userid" trim="true" xpath="userid"/>
</Context>
</Context>
]]></attr>
<attr name="_data_format"><![CDATA[JSON]]></attr>
</Node>
<Edge debugMode="true" fromNode="FOREACH_LOGIN_LOGIN:0" guiBendpoints="" id="Edge1" inPort="Port 0 (in)" metadata="d9e5b0f6-b757-46cb-89bf-a7662be5c77f" outPort="Port 0 (out)" toNode="EXT_XML_WRITER0:0"/>
<Edge debugMode="true" fromNode="JSON_READER0:0" guiBendpoints="" id="Edge0" inPort="Port 0 (in)" metadata="e941872a-c0e5-4148-ac8c-6010c4dad903" outPort="Port 0 (out)" toNode="FOREACH_LOGIN_LOGIN:0"/>
</Phase>
</Graph>
When I start the process I get:
Error executing graph: ERROR (com.mulesoft.mule.module.datamapper.api.exception.DataMapperExecutionException). Message payload is of type: HashMap
I am using 3.6.1 EE
What am I missing?
Turns out it is a problem in mule to use the double quotes in JSON. I swithced to XML and now it is working fine.

add xml attribute "xsi:nil"

I am reading the following file in powershell.
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<nested1>
<level1 xsi:nil="true" />
<level2>2</level2>
</nested1>
<nested2>
<level1 xsi:nil="true" />
<level2>2</level2>
</nested2>
</root>
using...
[xml]$XmlDoc = get-content $XMLFile
I would like to set
$XmlDoc.root.nested1.level2
so it has the attribute xsi:nil="true"
so the file appears as
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<nested1>
<level1 xsi:nil="true" />
<level2 xsi:nil="true" />
</nested1>
<nested2>
<level1 xsi:nil="true" />
<level2>2</level2>
</nested2>
</root>
Many Thanks for any advice offered.
Use SetAttribute() and provide the namespace URI.
$node = $XmlDoc.SelectSingleNode('//nested1/level2')
$node.SetAttribute('nil', 'http://www.w3.org/2001/XMLSchema-instance', 'true') |
Out-Null

Link XSD-File in WADL

I would like to create a WADL-File from which Java Interfaces can be created using Apache CXF wadl2java Maven plugin.
In the WADL I would like to use the Datatypes defined in a XSD-File.
These are my REST Services:
#Path("/v1/order")
public interface OrderResource {
#PUT
#Consumes(MediaType.APPLICATION_XML)
public Response createOrder(Order order);
#GET
#Produces(MediaType.APPLICATION_XML)
public List<Order> getOrders(#QueryParam("orderId") List<Long> orderIds);
}
My WADL:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<application xmlns="http://wadl.dev.java.net/2009/02" >
<grammars>
<include href="RestService_schema1.xsd" />
</grammars>
<resources base="http://localhost:9080/rest/">
<resource path="v1/order/" id="OrderResource">
<resource>
<method name="PUT" id="createOrder">
<request>
<representation mediaType="application/xml" />
</request>
<response status="200">
</response>
</method>
</resource>
</resource>
<resource>
<method name="GET" id="getOrders">
<request>
<param name="orderId" style="query" type="xs:long" />
</request>
<response status="200">
<representation mediaType="application/xml" />
</response>
</method>
</resource>
</resources>
</application>
My RestService_schema1.xsd:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Order" type="Order" />
<xs:complexType name="Order">
<xs:attribute name="OrderId" type="orderid">
<xs:annotation>
<xs:documentation>...
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:sequence>
.
.
.
.
</xs:sequence>
</xs:complexType>
<xs:simpleType name="orderid">
<xs:annotation>
<xs:documentation> ....
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:long" />
</xs:simpleType>
</xs:schema>
What I want to do:
I would like to specify in my WADL the input type Order for the createOrder Service. I know this can be done with the element-attribute, but how can I link it? Maybe element="Order" within the <representation>-Tag??
The Query Param of the getOrders()-Service should be List<Long> (in the WADL a List with orderid's) and the Response Type List<Order>. How can I specify this in the WADL?