-
Notifications
You must be signed in to change notification settings - Fork 58
Description
I have a WSDL that imports a schema. The WSDL contains the prefix for the namespace, and the schema contains the type information for the parameters of a method, but Suds will not prefix the parameter's XML element until I add that prefix and namespace to the schema itself. I didn't write the WSDL and schema so it's entirely possible they just wrote it wrong. However, I've seen quite a few different WSDL + schema examples that don't do this, so I'm unsure what the standard practice is.
In short, is it standard practice to require both the WSDL and any imported schemas to define the prefix for a namespace?
WSDL definitions - tmdd is the prefix in question
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.tmdd.org/303/dialogs" xmlns:tmdd="http://www.tmdd.org/303/messages" name="TMDDCenterServices" targetNamespace="http://www.tmdd.org/303/dialogs">
Schema definition in xsd
<xs:schema xmlns="http://www.tmdd.org/303/messages" targetNamespace="http://www.tmdd.org/303/messages" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="DRAFT">
Produces request with the ns, not the prefix. centerActiveVerificationRequestMsg is the parameter in question
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.tmdd.org/303/messages"><SOAP-ENV:Header/>
<ns0:Body>
<centerActiveVerificationRequestMsg xmlns="http://www.tmdd.org/303/messages">
<authentication/>
<organization-requesting>
<organization-id>1</organization-id>
</organization-requesting>
</centerActiveVerificationRequestMsg>
</ns0:Body>
</SOAP-ENV:Envelope>
If I add the tmdd prefix to the schema definition, like so (or any prefix with that url, apparently)
<xs:schema xmlns="http://www.tmdd.org/303/messages" xmlns:tmdd="http://www.tmdd.org/303/messages" targetNamespace="http://www.tmdd.org/303/messages" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="DRAFT">
It then does produce the request with the prefix for the parameter centerActiveVerificationRequestMsg instead of the ns
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.tmdd.org/303/messages"><SOAP-ENV:Header/>
<ns0:Body>
<ns1:centerActiveVerificationRequestMsg>
<authentication/><organization-requesting>
<organization-id>1</organization-id>
</organization-requesting>
</ns1:centerActiveVerificationRequestMsg>
</ns0:Body>
</SOAP-ENV:Envelope>
Relevant part of WSDL. tmdd is the prefix for the attributes in question
...
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.tmdd.org/303/dialogs" xmlns:tmdd="http://www.tmdd.org/303/messages" name="TMDDCenterServices" targetNamespace="http://www.tmdd.org/303/dialogs">
...
<types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://www.tmdd.org/303/messages" schemaLocation="TMDD.xsd"/>
</xs:schema>
</types>
...
<message name="MSG_CenterActiveVerificationRequest">
<part name="message" element="tmdd:centerActiveVerificationRequestMsg"/>
</message>
...
<portType "tmddOCSoapHttpServicePortType">
...
<operation name="dlCenterActiveVerificationRequest">
<documentation><objectClass>ConnectionManagement</objectClass><objectClass>ExternalCenter</objectClass><objectClass>OwnerCenter</objectClass><msgPattern>R-R</msgPattern><requirement>REQ199</requirement></documentation>
<input message="tns:MSG_CenterActiveVerificationRequest"/>
<output message="tns:MSG_CenterActiveVerificationResponse"/>
<fault name="errorReport" message="tns:MSG_ErrorReport"/>
</operation>
...
</portType>
<binding name="tmddOCSoapHttpServiceBinding" type="tns:tmddOCSoapHttpServicePortType">
...
<operation name="dlCenterActiveVerificationRequest">
<soap:operation soapAction="''" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="errorReport">
<soap:fault name="errorReport" use="literal"/>
</fault>
</operation>
...
</binding>
Relevant part of Schema
...
<xs:schema xmlns="http://www.tmdd.org/303/messages" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ntcip="http://www.ntcip.org/c2f-object-references" xmlns:c2c="http://www.ntcip.org/c2c-message-administration" xmlns:itis="http://www.ITIS-Adopted-03-00-02" xmlns:lrms="http://www.LRMS-Adopted-02-00-00" targetNamespace="http://www.tmdd.org/303/messages" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="DRAFT">
...
<xs:element name="centerActiveVerificationRequestMsg" type="CenterActiveVerificationRequest">
<xs:annotation>
<xs:documentation>
<objectClass>ConnectionManagement</objectClass>
<requirement>REQ1125</requirement>
</xs:documentation>
</xs:annotation>
</xs:element>
...
<xs:complexType name="CenterActiveVerificationRequest">
<xs:annotation>
<xs:documentation>
<objectClass>ConnectionManagement</objectClass>
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="authentication" type="Authentication">
<xs:annotation>
<xs:documentation>
<requirement>REQ201</requirement>
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="organization-requesting" type="OrganizationInformation">
<xs:annotation>
<xs:documentation>
<requirement>REQ201</requirement>
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:any namespace="##other" processContents="lax" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
...
WSDL: https://scos-third-party-repository.s3.us-east-2.amazonaws.com/wsdl/tmdd_local.wsdl
Schema: https://scos-third-party-repository.s3.us-east-2.amazonaws.com/wsdl/TMDD.xsd