??xml version="1.0" encoding="utf-8" standalone="yes"?>精品乱码亚洲一区二区不卡,国产精品成人a在线观看,久久国产精品久久久http://www.aygfsteel.com/zqli/category/28420.html为学日益Qؓ(f)道日损?/description>zh-cnMon, 24 Mar 2008 10:58:05 GMTMon, 24 Mar 2008 10:58:05 GMT60[转]Axis1.2 下SOAPMonitor问题的解?http://www.aygfsteel.com/zqli/archive/2008/03/24/188268.html放水老?/dc:creator>放水老?/author>Mon, 24 Mar 2008 08:04:00 GMThttp://www.aygfsteel.com/zqli/archive/2008/03/24/188268.htmlhttp://www.aygfsteel.com/zqli/comments/188268.htmlhttp://www.aygfsteel.com/zqli/archive/2008/03/24/188268.html#Feedback0http://www.aygfsteel.com/zqli/comments/commentRss/188268.htmlhttp://www.aygfsteel.com/zqli/services/trackbacks/188268.htmlAxis1.2QJdk1.5QTomcat5.5.12 Q安装成功以后,SOAPMonitor能启动,但是U字的一串信息:(x)The SOAPMonitor is unable to communicate with the server. pC启动不成功Q折腑և天,google查找?jin)好多信息,也没有一个确切的说法Q国内有版本问题Q似乎axis1.2只适用于jdk1.4或是tomcat5.0版本Q还真试q改?jin),也没有效果,在java控制C有提C非法的本地L地址。一ơ偶然的Z(x)Q让我知道该改哪个数据了(jin)。(同一台机器上安装多个tomcatQ相同的端口再现冲突时就需要对端口q行更改Q?br /> 可能是默认的5001端口被占用,axis\WEB-INF下的web.xml文g中的SOAPMonitor的端口默认的5001改ؓ(f)其他的不?x)出现冲H的端口Q问题解冟?br /> 唉,有时一个不L(fng)的问题(sh)能折腾死人,解决后只?x)一声叹息?/font>

 在tomcat容器下自创徏的web应用中也启动axis服务Q想要添加SOAPMonitor的方法是Q?br /> 1、编?br />  axis根目录下的SOAPMonitorApplet.java文g复制到web应用的根目录下,~译此文件同时将生成的类文g复制到应用根目录下的WEB-INF目录下?br /> 2、修改web.xml文g
修改WEB-INF目录下的web.xml文gQ添加两个元?lt;servlet>?lt;servlet-mapping>Q具体内容如下:(x)
<servlet>
    <servlet-name>SOAPMonitorService</servlet-name>
    <display-name>SOAPMonitorService</display-name>
    <servlet-class>
        org.apache.axis.monitor.SOAPMonitorService
    </servlet-class>
    <init-param>
      <param-name>SOAPMonitorPort</param-name>
      <param-value>5005</param-value>
    </init-param>
    <load-on-startup>100</load-on-startup>
  </servlet>
 <servlet-mapping>
    <servlet-name>SOAPMonitorService</servlet-name>
    <url-pattern>/SOAPMonitor</url-pattern>
  </servlet-mapping>
3、修改server-config.wsdd文g
配置文g中添加soapmonitor的配|信息如Q?br /> <handler name="soapmonitor" type="java:org.apache.axis.handlers.SOAPMonitorHandler">
  <service name="SOAPMonitorService" provider="java:RPC">
  <parameter name="allowedMethods" value="publishMessage"/>
  <parameter name="scope" value="Application"/>
  <parameter name="className" value="org.apache.axis.monitor.SOAPMonitorService"/>
 </service>
对于需要被soapmonitor监控的web服务Q在其服务设|中d信息如下
<service name="TestAdding" provider="java:RPC">
  <parameter name="allowedMethods" value="getAdd"/>
  <parameter name="className" value="test.TestAdding"/>
   <requestFlow>
    <handler type="soapmonitor"/>
   </requestFlow>
   <responseFlow>
    <handler type="soapmonitor"/>
   </responseFlow>
 </service>
4、运行测?br /> http://localhost:8080/TestAdding/SOAPMonitor 
Test_soapmonitor.bmp
呵呵Q好不容易折腑֥?jin),看来原来的想法还是对的,只不q在配置文g时出?jin)问题?/font>

]]>
借助WSE3.0研究WS-Addressing规范?/title><link>http://www.aygfsteel.com/zqli/archive/2008/01/11/174521.html</link><dc:creator>放水老?/dc:creator><author>放水老?/author><pubDate>Fri, 11 Jan 2008 02:17:00 GMT</pubDate><guid>http://www.aygfsteel.com/zqli/archive/2008/01/11/174521.html</guid><wfw:comment>http://www.aygfsteel.com/zqli/comments/174521.html</wfw:comment><comments>http://www.aygfsteel.com/zqli/archive/2008/01/11/174521.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/zqli/comments/commentRss/174521.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/zqli/services/trackbacks/174521.html</trackback:ping><description><![CDATA[     cnblogs里有帖?a >http://idior.cnblogs.com/articles/436801.html</a>Q?a class="singleposttitle" id="AjaxHolder_ctl01_TitleUrl" >Applied WSE 3.0 to Web Service Project </a>Q,对于学习(fn)WS-Addressing是篇不错的帖子。按照此贴的Ҏ(gu)q行Q在q踪Soap消息Ӟ抛出异常。在未开启Client端WSE功能ӞSoap Toolkit 3.0能追t到soap消息Q而且Qresponse昄?jin)wse的特性?br /> <br />    <br />       Z(jin)使用Soap Toolkit 3.0Q我们在WS client端输入的目标地址为:(x)<a href="http://localhost:8080/WSEWebService/Service.asmx">http://localhost:8080/WSEWebService/Service.asmx</a>?br />       Soap Toolkit 3.0讄为:(x)<br />        <br />        Listen<br />        Local port:8080<br /> <br />        Forward to<br />        Destination:localhost<br />        Destination:80<br />        之所以这栯|,因ؓ(f)在IIS里设|的本机Web Services为:(x)<a href="http://localhost:8080/WSEWebService/Service.asmx">http://localhost:80/WSEWebService/Service.asmx</a>。Soap Toolkit ?080端口监听来自client端的消息Qƈ消息递交到IIS监听?0端口?br /> <br />        可当开启client端wse功能Ӟ抛出如下异常Q? <fieldset style="width: 1026px; height: 171px"> <p style="margin: 0in 0in 0pt"><span style="font-size: 8pt; font-family: 'Courier New'">Microsoft.Web.Services3.Addressing.AddressingFault: Destination Unreachable ---&gt; System.Exception: </span></p> <p style="margin: 0in 0in 0pt"><span style="font-size: 8pt; font-family: 'Courier New'">WSE816: </span></p> <p style="margin: 0in 0in 0pt"><span style="font-size: 8pt; font-family: 'Courier New'">The &lt;To&gt; header must match the value of an incoming message's HTTP Request Url if the soap receiver does not have an actor name. </span></p> <p style="margin: 0in 0in 0pt"><span style="font-size: 8pt; font-family: 'Courier New'">The &lt;To&gt; header received contained "http://localhost:8080/WSEWebService/Service.asmx" </span></p> <p style="margin: 0in 0in 0pt"><span style="font-size: 8pt; font-family: 'Courier New'">while the HTTP Request Url was "http://localhost/WSEWebService/Service.asmx".</span></p> </fieldset><br />         查看 Soap Toolkit 监听到的SOAP消息可以发现QRequest消息的SoapHeader? 目标地址仍然?span class="m"><</span><span id="wmqeeuq" class="t">wsa:To</span><span id="wmqeeuq" class="m">></span><span id="wmqeeuq" class="tx"><a href="http://localhost/WSEWebService/Service.asmx">http://localhost:8080/WSEWebService/Service.asmx</a></span><span id="wmqeeuq" class="m"></</span><span id="wmqeeuq" class="t">wsa:To</span><span id="wmqeeuq" class="m">></span> Q而不?span class="m"><</span><span id="wmqeeuq" class="t">wsa:To</span><span id="wmqeeuq" class="m">></span><span id="wmqeeuq" class="tx"><a href="http://localhost/WSEWebService/Service.asmx">http://localhost:80/WSEWebService/Service.asmx</a></span><span id="wmqeeuq" class="m"></</span><span id="wmqeeuq" class="t">wsa:To</span><span id="wmqeeuq" class="m">>.因此Qdestination不可达,抛出如上异常?br />          在网上查?jin)资料发玎ͼ?x)<br />           “ <p style="margin: 0in 0in 0pt">WS-Addressing moves the destination URL of the message into the message to enable routing and scenarios where messages are delivered over multiple protocols. Before WS-Addressing the URL of the destination was only available in the protocol part of the message. Is you were sending a SOAP message over HTTP, the URL was stored in the HTTP part of the message. You had no access to the URL from within your SOAP processor – unless your Web server vendor chose to give you access to the HTTP headers.</p> <p style="margin: 0in 0in 0pt">Now with WS-Addressing built into WSE, the Web service platform can actually determine if a message was indeed intended for the service that received it because WSE adds the <to> element to the header of the SOAP message:</p> <p style="margin: 0in 0in 0pt"><span style="font-size: 8pt; font-family: 'Courier New'">      <wsa:To xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"></span></p> <p style="margin: 0in 0in 0pt 0.5in"><span style="font-size: 8pt; font-family: 'Courier New'"><a href="http://myserver/MyService/Service.asmx%3c/wsa:To"><span style="color: windowtext">http://MyServer/MyService/Service.asmx</wsa:To</span></a>></span></p> <p style="margin: 0in 0in 0pt">WSE is actually being smart about the header and rejects messages where the destination in the <wsa:To> header and the URL in the HTTP header do not match.</p> <p style="margin: 0in 0in 0pt">One unfortunate consequence of this behavior is that you cannot use transparent tracing tools like <a >tcpTrace</a> and <a >MSSoapT</a> for message debugging. These tools act like an intermediary receiver and they do cause the URLs in the <To> header and in the HTTP header to not match.</p> ”Q大概意思也是MSSoapt(Soap Toolkit )不支持WSE中WS-Addressing<wsa:To>。所以在调试WSE提供的特性时Q不能再?nbsp;<a >tcpTrace</a>或?a >MSSoapT</a>q样的工hq踪Soap消息?br /> <br />          不过Q好的消息是QW(xu)SE?.0开始就提供?jin)可以追t到SOAP消息的诊断工兗?br /> <img height="553" alt="" src="http://www.aygfsteel.com/images/blogjava_net/zqli/16464/o_Diagnostics-WSE.jpg" width="513" border="0" /><br /> <br /> NEnable Message TraceQ在调试q程中,生成InputTrace.webinfo和OutputTrace.webinfo文gQ里面记录了(jin)我们惌的信息,到此Q不需要借助其他Trace工具便可q踪到Soap消息?br />          </span> <img src ="http://www.aygfsteel.com/zqli/aggbug/174521.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/zqli/" target="_blank">放水老?/a> 2008-01-11 10:17 <a href="http://www.aygfsteel.com/zqli/archive/2008/01/11/174521.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用Soap Toolkit 3.0 Trace Utility跟踪SOAP消息http://www.aygfsteel.com/zqli/archive/2008/01/08/173553.html放水老?/dc:creator>放水老?/author>Tue, 08 Jan 2008 02:32:00 GMThttp://www.aygfsteel.com/zqli/archive/2008/01/08/173553.htmlhttp://www.aygfsteel.com/zqli/comments/173553.htmlhttp://www.aygfsteel.com/zqli/archive/2008/01/08/173553.html#Feedback0http://www.aygfsteel.com/zqli/comments/commentRss/173553.htmlhttp://www.aygfsteel.com/zqli/services/trackbacks/173553.html        Destination   host:localhost
       Destination   port:80 

       Soap Toolkit是客L(fng)和服务器中的一座桥Qlocal   port是Soap   Toolkit的监听端口(所?0端口一般不能用,除非Ҏ(gu)讑֮Q,凡是l过local   port的请求都?x)被截下来,然后由Soap   Toolkit转发到Destination   hostQDestination   port厅R?br />        所以,W(xu)eb Services Client要将端口指定到Trace   Utility的local   port(L讑֮一个端?QTrace   Utility的Destination   port指定到WebService的端口。这P可以截获Soap消息?jin)?

]]>
【{】WS-Addressing 从理论到实践 --- SOA基础规范介绍http://www.aygfsteel.com/zqli/archive/2007/12/27/170969.html放水老?/dc:creator>放水老?/author>Thu, 27 Dec 2007 10:37:00 GMThttp://www.aygfsteel.com/zqli/archive/2007/12/27/170969.htmlhttp://www.aygfsteel.com/zqli/comments/170969.htmlhttp://www.aygfsteel.com/zqli/archive/2007/12/27/170969.html#Feedback0http://www.aygfsteel.com/zqli/comments/commentRss/170969.htmlhttp://www.aygfsteel.com/zqli/services/trackbacks/170969.html

Z(jin)?/span>SOA的应用能够更加的成熟Q一些标准化l织(主要?/span>W3CQ?/span>OASIS)?/span>Web Services的功能进行了(jin)扩展Qؓ(f)此制定了(jin)一pd?/span>WS-*规范。通过q些规范Q?/span>Web Services在实际应用中的能力得C(jin)很大的增强,q些能力主要体现在对服务质量的保障上Q例如安全,可靠性,事务{等。其中,WS-Addressing规范作ؓ(f)一个基Qؓ(f)其余的规范提供了(jin)重要的支持功能,因此有必要在?jin)解其他规范前,首先深入了(jin)?/span>WS-Addressing规范。本文将从概念上介绍该规范,q希望通过WSE3.0的实例来看看该规范是如何被实늚?br />
        理论?br />         WS-Addressing 问题的引?br />         WS-Addressing EndpointReference
        WS-Addressing Message Addressing Properties

        实践?/strong>
        Applied WSE 3.0 to Web Service Project   
        Use Web Service Thought Message --- SoapClient

鉴于SOA的概念ƈ没有为大家所q泛理解Q在适当的时候有必要写一?span style="color: #333399;">SOA乱弹?/span>
不过先请你记住以下几句话Q?br />
SOA is an integration solution.
SOA is message oriented first.
The Key character of SOA is loosely coupled.
SOA is enriched
by creating composite apps.

相关资源Q?br /> Web Services的设计与模式
Web Services Securitypd

参考资料:(x)WS-Addressing Specification



]]>
[转]WSDL(Web服务描述语言)详细解析http://www.aygfsteel.com/zqli/archive/2007/12/27/170967.html放水老?/dc:creator>放水老?/author>Thu, 27 Dec 2007 10:34:00 GMThttp://www.aygfsteel.com/zqli/archive/2007/12/27/170967.htmlhttp://www.aygfsteel.com/zqli/comments/170967.htmlhttp://www.aygfsteel.com/zqli/archive/2007/12/27/170967.html#Feedback0http://www.aygfsteel.com/zqli/comments/commentRss/170967.htmlhttp://www.aygfsteel.com/zqli/services/trackbacks/170967.html一QWSDL定义

    WSDL是一个用于精描qWeb服务的文档,W(xu)SDL文档是一个遵循WSDL XML模式的XML文档。WSDL 文档Web服务定义为服务访问点或端口的集合。在 WSDL 中,׃服务讉K点和消息的抽象定义已从具体的服务部v或数据格式绑定中分离出来Q因此可以对抽象定义q行再次使用Q消息,指对交换数据的抽象描qͼ而端 口类型,指操作的抽象集合。用于特定端口类型的具体协议和数据格式规范构成了(jin)可以再次使用的绑定。将Web讉K地址与可再次使用的绑定相兌Q可以定义一 个端口,而端口的集合则定义ؓ(f)服务?/p>

   一个WSDL文档通常包含7个重要的元素Q即types、import、message、portType、operation、binding? service元素。这些元素嵌套在definitions元素中,definitions是WSDL文档的根元素。文章的下一部分会(x)详细介绍WSDL 的基本结构?/p>

二:(x)WSDL的基本结?-概述

如第一部分最后描q的那样Q一个基本的WSDL文档包含7个重要的元素。下面将分别介绍q几个元素以?qing)他们的作用?/p>

WSDL 文档在Web服务的定义中使用下列元素Q?/p>

  • Types - 数据cd定义的容器,它用某U类型系l?一般地使用XML Schema中的cdpȝ)?
  • Message - 通信消息的数据结构的抽象cd化定义。用Types所定义的类型来定义整个消息的数据结构?
  • Operation - Ҏ(gu)务中所支持的操作的抽象描述Q一般单个Operation描述?jin)一个访问入口的h/响应消息寏V?
  • PortType - 对于某个讉K入口点类型所支持的操作的抽象集合Q这些操作可以由一个或多个服务讉KҎ(gu)支持?
  • Binding - 特定端口cd的具体协议和数据格式规范的绑定?
  • Port - 定义为协?数据格式l定与具体Web讉K地址l合的单个服务访问点?
  • Service- 相关服务讉K点的集合?

  可以参考下图来理解一下WSDL的文档结构图Q?img alt="WSDL文档元素的结构图" src="http://p.blog.csdn.net/images/p_blog_csdn_net/juxtapose/wsdl-01.gif" />

WSDL的xml schema可以参照如下|址Q?a target="_blank">http://schemas.xmlsoap.org/wsdl/

三:(x)WSDL的基本结?-详述

本节通过一个例子详l描qWSDL文档每个元素的作用。下面一个例子是一个简单的WSDL文档的内容,该文档的产生可以参见我的另外一文章:(x)xfire开发实?-HelloWorld?/a> ?/p>

一个简单的Web Service的WSDL文档Q该服务支持名ؓ(f)sayHello的唯一操作Q该操作通过在http上运?a target="_blank" >SOAP协议来实现的。该h接受一个字W串nameQ经q处理后q回一个简单的字符丌Ӏ文档如下:(x)

<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions
    
targetNamespace="http://com.liuxiang.xfireDemo/HelloService"
    xmlns:tns
="http://com.liuxiang.xfireDemo/HelloService"
    xmlns:wsdlsoap
="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:soap12
="http://www.w3.org/2003/05/soap-envelope"
    xmlns:xsd
="http://www.w3.org/2001/XMLSchema"
    xmlns:soapenc11
="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:soapenc12
="http://www.w3.org/2003/05/soap-encoding"
    xmlns:soap11
="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:wsdl
="http://schemas.xmlsoap.org/wsdl/">
    
<wsdl:types>
        
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            attributeFormDefault
="qualified" elementFormDefault="qualified"
            targetNamespace
="http://com.liuxiang.xfireDemo/HelloService">
            
<xsd:element name="sayHello">
                
<xsd:complexType>
                    
<xsd:sequence>
                        
<xsd:element maxOccurs="1" minOccurs="1"
                            name
="name" nillable="true" type="xsd:string" />
                    
</xsd:sequence>
                
</xsd:complexType>
            
</xsd:element>
            
<xsd:element name="sayHelloResponse">
                
<xsd:complexType>
                    
<xsd:sequence>
                        
<xsd:element maxOccurs="1" minOccurs="1"
                            name
="out" nillable="true" type="xsd:string" />
                    
</xsd:sequence>
                
</xsd:complexType>
            
</xsd:element>
        
</xsd:schema>
    
</wsdl:types>
    
<wsdl:message name="sayHelloResponse">
        
<wsdl:part name="parameters" element="tns:sayHelloResponse" />
    
</wsdl:message>
    
<wsdl:message name="sayHelloRequest">
        
<wsdl:part name="parameters" element="tns:sayHello" />
    
</wsdl:message>
    
<wsdl:portType name="HelloServicePortType">
        
<wsdl:operation name="sayHello">
            
<wsdl:input name="sayHelloRequest"
                message
="tns:sayHelloRequest" />
            
<wsdl:output name="sayHelloResponse"
                message
="tns:sayHelloResponse" />
        
</wsdl:operation>
    
</wsdl:portType>
    
<wsdl:binding name="HelloServiceHttpBinding"
        type
="tns:HelloServicePortType">
        
<wsdlsoap:binding style="document"
            transport
="http://schemas.xmlsoap.org/soap/http" />
        
<wsdl:operation name="sayHello">
            
<wsdlsoap:operation soapAction="" />
            
<wsdl:input name="sayHelloRequest">
                
<wsdlsoap:body use="literal" />
            
</wsdl:input>
            
<wsdl:output name="sayHelloResponse">
                
<wsdlsoap:body use="literal" />
            
</wsdl:output>
        
</wsdl:operation>
    
</wsdl:binding>
    
<wsdl:service name="HelloService">
        
<wsdl:port name="HelloServiceHttpPort"
            binding
="tns:HelloServiceHttpBinding">
            
<wsdlsoap:address
                
location="http://localhost:8080/xfire/services/HelloService" />
        
</wsdl:port>
    
</wsdl:service>
</wsdl:definitions>

♦ types元素使用XML模式语言声明在WSDL文档中的其他位置使用的复杂数据类型与元素Q?/p>

♦ import元素cM于XML模式文档中的import元素Q用于从其他WSDL文档中导入WSDL定义Q?/p>

♦ message元素使用在WSDL文档的type元素中定义或在import元素引用的外部WSDL文档中定义的XML模式的内|类型、复杂类型或元素描述?jin)消息的有效负蝲Q?/p>

♦ portType元素和operation元素描述?jin)Web服务的接口ƈ定义?jin)他的方法。portType元素和operation元素cM? java接口和接口中定义的方法声明。operation元素使用一个或者多个messagecd来定义他的输入和输出的有效负载;

♦ Binding元素portType元素和operation元素赋给一个特D的协议和编码样式;

♦ service元素负责Internet地址赋给一个具体的l定Q?/p>

1、definitions元素

所有的WSDL文档的根元素均是definitions元素。该元素装?jin)整个文档,同时通过其name提供?jin)一个WSDL文档。除?jin)提供一个命名空间外Q该元素没有其他作用Q故不作详细描述?/p>

下面的代码是一个definitions元素的结构:(x)

<wsdl:definitions
    
targetNamespace="http://com.liuxiang.xfireDemo/HelloService"
    xmlns:tns
="http://com.liuxiang.xfireDemo/HelloService"
    xmlns:wsdlsoap
="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:soap12
="http://www.w3.org/2003/05/soap-envelope"
    xmlns:xsd
="http://www.w3.org/2001/XMLSchema"
    xmlns:soapenc11
="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:soapenc12
="http://www.w3.org/2003/05/soap-encoding"
    xmlns:soap11
="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:wsdl
="http://schemas.xmlsoap.org/wsdl/">
</wsdl:definitions>

2、types元素

 WSDL采用?jin)W3C XML模式内置cd作ؓ(f)其基本类型系l。types元素用作一个容器,用于定义XML模式内置cd中没有描q的各种数据cd。当声明消息部分的有效负? Ӟ消息定义使用?jin)在types元素中定义的数据cd和元素。在本文的WSDL文档中的types定义Q?/p>

 

<wsdl:types>
        
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            attributeFormDefault
="qualified" elementFormDefault="qualified"
            targetNamespace
="http://com.liuxiang.xfireDemo/HelloService">
            
<xsd:element name="sayHello">
                
<xsd:complexType>
                    
<xsd:sequence>
                        
<xsd:element maxOccurs="1" minOccurs="1"
                            name
="name" nillable="true" type="xsd:string" />
                    
</xsd:sequence>
                
</xsd:complexType>
            
</xsd:element>
            
<xsd:element name="sayHelloResponse">
                
<xsd:complexType>
                    
<xsd:sequence>
                        
<xsd:element maxOccurs="1" minOccurs="1"
                            name
="out" nillable="true" type="xsd:string" />
                    
</xsd:sequence>
                
</xsd:complexType>
            
</xsd:element>
        
</xsd:schema>
    
</wsdl:types>

上面是数据定义部分,该部分定义了(jin)两个元素Q一个是sayHelloQ一个是sayHelloResponseQ?/p>

sayHelloQ定义了(jin)一个复杂类型,仅仅包含一个简单的字符Ԍ来用来描述操作的参入传入部分;

sayHelloResponseQ定义了(jin)一个复杂类型,仅仅包含一个简单的字符Ԍ来用来描述操作的返回|

3、import元素

import元素使得可以在当前的WSDL文档中用其他WSDL文档中指定的命名I间中的定义元素。本例子中没有用import元素。通常在用户希望模块化WSDL文档的时候,该功能是非常有效果的?/p>

import的格式如下:(x)

必须有namespace属性和location属性:(x)

namespace属性:(x)值必M正导入的WSDL文档中声明的targetNamespace相匹配;

location属性:(x)必须指向一个实际的WSDL文档Qƈ且该文档不能为空?/p>

4、message元素

message元素描述?jin)Web服务使用消息的有效负载。message元素可以描述输出或者接受消息的有效负蝲Q还可以描述SOAP文g头和错误detail元素的内宏V定义message元素的方式取决于使用RPC样式q是文档样式的消息传递。在本文中的message元素的定义,本文档用了(jin)采用文档样式的消息传递:(x)

<wsdl:message name="sayHelloResponse">
        
<wsdl:part name="parameters" element="tns:sayHelloResponse" />
    
</wsdl:message>
    
<wsdl:message name="sayHelloRequest">
        
<wsdl:part name="parameters" element="tns:sayHello" />
    
</wsdl:message>

该部分是消息格式的抽象定义:(x)定义?jin)两个消息sayHelloResponse和sayHelloRequestQ?/p>

sayHelloRequestQsayHello操作的请求消息格式,׃个消息片断组成,名字为parameters,元素是我们前面定义的types中的元素Q?/p>

sayHelloResponseQsayHello操作的响应消息格式,׃个消息片断组成,名字为parameters,元素是我们前面定义的types中的元素Q?/p>

 如果采用RPC样式的消息传递,只需要将文档中的element元素应以修改为type卛_?/p>

5、portType元素

portType元素定义?jin)Web服务的抽象接口。该接口有点cMJava的接口,都是定义?jin)一个抽象类型和Ҏ(gu)Q没有定义实现。在WSDL中, portType元素是由binding和service元素来实现的Q这两个元素用来说明Web服务实现使用的Internet协议、编码方案以? Internet地址?/p>

一个portType中可以定义多个operationQ一个operation可以看作是一个方法,本文中WSDL文档的定义:(x)

    <wsdl:portType name="HelloServicePortType">
        
<wsdl:operation name="sayHello">
            
<wsdl:input name="sayHelloRequest"
                message
="tns:sayHelloRequest" />
            
<wsdl:output name="sayHelloResponse"
                message
="tns:sayHelloResponse" />
        
</wsdl:operation>
    
</wsdl:portType>

portType定义?jin)服务的调用模式的类型,q里包含一个操作sayHelloҎ(gu)Q同时包含input和output表明该操作是一个请求/? 应模式,h消息是前面定义的sayHelloRequestQ响应消息是前面定义的sayHelloResponse。input表示传递到Web服务 的有效负载,output消息表示传递给客户的有效负载?/p>

Q、binding

binding元素一个抽象portType映射Cl具体协?SOAO和HTTP)、消息传递样式、编码样式。通常binding元素与协议专有的元素和在一起用,本文中的例子Q?/p>

    <wsdl:binding name="HelloServiceHttpBinding"
        type
="tns:HelloServicePortType">
        
<wsdlsoap:binding style="document"
            transport
="http://schemas.xmlsoap.org/soap/http" />
        
<wsdl:operation name="sayHello">
            
<wsdlsoap:operation soapAction="" />
            
<wsdl:input name="sayHelloRequest">
                
<wsdlsoap:body use="literal" />
            
</wsdl:input>
            
<wsdl:output name="sayHelloResponse">
                
<wsdlsoap:body use="literal" />
            
</wsdl:output>
        
</wsdl:operation>
    
</wsdl:binding>

q部分将服务讉K点的抽象定义?a target="_blank" >SOAP HTTPl定Q描q如何通过SOAP/HTTP来访问按照前面描q的讉K入口点类型部|的讉K入口。其中规定了(jin)在具?a target="_blank" ?/p>

具体的用需要参考特定协议定义的元素?/p>

Q、service元素和port元素

service元素包含一个或者多个port元素Q其中每个port元素表示一个不同的Web服务。port元素URL赋给一个特定的bindingQ甚臛_以两个或者多个port元素不同的URL赋值给相同的binding。文档中的例子:(x)

    <wsdl:service name="HelloService">
        
<wsdl:port name="HelloServiceHttpPort"
            binding
="tns:HelloServiceHttpBinding">
            
<wsdlsoap:address
                
location="http://localhost:8080/xfire/services/HelloService" />
        
</wsdl:port>
    
</wsdl:service>

q部分是具体的Web服务的定义,在这个名为HelloService的Web服务中,提供?jin)一个服务访问入口,讉K地址?a href="http://localhost:8080/xfire/services/HelloService" target="_blank">http://localhost:8080/xfire/services/HelloServiceQ用的消息模式是由前面的binding所定义的?/p>

  本文单介l了(jin)WSDL规范的用途,基本l构和用方法,希望对大家学?fn)WSDL有帮助?/p>

]]>
վ֩ģ壺 | ۶| | Ӵ| ֽ| ˮ| | | | | | | | ƽ| ¡| | | | ̨| | | Ϸ| | г| ̺| | | | ̫| ƽ| ײ| | Ƥɽ| | | | | ҵ| ̩| | Ӧ|