2011-01-31 54 views
1

我可以在服務標籤中爲單個portType操作指定2個位置嗎?基本上這意味着如果客戶端支持soap綁定和url2的其他綁定,則客戶端會調用url1。wsdl服務標籤多個網址的


<wsdl:service name="NewService"> 
    <wsdl:port name="NewPort" binding="tns:NewBinding"> 
     <soap:address location="http://url1"/> 
    </wsdl:port> 
    <wsdl:port name="NewPort" binding="tns:NewBinding2"> 
     <soap12:address location="http://url2"/> 
    </wsdl:port> 
</wsdl:service> 

我不能做這樣的事?您可以通過url1或url2訪問NewPort操作。

回答

0

是的,你可以做這樣的事情:

<wsdl:service name="NewService"> 
    <wsdl:port name="NewPort" binding="tns:NewBinding"> 
     <soap:address location="http://url1"/> 
    </wsdl:port> 
    <wsdl:port name="NewPort2" binding="tns:NewBinding2"> 
     <soap12:address location="http://url2"/> 
    </wsdl:port> 
</wsdl:service> 

兩個綁定可以指同一portType


完全WSDL:

<?xml version="1.0" encoding="UTF-8"?> 
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
    xmlns:tns="http://new.webservice.namespace" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
    targetNamespace="http://new.webservice.namespace"> 
    <wsdl:types> 
     <xs:schema targetNamespace="http://new.webservice.namespace" elementFormDefault="qualified"/> 
    </wsdl:types> 
    <wsdl:message name="NewMessageRequest"> 
     <wsdl:part name="parameter" type="xs:string"/> 
    </wsdl:message> 
    <wsdl:message name="NewMessageResponse"> 
     <wsdl:part name="parameter" type="xs:string"/> 
    </wsdl:message> 
    <wsdl:portType name="NewPortType"> 
     <wsdl:operation name="NewOperation"> 
      <wsdl:input message="tns:NewMessageRequest"/> 
      <wsdl:output message="tns:NewMessageResponse"/> 
     </wsdl:operation> 
    </wsdl:portType> 
    <wsdl:binding name="NewBinding" type="tns:NewPortType"> 
     <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 
     <wsdl:operation name="NewOperation"> 
      <soap:operation soapAction="urn:#NewOperation"/> 
      <wsdl:input> 
       <soap:body use="literal"/> 
      </wsdl:input> 
      <wsdl:output> 
       <soap:body use="literal"/> 
      </wsdl:output> 
     </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:binding name="NewBinding2" type="tns:NewPortType"> 
     <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 
     <wsdl:operation name="NewOperation"> 
      <soap12:operation soapAction="urn:#NewOperation" soapActionRequired="true" 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="NewService"> 
     <wsdl:port name="NewPort" binding="tns:NewBinding"> 
      <soap:address location="http://url1"/> 
     </wsdl:port> 
     <wsdl:port name="NewPort2" binding="tns:NewBinding2"> 
      <soap12:address location="http://url2"/> 
     </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 
+0

哦,不都應該是相同的端口操作。你已經使用了兩個不同的端口。 NewPort和NePort2 – user581734 2011-01-31 04:14:22