客户端发送的soap消息中只包含调用的方法名和参数信息,服务端如何判断调用哪个服务类来处理这次请求,请知道原理的给解释下,谢谢~

解决方案 »

  1.   

    你的wsdl不是已经对应好到相应的处理类了么
      

  2.   

    这个如果自己尝试架设一下webservice就会比较清楚了,比如说,class WebInterface {
        Service a = new Service();
     
        doTask1(parameter abc) {
            a.doWork(abc);
        }}对于调用者而言,他是只知道webservice接口的WebInterface,方法doTask1和方法参数abc,至于服务类Service在调用时是不关心的,像2楼说的,在wsdl文件中应该能查到。
      

  3.   

    WSDL中是哪里对应到处理类的这个不是太明白
      

  4.   

    具体我也不是很清楚,这里有文档解释:
    http://www.w3.org/TR/wsdl
    一般如果自己有架设webservice,对比着看下马上就清楚了,楼主要知道这个的目的是什么呢?一般用处不到啊    Types– a container for data type definitions using some type system (such as XSD).
        Message– an abstract, typed definition of the data being communicated.
        Operation– an abstract description of an action supported by the service.
        Port Type–an abstract set of operations supported by one or more endpoints.
        Binding– a concrete protocol and data format specification for a particular port type.
        Port– a single endpoint defined as a combination of a binding and a network address.
        Service– a collection of related endpoints.
    Example 1 SOAP 1.1 Request/Response via HTTP<?xml version="1.0"?>
    <definitions name="StockQuote"targetNamespace="http://example.com/stockquote.wsdl"
              xmlns:tns="http://example.com/stockquote.wsdl"
              xmlns:xsd1="http://example.com/stockquote.xsd"
              xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
              xmlns="http://schemas.xmlsoap.org/wsdl/">    <types>
           <schema targetNamespace="http://example.com/stockquote.xsd"
                  xmlns="http://www.w3.org/2000/10/XMLSchema">
               <element name="TradePriceRequest">
                  <complexType>
                      <all>
                          <element name="tickerSymbol" type="string"/>
                      </all>
                  </complexType>
               </element>
               <element name="TradePrice">
                  <complexType>
                      <all>
                          <element name="price" type="float"/>
                      </all>
                  </complexType>
               </element>
           </schema>
        </types>    <message name="GetLastTradePriceInput">
            <part name="body" element="xsd1:TradePriceRequest"/>
        </message>    <message name="GetLastTradePriceOutput">
            <part name="body" element="xsd1:TradePrice"/>
        </message>    <portType name="StockQuotePortType">
            <operation name="GetLastTradePrice">
               <input message="tns:GetLastTradePriceInput"/>
               <output message="tns:GetLastTradePriceOutput"/>
            </operation>
        </portType>    <binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType">
            <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
            <operation name="GetLastTradePrice">
               <soap:operation soapAction="http://example.com/GetLastTradePrice"/>
               <input>
                   <soap:body use="literal"/>
               </input>
               <output>
                   <soap:body use="literal"/>
               </output>
            </operation>
        </binding>    <service name="StockQuoteService">
            <documentation>My first service</documentation>
            <port name="StockQuotePort" binding="tns:StockQuoteBinding">
               <soap:address location="http://example.com/stockquote"/>
            </port>
        </service></definitions>
      

  5.   

    好好看下WSDL的相关文档,我觉得不需要服务端做具体判断调用哪个服务类,因为这些接口和参数本身是透明的,服务端不是已经做好对应了吗,还需要做什么判断吗?