Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespaces screw up generated WSDL operation parameters #134

Open
DrChat opened this issue Aug 4, 2021 · 0 comments
Open

Namespaces screw up generated WSDL operation parameters #134

DrChat opened this issue Aug 4, 2021 · 0 comments

Comments

@DrChat
Copy link
Contributor

DrChat commented Aug 4, 2021

Apologies for the name of this issue - I'm still unfamiliar with this library and don't know why this happens, but:

This input:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../../../ver20/util/onvif-wsdl-viewer.xsl"?>

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
	xmlns:s2="http://www.microsoft.com/SoftwareDistribution/Server/IMonitorable"
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/"
	xmlns:s="http://www.w3.org/2001/XMLSchema"
	xmlns:tds="http://www.onvif.org/ver10/device/wsdl" targetNamespace="http://www.onvif.org/ver10/device/wsdl">
	<wsdl:types>
		<s:schema elementFormDefault="qualified" targetNamespace="http://www.microsoft.com/SoftwareDistribution/Server/IMonitorable">
			<s:element name="Ping">
				<s:complexType>
					<s:sequence>
						<s:element minOccurs="1" maxOccurs="1" name="pingLevel" type="s:int" />
					</s:sequence>
				</s:complexType>
			</s:element>
			<s:element name="PingResponse">
				<s:complexType>
					<s:sequence>
						<s:element minOccurs="0" maxOccurs="1" name="PingResult" type="s2:MonitoredServicesResponse" />
					</s:sequence>
				</s:complexType>
			</s:element>
			<s:complexType name="MonitoredServicesResponse">
				<s:sequence>
					<s:element minOccurs="1" maxOccurs="1" name="SuccessFlag" type="s:boolean" />
					<s:element minOccurs="1" maxOccurs="1" name="ServicesTime" type="s:dateTime" />
					<s:element minOccurs="0" maxOccurs="1" name="ServicesName" type="s:string" />
					<s:element minOccurs="0" maxOccurs="1" name="ServicesMachine" type="s:string" />
					<s:element minOccurs="1" maxOccurs="1" name="IsHttps" type="s:boolean" />
					<s:element minOccurs="0" maxOccurs="1" name="RequestContentType" type="s:string" />
					<s:element minOccurs="0" maxOccurs="1" name="ConfigFilePath" type="s:string" />
					<s:element minOccurs="0" maxOccurs="1" name="ConfigFileProjectName" type="s:string" />
					<s:element minOccurs="0" maxOccurs="1" name="ConfigFileEnvironmentName" type="s:string" />
					<s:element minOccurs="1" maxOccurs="1" name="ConfigFileLastModifiedTime" type="s:dateTime" />
					<s:element minOccurs="0" maxOccurs="1" name="ConfigFileVersion" type="s:string" />
					<s:element minOccurs="1" maxOccurs="1" name="ConfigFileNextExpirationTime" type="s:dateTime" />
					<s:element minOccurs="1" maxOccurs="1" name="ConfigFileExpirationModuloInMinutes" type="s:int" />
					<s:element minOccurs="0" maxOccurs="1" name="DatabaseInfo" type="s:string" />
					<s:element minOccurs="0" maxOccurs="1" name="CustomInfo" type="s:string" />
				</s:sequence>
			</s:complexType>
		</s:schema>
	</wsdl:types>

	<wsdl:message name="PingSoapIn">
		<wsdl:part name="parameters" element="s2:Ping" />
	</wsdl:message>
	<wsdl:message name="PingSoapOut">
		<wsdl:part name="parameters" element="s2:PingResponse" />
	</wsdl:message>

	<wsdl:portType name="Device">
		<wsdl:operation name="Ping">
			<wsdl:input message="tns:PingSoapIn" />
			<wsdl:output message="tns:PingSoapOut" />
		</wsdl:operation>
	</wsdl:portType>
</wsdl:definitions>

Produces this output:

// Structure definitions omitted for brevity.
pub struct Ping();
pub struct PingResponse();
pub struct MonitoredServicesResponse();

pub async fn ping<T: transport::Transport>(
    transport: &T,
    request: &s2::Ping
) -> Result<s2::PingResponse, transport::Error> {
    transport::request(transport, request).await
}

The parameters to the ping function are generated as-if they belong to an s2 Rust module, but no such module exists.
This prevents me from building the generated output without editing it.

The Ping and PingResponse types are qualified as belonging to a namespace aliased as s2 in the input XML.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant