我一直在尝试为我开发的PHP服务生成WSDL,但我似乎无法生成Visual Studio正确分析的WSDL。
我需要所有的Web方法都需要一个身份验证标头,并尝试了两种不同的解决方案(隐式和显式标头),但它们似乎都不起作用。我可能做错了,我在这里错过了,所以我将保留两个版本的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">
<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>
显式标题
<?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>
我希望webmethods有两个输入结构,但它们只显示用户名和密码作为输入,这是Authentication结构的字段。
答案 0 :(得分:0)
好吧,我似乎找到了这个问题的答案,所以如果有人遇到同样的问题,我会留下更正的WSDL。
我不得不更改WSDL的几个部分,包括为每个soap:operation添加style =“document”,用每个消息下的part元素替换part类型,在每个消息部分使用参数作为名称而不是名称类型,除了你看到两个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>