2009-09-03 232 views
0

對於SOAP HTTP請求,我完全陌生。有人能給我一個關於可能會減緩它的事情的廣泛破壞。我正在使用SOAP,WSDL的.NET應用程序。該請求每次大約需要50秒。我可能沒有任何意義,所以請原諒我的無知。在我的結尾處可以做些什麼,以便允許請求在不導致頁面不加載的情況下運行。 AJAX也許。SOAP HTTP請求很慢

--M

編輯(09/08/2009):

OK,我用SOAPUI及其未來與兩個選項WebServiceSoap12和WebServiceSoap。第一個是goving我迅速毫秒的響應,第二個是給我一個「400錯誤的請求。爲什麼我需要的是第二個?

下面是WSDL

<?xml version="1.0" encoding="utf-8"?> 
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.example.com" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://www.example.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> 
    <wsdl:types> 
    <s:schema elementFormDefault="qualified" targetNamespace="http://www.example.com"> 
     <s:element name="EventGetList"> 
     <s:complexType> 
      <s:sequence> 
      <s:element minOccurs="0" maxOccurs="1" name="regionId" type="s:string" /> 
      </s:sequence> 
     </s:complexType> 
     </s:element> 
     <s:element name="EventGetListResponse"> 
     <s:complexType> 
      <s:sequence> 
      <s:element minOccurs="0" maxOccurs="1" name="EventGetListResult" type="tns:ArrayOfOpenEvent" /> 
      </s:sequence> 
     </s:complexType> 
     </s:element> 
     <s:complexType name="ArrayOfOpenEvent"> 
     <s:sequence> 
      <s:element minOccurs="0" maxOccurs="unbounded" name="OpenEvent" nillable="true" type="tns:OpenEvent" /> 
     </s:sequence> 
     </s:complexType> 
     <s:complexType name="OpenEvent"> 
     <s:sequence> 
      <s:element minOccurs="0" maxOccurs="1" name="Id" type="s:string" /> 
      <s:element minOccurs="0" maxOccurs="1" name="Title" type="s:string" /> 
      <s:element minOccurs="1" maxOccurs="1" name="EventStart" type="s:dateTime" /> 
      <s:element minOccurs="1" maxOccurs="1" name="EventEnd" type="s:dateTime" /> 
      <s:element minOccurs="0" maxOccurs="1" name="RegionId" type="s:string" /> 
      <s:element minOccurs="0" maxOccurs="1" name="EventSubject" type="s:string" /> 
      <s:element minOccurs="0" maxOccurs="1" name="EventAdditionalDetails" type="s:string" /> 
      <s:element minOccurs="0" maxOccurs="1" name="EventDelivery" type="s:string" /> 
      <s:element minOccurs="0" maxOccurs="1" name="Location" type="tns:EventLocation" /> 
      <s:element minOccurs="1" maxOccurs="1" name="OnlineRegistrations" type="s:boolean" /> 
     </s:sequence> 
     </s:complexType> 
     <s:complexType name="EventLocation"> 
     <s:sequence> 
      <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" /> 
      <s:element minOccurs="0" maxOccurs="1" name="Address1" type="s:string" /> 
      <s:element minOccurs="0" maxOccurs="1" name="Address2" type="s:string" /> 
      <s:element minOccurs="0" maxOccurs="1" name="Address3" type="s:string" /> 
      <s:element minOccurs="0" maxOccurs="1" name="Town" type="s:string" /> 
      <s:element minOccurs="0" maxOccurs="1" name="Postcode" type="s:string" /> 
      <s:element minOccurs="0" maxOccurs="1" name="AddressOther" type="s:string" /> 
     </s:sequence> 
     </s:complexType> 
     <s:element name="EventRegisterClient"> 
     <s:complexType> 
      <s:sequence> 
      <s:element minOccurs="0" maxOccurs="1" name="registration" type="tns:OpenEventRegistration" /> 
      </s:sequence> 
     </s:complexType> 
     </s:element> 
     <s:complexType name="OpenEventRegistration"> 
     <s:sequence> 
      <s:element minOccurs="0" maxOccurs="1" name="EventId" type="s:string" /> 
      <s:element minOccurs="0" maxOccurs="1" name="ForeName" type="s:string" /> 
      <s:element minOccurs="0" maxOccurs="1" name="Surname" type="s:string" /> 
      <s:element minOccurs="0" maxOccurs="1" name="TelephoneNumber" type="s:string" /> 
      <s:element minOccurs="0" maxOccurs="1" name="EmailAddress" type="s:string" /> 
     </s:sequence> 
     </s:complexType> 
     <s:element name="EventRegisterClientResponse"> 
     <s:complexType> 
      <s:sequence> 
      <s:element minOccurs="1" maxOccurs="1" name="EventRegisterClientResult" type="s:boolean" /> 
      </s:sequence> 
     </s:complexType> 
     </s:element> 
    </s:schema> 
    </wsdl:types> 
    <wsdl:message name="EventGetListSoapIn"> 
    <wsdl:part name="parameters" element="tns:EventGetList" /> 
    </wsdl:message> 
    <wsdl:message name="EventGetListSoapOut"> 
    <wsdl:part name="parameters" element="tns:EventGetListResponse" /> 
    </wsdl:message> 
    <wsdl:message name="EventRegisterClientSoapIn"> 
    <wsdl:part name="parameters" element="tns:EventRegisterClient" /> 
    </wsdl:message> 
    <wsdl:message name="EventRegisterClientSoapOut"> 
    <wsdl:part name="parameters" element="tns:EventRegisterClientResponse" /> 
    </wsdl:message> 
    <wsdl:portType name="WebServiceSBSpEventsSoap"> 
    <wsdl:operation name="EventGetList"> 
     <wsdl:input message="tns:EventGetListSoapIn" /> 
     <wsdl:output message="tns:EventGetListSoapOut" /> 
    </wsdl:operation> 
    <wsdl:operation name="EventRegisterClient"> 
     <wsdl:input message="tns:EventRegisterClientSoapIn" /> 
     <wsdl:output message="tns:EventRegisterClientSoapOut" /> 
    </wsdl:operation> 
    </wsdl:portType> 
    <wsdl:binding name="WebServiceSBSpEventsSoap" type="tns:WebServiceSBSpEventsSoap"> 
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> 
    <wsdl:operation name="EventGetList"> 
     <soap:operation soapAction="http://www.example.com/EventGetList" style="document" /> 
     <wsdl:input> 
     <soap:body use="literal" /> 
     </wsdl:input> 
     <wsdl:output> 
     <soap:body use="literal" /> 
     </wsdl:output> 
    </wsdl:operation> 
    <wsdl:operation name="EventRegisterClient"> 
     <soap:operation soapAction="http://www.example.com/EventRegisterClient" 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="WebServiceSBSpEventsSoap12" type="tns:WebServiceSBSpEventsSoap"> 
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" /> 
    <wsdl:operation name="EventGetList"> 
     <soap12:operation soapAction="http://www.example.com/EventGetList" style="document" /> 
     <wsdl:input> 
     <soap12:body use="literal" /> 
     </wsdl:input> 
     <wsdl:output> 
     <soap12:body use="literal" /> 
     </wsdl:output> 
    </wsdl:operation> 
    <wsdl:operation name="EventRegisterClient"> 
     <soap12:operation soapAction="http://www.example.com/EventRegisterClient" 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="WebServiceSBSpEvents"> 
    <wsdl:port name="WebServiceSBSpEventsSoap" binding="tns:WebServiceSBSpEventsSoap"> 
     <soap:address location="http://www.example.com/webserviceexternal/WebServiceSBSpEvents.asmx" /> 
    </wsdl:port> 
    <wsdl:port name="WebServiceSBSpEventsSoap12" binding="tns:WebServiceSBSpEventsSoap12"> 
     <soap12:address location="http://www.example.com/webserviceexternal/WebServiceSBSpEvents.asmx" /> 
    </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 
+0

有沒有一般的理由,它減慢,但有任何數量的具體的。不幸的是,你沒有發佈任何代碼,所以我們看不到你的代碼有什麼問題。 – 2009-09-05 02:24:23

回答

1

你應該首先嚐試以確定延遲的原因,因爲可能有很多原因,您的主要興趣是如果延遲發生在服務器側或(您的)客戶端上

如果延遲是在服務器端的東西(可能是一個複雜的操作來創建一個結果,可能是緩慢的服務器等),那麼你可以尋找解決方法來處理你的c lient,如:

  • 創建頁面第一,通過AJAX之後從服務拉出數據,如你所說
  • 在定期服務的前期拉動的數據並將其存儲在本地緩存從您建造網頁
  • 等...

如果延遲在客戶端上發生的事情,你應該嘗試找到根本原因(如網絡配置,超時與反向查找等),並解決它;)


編輯:鑑於貼WSDL,Web服務提供了自己在兩個變化,一個是「默認」 SOAP和一個用於SOAP 1.2。 400響應表明客戶端以非標準符合方式發出請求,但也可能是服務端沒有正確設置它在wsdl中提供的協議版本。

至於爲什麼你需要一個或另一個,答案很簡單:兩者都提供完全相同的方法,所以你只需要一個。它可能是可能是是延遲是由您的客戶端首次試圖使用已停用的版本幾次,並在一段時間後只切換到另一個 - 但這只是猜測。如果SOAPUI適用於1.2版本,我只是試圖告訴客戶端使用它,並看看是否能加快速度。

+0

找到了一個可能已經死亡的鏈接,會導致它嗎? madphp 2009-09-08 11:15:59

+0

非常不可能 - 名稱空間URI並不需要真正指向任何真實內容,因爲它們僅用於唯一標識名稱空間,不用於描述它或任何內容。仍然有很多人在描述命名空間的URI地址處放置可讀文檔,但是沒有任何XML解析器/工具應該真的想要查看這些文檔,特別是在這樣做的時候不要「開懷大笑」。 – 2009-09-08 18:27:09