这是我的第一篇文章,所以如果我的问题没有达到标准,请不要苛刻:)
我在使用asmx设置Web服务时遇到问题。 Web服务在IIS上运行。 主要问题是带有附件的SOAP请求。这些请求以“多部分/相关”的形式发送。 IIS在接收带有此格式(多部分/相关格式)的数据的请求时返回错误。停留在不支持此类数据的错误状态。
所以我的问题是,此错误是否是IIS配置,asmx限制或其他原因造成的?
WSDL看起来像这样:
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://zgloszenia.iitech.com.pl/" xmlns:s0="http://servicecenter.peregrine.com/PWS" xmlns:s1="http://servicecenter.peregrine.com/PWS/Common" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://zgloszenia.iitech.com.pl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://servicecenter.peregrine.com/PWS">
<s:import namespace="http://servicecenter.peregrine.com/PWS/Common" />
<s:element name="UpdateZSZgloszeniaZSRequest">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="model" nillable="true" type="s0:ZgloszeniaZSModelType" />
</s:sequence>
<s:attribute name="attachmentInfo" type="s:boolean" />
<s:attribute name="attachmentData" type="s:boolean" />
<s:attribute default="true" name="ignoreEmptyElements" type="s:boolean" />
<s:attribute default="-1" name="updateconstraint" type="s:long" />
</s:complexType>
</s:element>
<s:complexType name="ZgloszeniaZSModelType">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="keys" nillable="true" type="s0:ZgloszeniaZSKeysType" />
<s:element minOccurs="1" maxOccurs="1" name="instance" nillable="true" type="s0:ZgloszeniaZSInstanceType" />
<s:element minOccurs="0" maxOccurs="1" name="messages" type="s1:ArrayOfMessageType" />
</s:sequence>
<s:attribute name="query" type="s:string" />
</s:complexType>
<s:complexType name="ZgloszeniaZSKeysType">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="WsId" type="s1:StringType" />
</s:sequence>
<s:attribute name="query" type="s:string" />
<s:attribute name="updatecounter" type="s:long" />
</s:complexType>
<s:complexType name="ZgloszeniaZSInstanceType">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="WsId" type="s1:StringType" />
<s:element minOccurs="0" maxOccurs="1" name="WsUslEk" type="s1:StringType" />
<s:element minOccurs="0" maxOccurs="1" name="WsParametry" type="s1:StringType" />
<s:element minOccurs="0" maxOccurs="1" name="WsPrzyczyna" type="s1:StringType" />
<s:element minOccurs="0" maxOccurs="1" name="WsRozwiazanie" type="s1:StringType" />
<s:element minOccurs="0" maxOccurs="1" name="WsModyfikacja" type="s1:StringType" />
<s:element minOccurs="0" maxOccurs="1" name="WsIdZew" type="s1:StringType" />
<s:element minOccurs="0" maxOccurs="1" name="WsUmowa" type="s1:StringType" />
<s:element minOccurs="0" maxOccurs="1" name="WsPoziom" type="s1:StringType" />
<s:element minOccurs="0" maxOccurs="1" name="WsType" type="s1:StringType" />
<s:element minOccurs="0" maxOccurs="1" name="WsTresc" type="s0:ZgloszeniaZSInstanceTypeWsTresc" />
<s:element minOccurs="0" maxOccurs="1" name="WsData" type="s0:DateTimeType" />
<s:element minOccurs="0" maxOccurs="1" name="WsImie" type="s1:StringType" />
<s:element minOccurs="0" maxOccurs="1" name="Wsnazwisko" type="s1:StringType" />
<s:element minOccurs="0" maxOccurs="1" name="WsLokalizacja" type="s1:StringType" />
<s:element minOccurs="0" maxOccurs="1" name="WsEmail" type="s1:StringType" />
<s:element minOccurs="0" maxOccurs="1" name="WsTelefon" type="s1:StringType" />
<s:element minOccurs="0" maxOccurs="1" name="attachments" type="s1:ArrayOfAttachmentType" />
</s:sequence>
<s:attribute name="query" type="s:string" />
<s:attribute name="uniquequery" type="s:string" />
<s:attribute name="recordid" type="s:string" />
<s:attribute name="updatecounter" type="s:long" />
</s:complexType>
<s:complexType name="ZgloszeniaZSInstanceTypeWsTresc">
<s:complexcontent mixed="false">
<s:extension base="s0:ArrayType">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="WsTresc" type="s1:StringType" />
</s:sequence>
</s:extension>
</s:complexcontent>
</s:complexType>
<s:complexType name="ArrayType">
<s:attribute name="type" type="s:string" />
</s:complexType>
<s:complexType name="DateTimeType">
<s:simpleContent>
<s:extension base="s:dateTime">
<s:attribute name="type" type="s:string" />
<s:attribute name="mandatory" type="s:boolean" />
<s:attribute name="readonly" type="s:boolean" />
</s:extension>
</s:simpleContent>
</s:complexType>
<s:element name="UpdateZSZgloszeniaZSResult" type="s0:UpdateZSZgloszeniaZSResponse" />
<s:complexType name="UpdateZSZgloszeniaZSResponse">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="model" type="s0:ZgloszeniaZSModelType" />
<s:element minOccurs="0" maxOccurs="1" name="messages" type="s1:ArrayOfMessageType" />
</s:sequence>
<s:attribute name="status" type="s0:StatusType" use="required" />
<s:attribute name="message" type="s:string" />
<s:attribute name="schemaRevisionDate" type="s:date" use="required" />
<s:attribute name="schemaRevisionLevel" type="s:int" use="required" />
<s:attribute name="returnCode" type="s:decimal" />
<s:attribute name="query" type="s:string" />
</s:complexType>
<s:simpletype name="StatusType">
<s:restriction base="s:string">
<s:enumeration value="SUCCESS" />
<s:enumeration value="FAILURE" />
</s:restriction>
</s:simpletype>
</s:schema>
<s:schema elementFormDefault="qualified" targetNamespace="http://servicecenter.peregrine.com/PWS/Common">
<s:complexType name="StringType">
<s:simpleContent>
<s:extension base="s:string">
<s:attribute name="type" type="s:string" />
<s:attribute name="mandatory" type="s:boolean" />
<s:attribute name="readonly" type="s:boolean" />
</s:extension>
</s:simpleContent>
</s:complexType>
<s:complexType name="MessageType">
<s:simpleContent>
<s:extension base="s1:StringType">
<s:attribute name="severity" type="s:int" />
<s:attribute name="module" type="s:string" />
</s:extension>
</s:simpleContent>
</s:complexType>
<s:complexType name="ArrayOfAttachmentType">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="attachment" type="s1:AttachmentType" />
</s:sequence>
</s:complexType>
<s:complexType name="AttachmentType">
<s:attribute name="href" type="s:string" />
<s:attribute name="contentId" type="s:string" />
<s:attribute name="action" type="s:string" />
<s:attribute name="name" type="s:string" />
<s:attribute name="type" type="s:string" />
<s:attribute name="len" type="s:int" />
<s:attribute name="charset" type="s:string" />
<s:attribute name="upload.by" type="s:string" />
<s:attribute name="upload.date" type="s:string" />
<s:attribute name="attachmentType" type="s:string" />
</s:complexType>
<s:complexType name="ArrayOfMessageType">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="message" type="s1:MessageType" />
</s:sequence>
</s:complexType>
</s:schema>
<s:schema elementFormDefault="qualified" targetNamespace="http://zgloszenia.iitech.com.pl/">
<s:import namespace="http://servicecenter.peregrine.com/PWS/Common" />
<s:complexType name="MessageType">
<s:simpleContent>
<s:extension base="s1:StringType">
<s:attribute name="severity" type="s:int" />
<s:attribute name="module" type="s:string" />
</s:extension>
</s:simpleContent>
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="UpdateZSZgloszeniaZSSoapIn">
<wsdl:part name="UpdateZSZgloszeniaZSRequest" element="s0:UpdateZSZgloszeniaZSRequest" />
</wsdl:message>
<wsdl:message name="UpdateZSZgloszeniaZSSoapOut">
<wsdl:part name="UpdateZSZgloszeniaZSResult" element="s0:UpdateZSZgloszeniaZSResult" />
</wsdl:message>
<wsdl:portType name="ZgloszeniaZSSoap">
<wsdl:operation name="UpdateZSZgloszeniaZS">
<wsdl:input message="tns:UpdateZSZgloszeniaZSSoapIn" />
<wsdl:output message="tns:UpdateZSZgloszeniaZSSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ZgloszeniaZSSoap" type="tns:ZgloszeniaZSSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="UpdateZSZgloszeniaZS">
<soap:operation soapaction="UpdateZS" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="ZgloszeniaZSSoap12" type="tns:ZgloszeniaZSSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="UpdateZSZgloszeniaZS">
<soap12:operation soapaction="UpdateZS" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ZgloszeniaZS">
<wsdl:port name="ZgloszeniaZSSoap" binding="tns:ZgloszeniaZSSoap">
<soap:address location="https://zgloszenia.iitech.pl/zgloszeniazs.asmx" />
</wsdl:port>
<wsdl:port name="ZgloszeniaZSSoap12" binding="tns:ZgloszeniaZSSoap12">
<soap12:address location="https://zgloszenia.iitech.pl/zgloszeniazs.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
必须由网络服务处理的请求(它来自客户端应用程序,我没有权限)。
<soap:Envelope xmlns:ns0="http://servicecenter.peregrine.com/PWS/Common" xmlns:ns1="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns2="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:ns3="http://servicecenter.peregrine.com/PWS" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<ns3:UpdateZSZgloszeniaZSRequest
attachmentInfo="true"
attachmentData="true"
ignoreEmptyElements="true"
updateconstraint="-1" xmlns:ns3="http://servicecenter.peregrine.com/PWS">
<ns3:model>
<ns3:keys
updatecounter="0"></ns3:keys>
<ns3:instance
updatecounter="0">
<ns3:WsId
type="String"
mandatory="false"
readonly="false">ZS362982</ns3:WsId>
<ns3:WsUslEk
type="String"
mandatory="false"
readonly="false">Innovation_QSR#00@1.01.001</ns3:WsUslEk>
<ns3:WsParametry
type="String"
mandatory="false"
readonly="false"><parametry id="ZS362982"><param id="1" name="Opis" war="Zgłoszenie testowe 29-10-2019"/><param id="2" name="Źródłowe EK:" war="WZU#00 (HP SM)"/><param id="3" name="podkategoria:" war="Zgłoszenie od użytkownika"/><param id="4" name="Typ produktu:" war="Obszar wewnętrznych i uzupełniających usług IT"/><param id="5" name="Typ problemu:" war="Aplikacja HP SM - Wystąpił błąd lub wyświetla ona nieprawidłowe informacje (usługa: WZU#00)"/></parametry></ns3:WsParametry>
<ns3:WsIdZew
type="String"
mandatory="false"
readonly="false">test13112019</ns3:WsIdZew>
<ns3:WsUmowa
type="String"
mandatory="false"
readonly="false">Umowa z numerem</ns3:WsUmowa>
<ns3:WsPoziom
type="String"
mandatory="false"
readonly="false">incydent standardowy</ns3:WsPoziom>
<ns3:WsType
type="String"
mandatory="false"
readonly="false">I</ns3:WsType>
<ns3:WsTresc
type="Array">
<ns3:WsTresc
type="String"
mandatory="false"
readonly="false">Testowe zgłoszneie z załącznikiem.</ns3:WsTresc>
<ns3:WsTresc
type="String"
mandatory="false"
readonly="false">Osoba do kontaktu:</ns3:WsTresc>
<ns3:WsTresc
type="String"
mandatory="false"
readonly="false">GAL,ANONIM</ns3:WsTresc>
<ns3:WsTresc
type="String"
mandatory="false"
readonly="false">5555555555</ns3:WsTresc>
<ns3:WsTresc
type="String"
mandatory="false"
readonly="false">jakis@mail.pl</ns3:WsTresc>
</ns3:WsTresc>
<ns3:WsData
type="DateTime"
mandatory="false"
readonly="false">2019-11-15T10:21:23+00:00</ns3:WsData>
<ns3:WsImie
type="String"
mandatory="false"
readonly="false">Gal</ns3:WsImie>
<ns3:Wsnazwisko
type="String"
mandatory="false"
readonly="false">Anonim</ns3:Wsnazwisko>
<ns3:WsLokalizacja
type="String"
mandatory="false"
readonly="false">Miasto</ns3:WsLokalizacja>
<ns3:WsEmail
type="String"
mandatory="false"
readonly="false">jakis@mail.pl</ns3:WsEmail>
<ns3:WsTelefon
type="String"
mandatory="false"
readonly="false">555555555</ns3:WsTelefon>
<ns3:attachments>
<ns0:attachment
href="cid:5dce7bed002d308280844a58"
contentId="cid:5dce7bed002d308280844a58"
action="add"
name="parametry_IIT.xlsx"
type="application/octet-stream"
len="11252" />
</ns3:attachments>
</ns3:instance>
</ns3:model>
</ns3:UpdateZSZgloszeniaZSRequest>
</soap:Body>
</soap:Envelope>
在底部,您可以看到如何在请求中设置附件。