<* reference *>
KodegenUpnp?.dll
<* reference *>
<* import *>
using Kodegen.Upnp;
<* import *>
<* function *>
<* function *>
<* body *> <%
if (args.Length < 1) {
throw (new TemplateException?("Service Description File not specified"));
}
if (args.Length < 2) {
throw (new TemplateException?("Service Domain not specified"));
}
if (args.Length < 3) {
throw (new TemplateException?("Service Type not specified"));
}
if (args.Length < 4) {
throw (new TemplateException?("Service Version not specified"));
}
string domain = args[1]; string type = args[2]; uint version;
try {
version = Convert.ToUInt32(args[3]);
} catch (FormatException?) {
throw (new TemplateException?("Invalid version number specified"));
} catch (OverflowException?) {
throw (new TemplateException?("Invalid version number specified"));
}
string upnpdomain = domain; upnpdomain.Replace(".", "-");
if (upnpdomain.StartsWith?("upnp-")) {
upnpdomain = "schemas-" + upnpdomain;
}
string name = domain + ":" + type + ":" + version.ToString?(); string upnpname = upnpdomain + ":" + type + ":" + version.ToString?();
%> <?xml version="1.0"?> <definitions name="<%=upnpname%>"
targetNamespace="<%=name%>"
xmlns:svc="<%=name%>" xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns=" http://schemas.xmlsoap.org/wsdl/">
<% foreach (Action a in u.actions) %> <% { %>
<message name="<%=a.name%>Input">
<% foreach (Argument i in a.inargs) %> <% { %>
<part name="<%=i.name%>" element="xsd:<%=i.statevariable.type%>"/>
<% } %>
</message>
<message name="<%=a.name%>Output">
<% foreach (Argument o in a.outargs) %> <% { %>
<part name="<%=o.name%>" element="xsd:<%=o.statevariable.type%>"/>
<% } %>
</message>
<portType name="<%=a.name%>PortType?">
<operation name="<%=a.name%>">
<input message="svc:<%=a.name%>Input"/> <output message="svc:<%=a.name%>Output"/>
</operation>
</portType>
<binding name="<%=a.name%>Binding" type="svc:<%=a.name%>PortType?">
<soap:binding style="rpc" transport=" http://schemas.xmlsoap.org/soap/http"/> <operation name="<%=a.name%>">
<soap:operation soapAction="urn:<%=upnpdomain%>:service:<%=type%>:<%=version.ToString?()%>#<%=a.name%>"/> <input>
<soap:body use="encoded"
encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/" namespace = "urn:<%=upnpdomain%>:service:<%=type%>:<%=version.ToString?()%>"/>
</input> <output>
<soap:body use="encoded"
encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/" namespace = "urn:<%=upnpdomain%>:service:<%=type%>:<%=version.ToString?()%>"/>
</output>
</operation>
</binding>
<% } %>
<service name="<%=name%>">
<documentation><%=name%></documentation>
<% foreach (Action a in u.actions) %> <% { %>
<port name="<%=a.name%>Port" binding="svc:<%=a.name%>Binding">
<soap:address location="uri"/>
</port>
<% } %>
</service>
</definitions>
<* body *>
