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

Method parameter's namespace of Array type in WSDL is incorrect #937

Closed
dengber opened this issue Mar 30, 2023 · 2 comments
Closed

Method parameter's namespace of Array type in WSDL is incorrect #937

dengber opened this issue Mar 30, 2023 · 2 comments

Comments

@dengber
Copy link

dengber commented Mar 30, 2023

The following WSDL generated by SoapCore is incorrect, line 9 should be <xs:element xmlns:q1="http://Test.SoapCore.Services.Dto" minOccurs="1" name="inDtos" nillable="true" type="q1:ArrayOfInDto" /> .

Test code for this WSDL is here

1. <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://Test.SoapCore.Services/Test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
2.     xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://Test.SoapCore.Services/Test" name="ITestWebServiceProvider">
3.     <wsdl:types>
4.         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" targetNamespace="http://Test.SoapCore.Services/Test">
5.             <xs:import namespace="http://Test.SoapCore.Services.Dto" />
6.             <xs:element name="Execute">
7.                 <xs:complexType>
8.                     <xs:sequence>
9.                         <xs:element minOccurs="1" name="inDtos" nillable="true" type="tns:ArrayOfInDto" />
10.                     </xs:sequence>
11.                 </xs:complexType>
12.             </xs:element>
13.             <xs:element name="ExecuteResponse">
14.                 <xs:complexType>
15.                     <xs:sequence>
16.                         <xs:element xmlns:q1="http://Test.SoapCore.Services.Dto" minOccurs="1" name="ExecuteResult" nillable="true" type="q1:ArrayOfOutDto" />
17.                     </xs:sequence>
18.                 </xs:complexType>
19.             </xs:element>
20.         </xs:schema>
21.         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/">
22.             <xs:element name="anyType" nillable="true" type="xs:anyType" />
23.             <xs:element name="anyURI" nillable="true" type="xs:anyURI" />
24.             <xs:element name="base64Binary" nillable="true" type="xs:base64Binary" />
25.             <xs:element name="boolean" nillable="true" type="xs:boolean" />
26.             <xs:element name="byte" nillable="true" type="xs:byte" />
27.             <xs:element name="dateTime" nillable="true" type="xs:dateTime" />
28.             <xs:element name="decimal" nillable="true" type="xs:decimal" />
29.             <xs:element name="double" nillable="true" type="xs:double" />
30.             <xs:element name="float" nillable="true" type="xs:float" />
31.             <xs:element name="int" nillable="true" type="xs:int" />
32.             <xs:element name="long" nillable="true" type="xs:long" />
33.             <xs:element name="QName" nillable="true" type="xs:QName" />
34.             <xs:element name="short" nillable="true" type="xs:short" />
35.             <xs:element name="string" nillable="true" type="xs:string" />
36.             <xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" />
37.             <xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" />
38.             <xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" />
39.             <xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" />
40.             <xs:element name="char" nillable="true" type="tns:char" />
41.             <xs:simpleType name="char">
42.                 <xs:restriction base="xs:int" />
43.             </xs:simpleType>
44.             <xs:element name="duration" nillable="true" type="tns:duration" />
45.             <xs:simpleType name="duration">
46.                 <xs:restriction base="xs:duration">
47.                     <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" />
48.                     <xs:minInclusive value="-P10675199DT2H48M5.4775808S" />
49.                     <xs:maxInclusive value="P10675199DT2H48M5.4775807S" />
50.                 </xs:restriction>
51.             </xs:simpleType>
52.             <xs:element name="guid" nillable="true" type="tns:guid" />
53.             <xs:simpleType name="guid">
54.                 <xs:restriction base="xs:string">
55.                     <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" />
56.                 </xs:restriction>
57.             </xs:simpleType>
58.             <xs:attribute name="FactoryType" type="xs:QName" />
59.             <xs:attribute name="Id" type="xs:ID" />
60.             <xs:attribute name="Ref" type="xs:IDREF" />
61.         </xs:schema>
62.         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://Test.SoapCore.Services.Dto" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" targetNamespace="http://Test.SoapCore.Services.Dto">
63.             <xs:import namespace="http://schemas.datacontract.org/2004/07/System" />
64.             <xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
65.             <xs:complexType xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" name="InDto">
66.                 <xs:sequence />
67.             </xs:complexType>
68.             <xs:element name="InDto" nillable="true" type="tns:InDto" />
69.             <xs:complexType xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" name="OutDto">
70.                 <xs:sequence />
71.             </xs:complexType>
72.             <xs:element name="OutDto" nillable="true" type="tns:OutDto" />
73.             <xs:complexType xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" name="ArrayOfInDto">
74.                 <xs:sequence>
75.                     <xs:element minOccurs="0" maxOccurs="unbounded" name="InDto" nillable="true" type="tns:InDto" />
76.                 </xs:sequence>
77.             </xs:complexType>
78.             <xs:element name="ArrayOfInDto" nillable="true" type="tns:ArrayOfInDto" />
79.             <xs:complexType xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" name="ArrayOfOutDto">
80.                 <xs:sequence>
81.                     <xs:element minOccurs="0" maxOccurs="unbounded" name="OutDto" nillable="true" type="tns:OutDto" />
82.                 </xs:sequence>
83.             </xs:complexType>
84.             <xs:element name="ArrayOfOutDto" nillable="true" type="tns:ArrayOfOutDto" />
85.         </xs:schema>
86.         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
87.             <xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
88.         </xs:schema>
89.     </wsdl:types>
90.     <wsdl:message name="ITestWebServiceProvider_Execute_InputMessage">
91.         <wsdl:part name="parameters" element="tns:Execute" />
92.     </wsdl:message>
93.     <wsdl:message name="ITestWebServiceProvider_Execute_OutputMessage">
94.         <wsdl:part name="parameters" element="tns:ExecuteResponse" />
95.     </wsdl:message>
96.     <wsdl:portType name="ITestWebServiceProvider">
97.         <wsdl:operation name="Execute">
98.             <wsdl:input wsam:Action="http://Test.SoapCore.Services/Test/ITestWebServiceProvider/Execute" message="tns:ITestWebServiceProvider_Execute_InputMessage" />
99.             <wsdl:output wsam:Action="http://Test.SoapCore.Services/Test/ITestWebServiceProvider/ExecuteResponse" message="tns:ITestWebServiceProvider_Execute_OutputMessage" />
100.         </wsdl:operation>
101.     </wsdl:portType>
102.     <wsdl:binding name="BasicHttpBinding_ITestWebServiceProvider" type="tns:ITestWebServiceProvider">
103.         <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
104.         <wsdl:operation name="Execute">
105.             <soap:operation soapAction="http://Test.SoapCore.Services/Test/ITestWebServiceProvider/Execute" style="document" />
106.             <wsdl:input>
107.                 <soap:body use="literal" />
108.             </wsdl:input>
109.             <wsdl:output>
110.                 <soap:body use="literal" />
111.             </wsdl:output>
112.         </wsdl:operation>
113.     </wsdl:binding>
114.     <wsdl:service name="ITestWebServiceProvider">
115.         <wsdl:port name="BasicHttpBinding_ITestWebServiceProvider" binding="tns:BasicHttpBinding_ITestWebServiceProvider">
116.             <soap:address location="https://localhost:7093/TestWebServiceProvider.svc" />
117.         </wsdl:port>
118.     </wsdl:service>
119. </wsdl:definitions>
@andersjonsson
Copy link
Collaborator

I don't know enough to say if that is correct or not, but you can fix your particular issue by adding something like

[XmlType(TypeName = "ArrayOfInDto", Namespace = "MyNamespace")]
class InDtoList : List<InDto>
{
}

And then using that list instead of a regular list/array

If you know what the correct behavior should be you are more than welcome to submit a PR

@dengber
Copy link
Author

dengber commented Mar 31, 2023

Line 9 (method parameter) and line 16 (method return value) are both list of dto with same namespace, so their namespace in WSDL should be same. I submitted a PR for this, thanks!

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

No branches or pull requests

2 participants