WSDL Not correctly imported in Visual Studio
I have been trying to generate a WSDL for a PHP service that I developed, but I can't seem to generate a WSDL that Visual Studio parses correctly.
I need all the web methods to require an authentication Header, and have tried two different solutions (implicit and explicit headers), but none of them seems to work. I might be doing something wrong that I am missing here, so I will leave the WSDL of the two versions, hoping that someone would shed some light on this.
Thanks in advance.
Implicit Header
<?xml version="1.0" encoding="UTF-8"?><definitions name="voucherManagement"
targetNamespace="http://[ENV].[MYDOMAIN]/voucherManagement/schema"
xmlns:tns="http://[ENV].[MYDOMAIN]/voucherManagement.wsdl"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsd1="http://[ENV].[MYDOMAIN]/voucherManagement/schema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema targetNamespace="http://[ENV].[MYDOMAIN]/voucherManagement/schema"
xmlns="http://www.w3.org/2001/XMLSchema">
<complexType name="voucher"><sequence><element name="voucherID" type="string"/><element name="value" type="string"/><element name="creationDate" type="string"/><element name="expiryDate" type="string"/></sequence></complexType><complexType name="client"><sequence><element name="name" type="string"/><element name="contact" type="string"/><element name="goldClientID" type="string"/><element name="clientID" type="string"/><element name="contractID" type="string"/></sequence></complexType><complexType name="addVoucherInputData"><sequence><element name="voucher" type="xsd1:voucher"/><element name="client" type="xsd1:client"/></sequence></complexType><complexType name="addVoucherOutputData"><sequence><element name="status" type="string"/><element name="reference" type="string"/></sequence></complexType><complexType name="getVoucherInputData"><sequence><element name="voucherID" type="string"/></sequence></complexType><complexType name="voucherInfo"><sequence><element name="reference" type="string"/><element name="value" type="string"/><element name="creationDate" type="string"/><element name="activationDate" type="string"/><element name="expiryDate" type="string"/><element name="usageDate" type="string"/><element name="status" type="string"/><element name="clientID" type="string"/></sequence></complexType><complexType name="getVoucherOutputData"><sequence><element name="voucher" type="xsd1:voucherInfo"/></sequence></complexType><complexType name="voucher"><sequence><element name="voucherID" type="string"/><element name="value" type="string"/><element name="creationDate" type="string"/><element name="expiryDate" type="string"/></sequence></complexType><complexType name="client"><sequence><element name="name" type="string"/><element name="contact" type="string"/><element name="goldClientID" type="string"/><element name="clientID" type="string"/><element name="contractID" type="string"/></sequence></complexType><complexType name="updateVoucherInputData"><sequence><element name="voucher" type="xsd1:voucher"/><element name="client" type="xsd1:client"/></sequence></complexType><complexType name="updateVoucherOutputData"><sequence><element name="status" type="string"/></sequence></complexType><complexType name="removeVoucherInputData"><sequence><element name="voucherID" type="string"/></sequence></complexType><complexType name="removeVoucherOutputData"><sequence><element name="status" type="string"/></sequence></complexType><element name="Authentication">
<complexType>
<sequence>
<element name="Username" type="string"/>
<element name="Password" type="string"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="AuthenticationHeader"><part name="request_header" type="xsd1:Authentication"/></message><message name="addVoucherRequest"><part name="addVoucherInputData" type="xsd1:addVoucherInputData"/></message>
<message name="addVoucherResponse">
<part name="addVoucherOutputData" type="xsd1:addVoucherOutputData"/>
</message><message name="getVoucherRequest"><part name="getVoucherInputData" type="xsd1:getVoucherInputData"/></message>
<message name="getVoucherResponse">
<part name="getVoucherOutputData" type="xsd1:getVoucherOutputData"/>
</message><message name="updateVoucherRequest"><part name="updateVoucherInputData" type="xsd1:updateVoucherInputData"/></message>
<message name="updateVoucherResponse">
<part name="updateVoucherOutputData" type="xsd1:updateVoucherOutputData"/>
</message><message name="removeVoucherRequest"><part name="removeVoucherInputData" type="xsd1:removeVoucherInputData"/></message>
<message name="removeVoucherResponse">
<part name="removeVoucherOutputData" type="xsd1:removeVoucherOutputData"/>
</message>
<portType name="voucherManagementPort"><operation name="addVoucher">
<input message="xsd1:addVoucherRequest"/>
<output message="xsd1:addVoucherResponse"/>
</operation><operation name="getVoucher">
<input message="xsd1:getVoucherRequest"/>
<output message="xsd1:getVoucherResponse"/>
</operation><operation name="updateVoucher">
<input message="xsd1:updateVoucherRequest"/>
<output message="xsd1:updateVoucherResponse"/>
</operation><operation name="removeVoucher">
<input message="xsd1:removeVoucherRequest"/>
<output message="xsd1:removeVoucherResponse"/>
</operation></portType>
<binding name="voucherManagementBinding" type="xsd1:voucherManagementPort"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><operation name="addVoucher">
<soap:operation soapAction="addVoucher"/>
<input name="addVoucherRequest">
<soap:header message="xsd1:AuthenticationHeader" part="request_header" use="literal"/>
<soap:body parts="addVoucherInputData" use="literal"/>
</input>
<output>
<soap:body parts="addVoucherOutputData" use="literal"/>
</output>
</operation><operation name="getVoucher">
<soap:operation soapAction="getVoucher"/>
<input name="getVoucherRequest">
<soap:header message="xsd1:AuthenticationHeader" part="request_header" use="literal"/>
<soap:body parts="getVoucherInputData" use="literal"/>
</input>
<output>
<soap:body parts="getVoucherOutputData" use="literal"/>
</output>
</operation><operation name="updateVoucher">
<soap:operation soapAction="updateVoucher"/>
<input name="updateVoucherRequest">
<soap:header message="xsd1:AuthenticationHeader" part="request_header" use="literal"/>
<soap:body parts="updateVoucherInputData" use="literal"/>
</input>
<output>
<soap:body parts="updateVoucherOutputData" use="literal"/>
</output>
</operation><operation name="removeVoucher">
<soap:operation soapAction="removeVoucher"/>
<input name="removeVoucherRequest">
<soap:header message="xsd1:AuthenticationHeader" part="request_header" use="literal"/>
<soap:body parts="removeVoucherInputData" use="literal"/>
</input>
<output>
<soap:body parts="removeVoucherOutputData" use="literal"/>
</output>
</operation></binding>
<service name="voucherManagement">
<documentation>WSDL File for voucherManagement</documentation>
<port binding="xsd1:voucherManagementBinding" name="voucherManagementPort">
<soap:address location="http://[ENV].[MYDOMAIN]/voucherManagement.ws"/>
</port>
</service>
</definitions>
Explicit Header
<?xml version="1.0" encoding="UTF-8"?><definitions name="voucherManagement"
targetNamespace="http://[ENV].[MYDOMAIN]/voucherManagement/schema"
xmlns:tns="http://[ENV].[MYDOMAIN]/voucherManagement.wsdl"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsd1="http://[ENV].[MYDOMAIN]/voucherManagement/schema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema targetNamespace="http://[ENV].[MYDOMAIN]/voucherManagement/schema"
xmlns="http://www.w3.org/2001/XMLSchema">
<complexType name="voucher"><sequence><element name="voucherID" type="string"/><element name="value" type="string"/><element name="creationDate" type="string"/><element name="expiryDate" type="string"/></sequence></complexType><complexType name="client"><sequence><element name="name" type="string"/><element name="contact" type="string"/><element name="goldClientID" type="string"/><element name="clientID" type="string"/><element name="contractID" type="string"/></sequence></complexType><complexType name="addVoucherInputData"><sequence><element name="voucher" type="xsd1:voucher"/><element name="client" type="xsd1:client"/></sequence></complexType><complexType name="addVoucherOutputData"><sequence><element name="status" type="string"/><element name="reference" type="string"/></sequence></complexType><complexType name="getVoucherInputData"><sequence><element name="voucherID" type="string"/></sequence>开发者_如何学Python</complexType><complexType name="voucherInfo"><sequence><element name="reference" type="string"/><element name="value" type="string"/><element name="creationDate" type="string"/><element name="activationDate" type="string"/><element name="expiryDate" type="string"/><element name="usageDate" type="string"/><element name="status" type="string"/><element name="clientID" type="string"/></sequence></complexType><complexType name="getVoucherOutputData"><sequence><element name="voucher" type="xsd1:voucherInfo"/></sequence></complexType><complexType name="voucher"><sequence><element name="voucherID" type="string"/><element name="value" type="string"/><element name="creationDate" type="string"/><element name="expiryDate" type="string"/></sequence></complexType><complexType name="client"><sequence><element name="name" type="string"/><element name="contact" type="string"/><element name="goldClientID" type="string"/><element name="clientID" type="string"/><element name="contractID" type="string"/></sequence></complexType><complexType name="updateVoucherInputData"><sequence><element name="voucher" type="xsd1:voucher"/><element name="client" type="xsd1:client"/></sequence></complexType><complexType name="updateVoucherOutputData"><sequence><element name="status" type="string"/></sequence></complexType><complexType name="removeVoucherInputData"><sequence><element name="voucherID" type="string"/></sequence></complexType><complexType name="removeVoucherOutputData"><sequence><element name="status" type="string"/></sequence></complexType><element name="Authentication">
<complexType>
<sequence>
<element name="Username" type="string"/>
<element name="Password" type="string"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="AuthenticationHeader"><part name="request_header" type="xsd1:Authentication"/></message><message name="addVoucherRequest"><part name="addVoucherInputData" type="xsd1:addVoucherInputData"/></message>
<message name="addVoucherResponse">
<part name="addVoucherOutputData" type="xsd1:addVoucherOutputData"/>
</message><message name="getVoucherRequest"><part name="getVoucherInputData" type="xsd1:getVoucherInputData"/></message>
<message name="getVoucherResponse">
<part name="getVoucherOutputData" type="xsd1:getVoucherOutputData"/>
</message><message name="updateVoucherRequest"><part name="updateVoucherInputData" type="xsd1:updateVoucherInputData"/></message>
<message name="updateVoucherResponse">
<part name="updateVoucherOutputData" type="xsd1:updateVoucherOutputData"/>
</message><message name="removeVoucherRequest"><part name="removeVoucherInputData" type="xsd1:removeVoucherInputData"/></message>
<message name="removeVoucherResponse">
<part name="removeVoucherOutputData" type="xsd1:removeVoucherOutputData"/>
</message>
<portType name="voucherManagementPort"><operation name="addVoucher">
<input message="xsd1:addVoucherRequest"/>
<output message="xsd1:addVoucherResponse"/>
</operation><operation name="getVoucher">
<input message="xsd1:getVoucherRequest"/>
<output message="xsd1:getVoucherResponse"/>
</operation><operation name="updateVoucher">
<input message="xsd1:updateVoucherRequest"/>
<output message="xsd1:updateVoucherResponse"/>
</operation><operation name="removeVoucher">
<input message="xsd1:removeVoucherRequest"/>
<output message="xsd1:removeVoucherResponse"/>
</operation></portType>
<binding name="voucherManagementBinding" type="xsd1:voucherManagementPort"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><operation name="addVoucher">
<soap:operation soapAction="addVoucher"/>
<input name="addVoucherRequest">
<soap:header message="xsd1:AuthenticationHeader" part="request_header" use="literal"/>
<soap:body parts="addVoucherInputData" use="literal"/>
</input>
<output>
<soap:body parts="addVoucherOutputData" use="literal"/>
</output>
</operation><operation name="getVoucher">
<soap:operation soapAction="getVoucher"/>
<input name="getVoucherRequest">
<soap:header message="xsd1:AuthenticationHeader" part="request_header" use="literal"/>
<soap:body parts="getVoucherInputData" use="literal"/>
</input>
<output>
<soap:body parts="getVoucherOutputData" use="literal"/>
</output>
</operation><operation name="updateVoucher">
<soap:operation soapAction="updateVoucher"/>
<input name="updateVoucherRequest">
<soap:header message="xsd1:AuthenticationHeader" part="request_header" use="literal"/>
<soap:body parts="updateVoucherInputData" use="literal"/>
</input>
<output>
<soap:body parts="updateVoucherOutputData" use="literal"/>
</output>
</operation><operation name="removeVoucher">
<soap:operation soapAction="removeVoucher"/>
<input name="removeVoucherRequest">
<soap:header message="xsd1:AuthenticationHeader" part="request_header" use="literal"/>
<soap:body parts="removeVoucherInputData" use="literal"/>
</input>
<output>
<soap:body parts="removeVoucherOutputData" use="literal"/>
</output>
</operation></binding>
<service name="voucherManagement">
<documentation>WSDL File for voucherManagement</documentation>
<port binding="xsd1:voucherManagementBinding" name="voucherManagementPort">
<soap:address location="http://[ENV].[MYDOMAIN]/voucherManagement.ws"/>
</port>
</service>
</definitions>
I would expect the webmethods to have two input structures, but they appear with only username and password as their input, which are the fields of the Authentication structure.
Well I seem to have found an answer to this problem, so I will leave here the corrected WSDL in case someone goes through the same issue.
I had to change several parts of the WSDL, including adding style="document" to each soap:operation, replacing part types with part elements under each message, using parameters as name on each message part instead of the name of the type, besides some other changes you might see if you look at both WSDL.
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="voucherManagement" targetNamespace="http://[ENV].[MyDOMAIN]/voucherManagement/schema" xmlns:tns="http://[ENV].[MyDOMAIN]/voucherManagement.wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd1="http://[ENV].[MyDOMAIN]/voucherManagement/schema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema targetNamespace="http://[ENV].[MyDOMAIN]/voucherManagement/schema" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="voucher" type="xsd1:voucher"/>
<complexType name="voucher">
<sequence>
<element name="voucherID" type="string"/>
<element name="value" type="string"/>
<element name="creationDate" type="string"/>
<element name="expiryDate" type="string"/>
</sequence>
</complexType>
<element name="client" type="xsd1:client"/>
<complexType name="client">
<sequence>
<element name="name" type="string"/>
<element name="contact" type="string"/>
<element name="goldClientID" type="string"/>
<element name="clientID" type="string"/>
<element name="contractID" type="string"/>
</sequence>
</complexType>
<element name="addVoucherInputData" type="xsd1:addVoucherInputData"/>
<complexType name="addVoucherInputData">
<sequence>
<element name="voucher" type="xsd1:voucher"/>
<element name="client" type="xsd1:client"/>
</sequence>
</complexType>
<element name="addVoucherOutputData" type="xsd1:addVoucherOutputData"/>
<complexType name="addVoucherOutputData">
<sequence>
<element name="status" type="string"/>
<element name="reference" type="string"/>
</sequence>
</complexType>
<element name="getVoucherInputData" type="xsd1:getVoucherInputData"/>
<complexType name="getVoucherInputData">
<sequence>
<element name="voucherID" type="string"/>
</sequence>
</complexType>
<element name="voucherInfo" type="xsd1:voucherInfo"/>
<complexType name="voucherInfo">
<sequence>
<element name="reference" type="string"/>
<element name="value" type="string"/>
<element name="creationDate" type="string"/>
<element name="activationDate" type="string"/>
<element name="expiryDate" type="string"/>
<element name="usageDate" type="string"/>
<element name="status" type="string"/>
<element name="clientID" type="string"/>
</sequence>
</complexType>
<element name="getVoucherOutputData" type="xsd1:getVoucherOutputData"/>
<complexType name="getVoucherOutputData">
<sequence>
<element name="voucher" type="xsd1:voucherInfo"/>
</sequence>
</complexType>
<element name="updateVoucherInputData" type="xsd1:updateVoucherInputData"/>
<complexType name="updateVoucherInputData">
<sequence>
<element name="voucher" type="xsd1:voucher"/>
<element name="client" type="xsd1:client"/>
</sequence>
</complexType>
<element name="updateVoucherOutputData" type="xsd1:updateVoucherOutputData"/>
<complexType name="updateVoucherOutputData">
<sequence>
<element name="status" type="string"/>
</sequence>
</complexType>
<element name="removeVoucherInputData" type="xsd1:removeVoucherInputData"/>
<complexType name="removeVoucherInputData">
<sequence>
<element name="voucherID" type="string"/>
</sequence>
</complexType>
<element name="removeVoucherOutputData" type="xsd1:removeVoucherOutputData"/>
<complexType name="removeVoucherOutputData">
<sequence>
<element name="status" type="string"/>
</sequence>
</complexType>
<element name="Compression" type="string">
</element>
<element name="Encryption" type="string">
</element>
<element name="Authentication">
<complexType>
<sequence>
<element name="Username" type="string"/>
<element name="Password" type="string"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="AuthenticationHeader">
<part name="request_header" element="xsd1:Authentication"/>
</message>
<message name="CompressionHeader">
<part name="header_compression" element="xsd1:Compression"/>
</message>
<message name="EncryptionHeader">
<part name="header_encryption" element="xsd1:Encryption"/>
</message>
<message name="addVoucherRequest">
<part name="parameters" element="xsd1:addVoucherInputData"/>
</message>
<message name="addVoucherResponse">
<part name="parameters" element="xsd1:addVoucherOutputData"/>
</message>
<message name="getVoucherRequest">
<part name="parameters" element="xsd1:getVoucherInputData"/>
</message>
<message name="getVoucherResponse">
<part name="parameters" element="xsd1:getVoucherOutputData"/>
</message>
<message name="updateVoucherRequest">
<part name="parameters" element="xsd1:updateVoucherInputData"/>
</message>
<message name="updateVoucherResponse">
<part name="parameters" element="xsd1:updateVoucherOutputData"/>
</message>
<message name="removeVoucherRequest">
<part name="parameters" element="xsd1:removeVoucherInputData"/>
</message>
<message name="removeVoucherResponse">
<part name="parameters" element="xsd1:removeVoucherOutputData"/>
</message>
<portType name="voucherManagementPort">
<operation name="addVoucher">
<input message="xsd1:addVoucherRequest"/>
<output message="xsd1:addVoucherResponse"/>
</operation>
<operation name="getVoucher">
<input message="xsd1:getVoucherRequest"/>
<output message="xsd1:getVoucherResponse"/>
</operation>
<operation name="updateVoucher">
<input message="xsd1:updateVoucherRequest"/>
<output message="xsd1:updateVoucherResponse"/>
</operation>
<operation name="removeVoucher">
<input message="xsd1:removeVoucherRequest"/>
<output message="xsd1:removeVoucherResponse"/>
</operation>
</portType>
<binding name="voucherManagementBinding" type="xsd1:voucherManagementPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="addVoucher">
<soap:operation soapAction="addVoucher" style="document"/>
<input>
<soap:header message="xsd1:AuthenticationHeader" part="request_header" use="literal"/>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="getVoucher">
<soap:operation soapAction="getVoucher" style="document"/>
<input>
<soap:header message="xsd1:AuthenticationHeader" part="request_header" use="literal"/>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="updateVoucher">
<soap:operation soapAction="updateVoucher" style="document"/>
<input>
<soap:header message="xsd1:AuthenticationHeader" part="request_header" use="literal"/>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="removeVoucher">
<soap:operation soapAction="removeVoucher" style="document"/>
<input>
<soap:header message="xsd1:AuthenticationHeader" part="request_header" use="literal"/>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="voucherManagement">
<documentation>WSDL File for voucherManagement WebService</documentation>
<port binding="xsd1:voucherManagementBinding" name="voucherManagementPort">
<soap:address location="http://[ENV].[MyDOMAIN]/voucherManagement.ws"/>
</port>
</service>
</definitions>
精彩评论