我有一个WSDL。在WSDL之后,我尝试在SoapUI中尝试
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" name="NextGenService" targetNamespace=""> <wsp:Policy wsu:Id="DocumentExchangePort_policy">...</wsp:Policy> <wsdl:types> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/Message" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/Message"> <xs:simpleType name="StreamBody"> <xs:restriction base="xs:base64Binary"/> </xs:simpleType> </xs:schema> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:import namespace="http://schemas.microsoft.com/Message"/> <xs:import namespace="http://schemas.datacontract.org/2004/07/SupportingDocsFacade"/> <xs:element name="RemoteFileInfo"> <xs:complexType> <xs:sequence> <xs:element xmlns:q1="http://schemas.microsoft.com/Message" name="FileByteStream" type="q1:StreamBody"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element xmlns:q2="http://schemas.datacontract.org/2004/07/SupportingDocsFacade" name="dcExhange" nillable="true" type="q2:DocumentExchangeRequests"/> </xs:schema> <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/"> <xs:element name="anyType" nillable="true" type="xs:anyType"/> <xs:element name="anyURI" nillable="true" type="xs:anyURI"/> <xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/> <xs:element name="boolean" nillable="true" type="xs:boolean"/> <xs:element name="byte" nillable="true" type="xs:byte"/> <xs:element name="dateTime" nillable="true" type="xs:dateTime"/> <xs:element name="decimal" nillable="true" type="xs:decimal"/> <xs:element name="double" nillable="true" type="xs:double"/> <xs:element name="float" nillable="true" type="xs:float"/> <xs:element name="int" nillable="true" type="xs:int"/> <xs:element name="long" nillable="true" type="xs:long"/> <xs:element name="QName" nillable="true" type="xs:QName"/> <xs:element name="short" nillable="true" type="xs:short"/> <xs:element name="string" nillable="true" type="xs:string"/> <xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/> <xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/> <xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/> <xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/> <xs:element name="char" nillable="true" type="tns:char"/> <xs:simpleType name="char"> <xs:restriction base="xs:int"/> </xs:simpleType> <xs:element name="duration" nillable="true" type="tns:duration"/> <xs:simpleType name="duration"> <xs:restriction base="xs:duration"> <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/> <xs:minInclusive value="-P10675199DT2H48M5.4775808S"/> <xs:maxInclusive value="P10675199DT2H48M5.4775807S"/> </xs:restriction> </xs:simpleType> <xs:element name="guid" nillable="true" type="tns:guid"/> <xs:simpleType name="guid"> <xs:restriction base="xs:string"> <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/> </xs:restriction> </xs:simpleType> <xs:attribute name="FactoryType" type="xs:QName"/> <xs:attribute name="Id" type="xs:ID"/> <xs:attribute name="Ref" type="xs:IDREF"/> </xs:schema> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.datacontract.org/2004/07/SupportingDocsFacade" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/SupportingDocsFacade"> <xs:complexType name="DocumentExchangeRequests"> <xs:sequence> <xs:element name="_documentDescription" nillable="true" type="tns:DescriptionSet"/> <xs:element name="_loanIdentifier" nillable="true" type="tns:LoanFileIdentifier"/> </xs:sequence> </xs:complexType> <xs:element name="DocumentExchangeRequests" nillable="true" type="tns:DocumentExchangeRequests"/> <xs:complexType name="DescriptionSet"> <xs:sequence> <xs:element name="_documentType" nillable="true" type="xs:string"/> <xs:element name="_x003C_ByteCount_x003E_k__BackingField" nillable="true" type="xs:string"/> <xs:element name="_x003C_DocumentCreated_x003E_k__BackingField" nillable="true" type="xs:string"/> <xs:element name="_x003C_DocumentDescrption_x003E_k__BackingField" nillable="true" type="xs:string"/> <xs:element name="_x003C_DocumentID_x003E_k__BackingField" nillable="true" type="xs:string"/> <xs:element name="_x003C_PageCount_x003E_k__BackingField" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:element name="DescriptionSet" nillable="true" type="tns:DescriptionSet"/> <xs:complexType name="LoanFileIdentifier"> <xs:sequence> <xs:element name="_x003C_ApplyOnlineID_x003E_k__BackingField" nillable="true" type="xs:string"/> <xs:element name="_x003C_BrokerID_x003E_k__BackingField" nillable="true" type="xs:string"/> <xs:element name="_x003C_DocumentID_x003E_k__BackingField" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:element name="LoanFileIdentifier" nillable="true" type="tns:LoanFileIdentifier"/> </xs:schema> </wsdl:types> <wsdl:message name="RemoteFileInfo"> <wsdl:part name="parameters" element="RemoteFileInfo"/> </wsdl:message> <wsdl:message name="RemoteFileInfo_Headers"> <wsdl:part name="dcExhange" element="dcExhange"/> </wsdl:message> <wsdl:message name="INextGenService_UploadDocNextGen_OutputMessage"/> <wsdl:portType name="INextGenService"> <wsdl:operation name="UploadDocNextGen"> <wsdl:input wsaw:Action="urn:INextGenService/UploadDocNextGen" name="RemoteFileInfo" message="RemoteFileInfo"/> <wsdl:output wsaw:Action="urn:INextGenService/UploadDocNextGenResponse" message="INextGenService_UploadDocNextGen_OutputMessage"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="DocumentExchangePort" type="INextGenService"> <wsp:PolicyReference URI="#DocumentExchangePort_policy"/> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="UploadDocNextGen"> <soap12:operation soapAction="urn:INextGenService/UploadDocNextGen" style="document"/> <wsdl:input name="RemoteFileInfo"> <soap12:header message="RemoteFileInfo_Headers" part="dcExhange" use="literal"/> <soap12:body use="literal"/> </wsdl:input> <wsdl:output> <soap12:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="NextGenService"> <wsdl:port name="DocumentExchangePort" binding="DocumentExchangePort"> <soap12:address location="https://l24-a0845.latrobe.biz/SupportingDocsFacade/NextGenService.svc/UploadDoc"/> <wsa10:EndpointReference> <wsa10:Address> https://l24-a0845.latrobe.biz/SupportingDocsFacade/NextGenService.svc/UploadDoc </wsa10:Address> </wsa10:EndpointReference> </wsdl:port> </wsdl:service> </wsdl:definitions>
服务器中用于生成以下内容的webconfig看起来像这样
<system.serviceModel> <bindings> <wsHttpBinding> <binding name="WsBinding" messageEncoding="Mtom" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" transactionFlow="false" textEncoding="utf-8" > </binding> </wsHttpBinding> </bindings> <services> <service behaviorConfiguration="NextGenServiceBehavior" name="SupportingDocsFacade.NextGenService"> <endpoint address="/UploadDoc" binding="wsHttpBinding" bindingConfiguration="WsBinding" name="Basic" contract="SupportingDocsFacade.INextGenService" /> </service> </services> <behavior name="NextGenServiceBehavior"> <serviceMetadata httpsGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> <dataContractSerializer maxItemsInObjectGraph="2147483647" /> </behavior>
我写了一个客户端,它能够与该服务进行通信。
下面是用于WCF服务的RemoteFileInfo类
public class RemoteFileInfo : IDisposable { [MessageHeader(MustUnderstand = true)] public DocumentExchangeRequests dcExhange; [MessageBodyMember] public Stream FileByteStream; public void Dispose() { if (FileByteStream != null) { FileByteStream.Close(); FileByteStream = null; } } } [Serializable] [MessageContract] public class DocumentExchangeRequests { private DescriptionSet _documentDescription = null; private LoanFileIdentifier _loanIdentifier = null; [DataMember(IsRequired = true)] public DescriptionSet DocumentDescriptionset { get { return _documentDescription = this.DocumentDescriptionset; } set { this.DocumentDescriptionset = value; } } [DataMember(IsRequired = true)] public LoanFileIdentifier LoanIdentifier { get { return _loanIdentifier = this.LoanIdentifier; } set { this.LoanIdentifier = value; } } } [Serializable] [MessageContract] public class DescriptionSet { private string _documentType = ""; [DataMember(IsRequired = true)] public string DocumentTypes { get { return _documentType = this.DocumentTypes; } set { this.DocumentTypes = value; } } [DataMember(IsRequired = true)] public string DocumentID { get; set; } [DataMember(IsRequired = true)] public string ByteCount { get; set; } [DataMember(IsRequired = true)] public string DocumentCreated { get; set; } [DataMember(IsRequired = true)] public string PageCount { get; set; } [DataMember(IsRequired = true)] public string DocumentDescrption { get; set; } } [Serializable] [MessageContract] public class LoanFileIdentifier { [DataMember(IsRequired = true, Order = 0, Name = "DocHeaderID")] public string DocumentID { get; set; } [DataMember(IsRequired = true, Order = 1, Name = "BrokerID")] public string BrokerID { get; set; } [DataMember(IsRequired = true, Order = 2, Name = "ApplyOnlineID")] public string ApplyOnlineID { get; set; } }
关于导致问题的原因的任何指针。我已经努力解决了一个星期。这与soapUI中的设置有关还是我的WSDL本身是错误的?
我有一个WSDL。在WSDL之后,我尝试在SoapUI中尝试
WSDL,Web服务描述语言,此文件不包含服务的数据协定,只有XSD文件包含数据协定,并且WSDL具有这些XSD文件的导入指令。由于对其他文件的这种依赖性,因此无法由某些第三方处理此类WSDL文件。因此,WCF4.5通过使用单个文件发布服务元数据。所有WSDL信息都在一个文档中返回,其中包括一些其他信息。在SOAPUI中,我们可以使用SingleWSDL文件来生成项目。