SOAP HTTP请求非常慢 [英] SOAP HTTP Request Very Slow

查看:960
本文介绍了SOAP HTTP请求非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯全新到SOAP HTTP请求。有人可以给我一个广阔的破败的东西可能会慢下来。进出口工作在使用SOAP,WSDL .NET应用程序。请求正在大约50秒时,每次。林很可能使得没有任何意义,所以请原谅我的无知。难道还有什么我可以做我的结束,以允许请求,而不会导致页面无法加载运行。 AJAX也许吧。

- 中号

修改(09/08/2009):

OK,我用SOAPUI及其未来与两个选项WebServiceSoap12和WebServiceSoap。第一个是goving我迅速响应毫秒,第二个是给我一个400错误的请求。为什么我需要一个第二个?

下面是WSDL

 <?XML版本=1.0编码=UTF-8&GT?;
< WSDL:定义的xmlns:SOAP =htt​​p://schemas.xmlsoap.org/wsdl/soap/的xmlns:TM =htt​​p://microsoft.com/wsdl/mime/textMatching/的xmlns:SOAPENC = http://schemas.xmlsoap.org/soap/encoding/的xmlns:哑剧=http://schemas.xmlsoap.org/wsdl/mime/的xmlns:TNS =http://www.example.com的xmlns:S =htt​​p://www.w3.org/2001/XMLSchema中的xmlns:SOAP12 =htt​​p://schemas.xmlsoap.org/wsdl/soap12/的xmlns:HTTP =HTTP://模式。 xmlsoap.org/wsdl/http/的targetNamespace =http://www.example.com的xmlns:WSDL =http://schemas.xmlsoap.org/wsdl/>
  < WSDL:类型>
    < S:架构将elementFormDefault =合格的targetNamespace =htt​​p://www.example.com>
      < S:元素名称=EventGetList>
        < S:复杂类型>
          &所述氏:序列GT;
            &所述氏:元件的minOccurs =0maxOccurs的=1名称=regionId类型=S:串/>
          &所述; /秒:序列GT;
        < / s的:复杂类型>
      &所述; /秒:组件>
      < S:元素名称=EventGetListResponse>
        < S:复杂类型>
          &所述氏:序列GT;
            < S:元素的minOccurs =0的maxOccurs =1NAME =EventGetListResultTYPE =TNS:ArrayOfOpenEvent/>
          &所述; /秒:序列GT;
        < / s的:复杂类型>
      &所述; /秒:组件>
      < S:复杂类型名称=ArrayOfOpenEvent>
        &所述氏:序列GT;
          < S:元素的minOccurs =0的maxOccurs =无界NAME =OpenEvent的nillable =真TYPE =TNS:OpenEvent/>
        &所述; /秒:序列GT;
      < / s的:复杂类型>
      < S:复杂类型名称=OpenEvent>
        &所述氏:序列GT;
          < S:元素的minOccurs =0的maxOccurs =1NAME =ID类型=S:字符串/>
          < S:元素的minOccurs =0的maxOccurs =1NAME =标题类型=S:字符串/>
          < S:元素的minOccurs =1的maxOccurs =1NAME =EventStart类型=S:日期时间/>
          < S:元素的minOccurs =1的maxOccurs =1NAME =EventEnd类型=S:日期时间/>
          &所述氏:元件的minOccurs =0maxOccurs的=1名称=RegionId类型=S:串/>
          &所述氏:元件的minOccurs =0maxOccurs的=1名称=EventSubject类型=S:串/>
          &所述氏:元件的minOccurs =0maxOccurs的=1名称=EventAdditionalDetails类型=S:串/>
          &所述氏:元件的minOccurs =0maxOccurs的=1名称=EventDelivery类型=S:串/>
          < S:元素的minOccurs =0的maxOccurs =1NAME =位置TYPE =TNS:EventLocation/>
          &所述氏:元件的minOccurs =1maxOccurs的=1名称=OnlineRegistrations类型=S:布尔/>
        &所述; /秒:序列GT;
      < / s的:复杂类型>
      < S:复杂类型名称=EventLocation>
        &所述氏:序列GT;
          < S:元素的minOccurs =0的maxOccurs =1NAME =名称类型=S:字符串/>
          &所述氏:元件的minOccurs =0maxOccurs的=1名称=地址1类型=S:串/>
          < S:元素的minOccurs =0的maxOccurs =1NAME =地址2类型=S:字符串/>
          &所述氏:元件的minOccurs =0maxOccurs的=1名称=地址3类型=S:串/>
          < S:元素的minOccurs =0的maxOccurs =1NAME =镇类型=S:字符串/>
          < S:元素的minOccurs =0的maxOccurs =1NAME =邮报code型=S:字符串/>
          &所述氏:元件的minOccurs =0maxOccurs的=1名称=AddressOther类型=S:串/>
        &所述; /秒:序列GT;
      < / s的:复杂类型>
      < S:元素名称=EventRegisterClient>
        < S:复杂类型>
          &所述氏:序列GT;
            < S:元素的minOccurs =0的maxOccurs =1NAME =注册TYPE =TNS:OpenEventRegistration/>
          &所述; /秒:序列GT;
        < / s的:复杂类型>
      &所述; /秒:组件>
      < S:复杂类型名称=OpenEventRegistration>
        &所述氏:序列GT;
          &所述氏:元件的minOccurs =0maxOccurs的=1名称=EVENTID类型=S:串/>
          < S:元素的minOccurs =0的maxOccurs =1NAME =用的名字类型=S:字符串/>
          &所述氏:元件的minOccurs =0maxOccurs的=1名称=姓类型=S:串/>
          &所述氏:元件的minOccurs =0maxOccurs的=1名称=TelephoneNumber类型=S:串/>
          &所述氏:元件的minOccurs =0maxOccurs的=1名称=EmailAddress的类型=S:串/>
        &所述; /秒:序列GT;
      < / s的:复杂类型>
      < S:元素名称=EventRegisterClientResponse>
        < S:复杂类型>
          &所述氏:序列GT;
            &所述氏:元件的minOccurs =1maxOccurs的=1名称=EventRegisterClientResult类型=S:布尔/>
          &所述; /秒:序列GT;
        < / s的:复杂类型>
      &所述; /秒:组件>
    < / S架构>
  < / WSDL:类型>
  < WSDL:消息名称=EventGetListSoapIn>
    < WSDL:部分名称=参数元素=TNS:EventGetList/>
  < / WSDL:消息>
  < WSDL:消息名称=EventGetListSoapOut>
    < WSDL:部分名称=参数元素=TNS:EventGetListResponse/>
  < / WSDL:消息>
  < WSDL:消息名称=EventRegisterClientSoapIn>
    < WSDL:部分名称=参数元素=TNS:EventRegisterClient/>
  < / WSDL:消息>
  < WSDL:消息名称=EventRegisterClientSoapOut>
    < WSDL:部分名称=参数元素=TNS:EventRegisterClientResponse/>
  < / WSDL:消息>
  < WSDL:portType的名称=WebServiceSBSpEventsSoap>
    < WSDL:操作名称=EventGetList>
      < WSDL:输入消息=TNS:EventGetListSoapIn/>
      < WSDL:输出消息=TNS:EventGetListSoapOut/>
    < / WSDL:运转>
    < WSDL:操作名称=EventRegisterClient>
      < WSDL:输入消息=TNS:EventRegisterClientSoapIn/>
      < WSDL:输出消息=TNS:EventRegisterClientSoapOut/>
    < / WSDL:运转>
  < / WSDL:portType的>
  < WSDL:绑定名称=WebServiceSBSpEventsSoapTYPE =TNS:WebServiceSBSpEventsSoap>
    <肥皂:绑定传输=htt​​p://schemas.xmlsoap.org/soap/http/>
    < WSDL:操作名称=EventGetList>
      <肥皂:操作的soapAction =htt​​p://www.example.com/EventGetList的风格=文件/>
      < WSDL:输入>
        <肥皂:身体使用=文字/>
      < / WSDL:输入>
      < WSDL:输出>
        <肥皂:身体使用=文字/>
      < / WSDL:输出>
    < / WSDL:运转>
    < WSDL:操作名称=EventRegisterClient>
      <肥皂:操作的soapAction =htt​​p://www.example.com/EventRegisterClient的风格=文件/>
      < WSDL:输入>
        <肥皂:身体使用=文字/>
      < / WSDL:输入>
      < WSDL:输出>
        <肥皂:身体使用=文字/>
      < / WSDL:输出>
    < / WSDL:运转>
  < / WSDL:结合>
  < WSDL:绑定名称=WebServiceSBSpEventsSoap12TYPE =TNS:WebServiceSBSpEventsSoap>
    < SOAP12:绑定传输=htt​​p://schemas.xmlsoap.org/soap/http/>
    < WSDL:操作名称=EventGetList>
      < SOAP12:操作的soapAction =htt​​p://www.example.com/EventGetList的风格=文件/>
      < WSDL:输入>
        < SOAP12:身体使用=文字/>
      < / WSDL:输入>
      < WSDL:输出>
        < SOAP12:身体使用=文字/>
      < / WSDL:输出>
    < / WSDL:运转>
    < WSDL:操作名称=EventRegisterClient>
      < SOAP12:操作的soapAction =htt​​p://www.example.com/EventRegisterClient的风格=文件/>
      < WSDL:输入>
        < SOAP12:身体使用=文字/>
      < / WSDL:输入>
      < WSDL:输出>
        < SOAP12:身体使用=文字/>
      < / WSDL:输出>
    < / WSDL:运转>
  < / WSDL:结合>
  < WSDL:服务名称=WebServiceSBSpEvents>
    < WSDL:端口名称=WebServiceSBSpEventsSoap绑定=TNS:WebServiceSBSpEventsSoap>
      <肥皂:地址位置=htt​​p://www.example.com/webserviceexternal/WebServiceSBSpEvents.asmx/>
    < / WSDL:端口>
    < WSDL:端口名称=WebServiceSBSpEventsSoap12绑定=TNS:WebServiceSBSpEventsSoap12>
      < SOAP12:地址位置=htt​​p://www.example.com/webserviceexternal/WebServiceSBSpEvents.asmx/>
    < / WSDL:端口>
  < / WSDL:服务>
< / WSDL:定义>


解决方案

您应该首先尝试找出延误的原因,因为可能有很多原因吧。如果延迟发生在服务器一侧或(你的)客户端的侧面的主要兴趣是。

如果延迟是对事物的服务器端(可能是一个复杂的操作来创建一个结果,可能会慢服务器等),那么你可以看看解决方法来处理,在您的客户端,例如:


  • 创建页面第一,通过AJAX之后从服务拉动的数据,如你所说

  • 从在定期服务前期拉出数据并将其存储在本地缓存从中构建你的页面

  • 等...

如果延迟是在客户端上发生的事情,你应该尝试找到根本原因(例如网络配置,反向查找等超时),并修复它;)


编辑:由于贴WSDL,Web服务提供了自己在两个版本,一个是默认SOAP和一个SOAP 1.2。 400响应表示客户端发出一个非标准的要求一致的方式,但它也可能是服务端没有正确设置了协议版本,它说,在WSDL提供。

至于为什么你需要一个或另一个,答案很简单:两者都提供完全相同的方法,所以你只需要一个。它的可能的是,延迟是由您的客户端造成的第一个尝试使用倒闭版本几次,只有经过一段时间切换到其他 - 但是这仅仅是猜测。如果SOAPUI工程确定的1.2版本,我只是试图告诉客户端使用,看看是否有加速的事情了。

Im totally new to SOAP HTTP Requests. Can someone give me a broad rundown on things that might slow it down. Im working on a .NET application that uses SOAP, WSDL. The request is taking around 50 seconds, everytime. Im probably making no sense, so please excuse my ignorance. Could there be something I could do at my end, to allow the request to run without causing the page not to load. AJAX maybe.

--M

Edit (09/08/2009):

OK, i've used SOAPUI and its coming up with two options WebServiceSoap12 and WebServiceSoap. The first one is goving me a speedy milliseconds response, and the second is giving me a "400 Bad Request. Why would I need that second one?

Below is the 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>

解决方案

You should first try to pinpoint the cause of the delay, as there could be many reasons for it. Your main interest would be if the delay happens on the side of the server or on the side of (your) client.

If the delay is on the server side of things (might be a complicated operation to create a result, might be slow server, etc.), then you can look for workarounds to deal with that in your client, e.g.:

  • creating the page first and pulling the data from the service afterward via ajax, as you suggested
  • pulling the data from the service upfront in regular intervals and storing it in a local cache from which you construct your pages
  • etc...

If the delay is happening on the client side, you should try to find the root cause (e.g. network configuration, timeouts with reverse lookups, etc.) and fix it ;)


Edit: Given the posted wsdl, the web service offers itself in two variations, one for 'default' SOAP and one for SOAP 1.2. The 400 response indicates that the client is issuing the request in a non standard conform way, but it might also be that the service end is not properly set up for the protocol version it says to offer in the wsdl.

As for why you'd need one or the other, the answer is simple: Both offer the exact same methods, so you only need one. It could be that the delay is caused by your client first trying to use the defunct version a couple of times and only switching to the other after a while - but this is just guesswork. If SOAPUI works ok with the 1.2 version, I'd just try to tell the client to use that and see if that speeds things up.

这篇关于SOAP HTTP请求非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆