如何设置wsdl文件 工程中使用中的minoccurs

12370人阅读
编程开发(38)
ServiceMessageReceiverInOut 99 -&
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement GROUPID
解决:webservice接口soap请求报文的xml字段顺序必须与wsdl中定义的顺序一致才能解析正确
wsdl中顺序:&xsd:element minOccurs=&0& name=&GROUPID& type=&xsd:string&/&
&xsd:element minOccurs=&0& name=&SERVICETYPE& type=&xsd:string&/&
&xsd:element minOccurs=&0& name=&EID& type=&xsd:string&/&
参考:http://bbs.csdn.net/topics/
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:378893次
积分:4006
积分:4006
排名:第8916名
原创:73篇
转载:18篇
评论:27条
(2)(1)(3)(1)(2)(1)(3)(2)(4)(2)(4)(7)(2)(3)(3)(1)(4)(2)(1)(2)(1)(3)(6)(4)(7)(8)(2)(1)(3)(2)(2)(2)
(window.slotbydup = window.slotbydup || []).push({
id: '4740881',
container: s,
size: '200,200',
display: 'inlay-fix'7717人阅读
Web Service(1)
WSDL(Web Service Description Language)Web服务描述语言
################################################################################
适用于描述WebService的文档格式
下面例子是为了输入一个字符串name,返回一个SayHello的操作。
&?xml&version=&1.0&&encoding=&UTF-8&&?&
&wsdl:definitions
&&&&targetNamespace=&http://com.liuxiang.xfireDemo/HelloService&-------------------DEFINITIONS:WSDL文档根元素,提供命名空间
&&&&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&-------------------------------------------------------------------------------------TYPE:数据类型定义的容器,TYPE定义了两个元
&&&&&&&&&xsd:schema&xmlns:xsd=&http://www.w3.org/2001/XMLSchema&
素,一个是sayHello,一个是sayHelloResp
&&&&&&&&&&&&attributeFormDefault=&qualified&&elementFormDefault=&qualified&
&&&&&&&&&&&&targetNamespace=&http://com.liuxiang.xfireDemo/HelloService&&
&&&&&&&&&&&&&xsd:element&name=&sayHello&&----------------------------------------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&&---------------------------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&&----------------------------------------------MESSAGE:通信消息的数据结构的抽象化定义,描
&&&&&&&&&wsdl:part&name=&parameters&&element=&tns:sayHelloResponse&&/&
& & & & & & & & & & & & & & & & & & & &&述了Web服务使用消息的有效负载,
&&&&&/wsdl:message&
& &&还可描述输出或接受消息的有效负载
&&&&&wsdl:message&name=&sayHelloRequest&&
,其中ELEMENT对应TYPE中的NAME。定义元
&&&&&&&&&wsdl:part&name=&parameters&&element=&tns:sayHello&&/&&
& &&素的方式取决于使用RPC样式或文档样式,此处
&&&&&/wsdl:message&
& &&为文档样式
&&&&&wsdl:portType&name=&HelloServicePortType&&------------------------------------------PORTTYPE:对于某个访问入口点类型所支持的操
&&&&&&&&&wsdl:operation&name=&sayHello&&&
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &
作的抽象集合,一个portType可定义多
&&&&&&&&&&&&&wsdl:input&name=&sayHelloRequest&
& & &个operation,一个operation可看做一
&&&&&&&&&&&&&&&&message=&tns:sayHelloRequest&&/&
& & &个方法,请求消息是MESSAGE定义的
&&&&&&&&&&&&&wsdl:output&name=&sayHelloResponse&
& & &sayHelloRequest,相应消息是
&&&&&&&&&&&&&&&&message=&tns:sayHelloResponse&&/&
& & &sayHelloResponse,同时包含input
&&&&&&&&&/wsdl:operation&
& & &/output表明这是一个请求/响应模式,
&&&&&/wsdl:portType&
& & &input表示传递到Web服务的有效负
& & &&载,output表示传递到客户的有效负
& & &&载.此处TNS为DEFINITIONS中所声
& & & 明。
&&&&&wsdl:binding&name=&HelloServiceHttpBinding&--------------------------------------------BINDING:特定端口类型的具体协议和数据格式规
&&&&&&&&type=&tns:HelloServicePortType&&
范的绑定,binding将一个抽象porType映
&&&&&&&&&wsdlsoap:binding&style=&document&
射到一组具体协议(SOAP/HTTP),消息传
&&&&&&&&&&&&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&&----------------------------------------------------------SERVICE:相关服务访问点的集合,一个service元
&&&&&&&&&wsdl:port&name=&HelloServiceHttpPort&
& &&素包含多个不同的port,每个port表示
&&&&&&&&&&&&binding=&tns:HelloServiceHttpBinding&&
& &&不同的Web服务,此例子中提供给访
&&&&&&&&&&&&&wsdlsoap:address
& &&问你的地址为:http://localhost:8080/xf.
&&&&&&&&&&&&&&&&location=&http://localhost:8080/xfire/services/HelloService&&/&
& & &.....
&&&&&&&&&/wsdl:port&
&&&&&/wsdl:service&
&/wsdl:definitions&
IMPORT:可以让当前WSDL文档中引用其他WSDL文档中指定命名空间中的元素,通常用于WSDL模块化。
&wsdl:import&namespace=&http://xxx.xxx.xxx/xxx/xxx&&location=&http://xxx.xxx.xxx/xxx/xxx.wsdl&/&
namespace属性:必须与所导入文件的targetNameSpace名称相同.
location属性:指向wsdl文件的路径,不能为空.
附WSDL文档结构图-------
以上这些就是基本的一些要点,,,如果有误,请各位大爷批评指正,,,
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:331577次
积分:1352
积分:1352
排名:千里之外
原创:19篇
转载:15篇
评论:23条
(1)(7)(2)(8)(5)(3)(5)(4)
(window.slotbydup = window.slotbydup || []).push({
id: '4740881',
container: s,
size: '200,200',
display: 'inlay-fix'本帖子已过去太久远了,不再提供回复功能。1.WSDL 文档仅仅是一个简单的 XML 文档。它包含一系列描述某个 web service 的定义&&&&&&
2.一个WSDL文档通常包含7个重要的元素,即types、import、message、portType、operation、binding、
service元素。这些元素嵌套在definitions元素中,definitions是WSDL文档的根元素。
WSDL&文档在Web服务的定义中使用下列元素:(并没有看懂)
Types&- 数据类型定义的容器,它使用某种类型系统(一般地使用XML Schema中的类型系统)。
Message&- 通信消息的数据结构的抽象类型化定义。使用Types所定义的类型来定义整个消息的数据结构。
Operation&- 对服务中所支持的操作的抽象描述,一般单个Operation描述了一个访问入口的请求/响应消息对。
PortType&- 对于某个访问入口点类型所支持的操作的抽象集合,这些操作可以由一个或多个服务访问点来支持。
Binding&- 特定端口类型的具体协议和数据格式规范的绑定。
Port&- 定义为协议/数据格式绑定与具体Web访问地址组合的单个服务访问点。
Service- 相关服务访问点的集合。
一个简单的Web Service的WSDL文档,该服务支持名为sayHello的唯一操作,该操作通过在http上运行P协议来实现的。该请求接受一个字符串name,经过处理后返回一个简单的字符串。文档如下:
&?xml&version=&1.0&&encoding=&UTF-8&&?&
&wsdl:definitions
&&&&targetNamespace=&
&&&&xmlns:tns=&
&&&&xmlns:wsdlsoap=&
&&&&xmlns:soap12=&
&&&&xmlns:xsd=&
&&&&xmlns:soapenc11=&
&&&&xmlns:soapenc12=&
&&&&xmlns:soap11=&
&&&&xmlns:wsdl=&&
&!--types中 name描述的是方法的名称(sayhello),sequence中的是参数(name1:String类型,name2:String类型),type中定义的是参数类型,响应信息(sayhelloResponse)--!&
&&&&&wsdl:types&
&&&&&&&&&xsd:schema&xmlns:xsd=&
&&&&&&&&&&&&attributeFormDefault=&qualified&&elementFormDefault=&qualified&
&&&&&&&&&&&&targetNamespace=&&
&!--定义的方法,将来用来描述操作的参入传入部分--!&
&&&&&&&&&&&&&xsd:element&name=&sayHello&&
&&&&&&&&&&&&&&&&&xsd:complexType&
&&&&&&&&&&&&&&&&&&&&&xsd:sequence&
&&&&&&&&&&&&&&&&&&&&&&&&&xsd:element&maxOccurs=&1&&minOccurs=&1&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&name=&name1&&nillable=&true&&type=&xsd:string&&/&
&&&&&&&&&&&&&&&&&&&&&&&&xsd:element&maxOccurs=&1&&minOccurs=&1&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&name=&name2&&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&
&!--message元素指定XML&数据类型组成消息的各个部分。message元素用于定义操作的输入和输出参数--!&
如果采用RPC样式的消息传递,只需要将文档中的element元素应以修改为type即可。
&!--sayHelloRequest:sayHello操作的请求消息格式,由一个消息片断组成,名字为parameters--!&
&&&&&wsdl:message&name=&sayHelloResponse&&
&&&&&&&&&wsdl:part&name=&parameters&&element=&tns:sayHelloResponse&&/&
&&&&&/wsdl:message&
&!--sayHelloRequest:sayHello操作的响应消息格式,由一个消息片断组成,名字为parameters--!&
&&&&&wsdl:message&name=&sayHelloRequest&&
&&&&&&&&&wsdl:part&name=&parameters&&element=&tns:sayHello&&/&
&&&&&/wsdl:message&
&!--portType元素和operation元素描述了Web服务的接口并定义了他的方法。portType元素和operation元素类似于 java接口和接口中定义的方法声明--!&
portType元素中定义了Web服务的操作。操作定义了输入和输出数据流中可以出现的XML消息。
&*&一些抽象操作的集合。每个操作关联一个输入消息和一个输出消息
&&&&&wsdl:portType&name=&HelloServicePortType&&
&&&&&&&&&wsdl:operation&name=&sayHello&&
&!--portType定义了服务的调用模式的类型,这里包含一个操作sayHello方法,同时包含input和output表明
&*&该操作是一个&请求/响应模式,请求消息是前面定义的sayHelloRequest,
&*&响应消息是前面定义的&sayHelloResponse。input表示传递到Web服务的有效负载,&&*output消息表示传递给客户的有效负载。--!&
&&&&&&&&&&&&&wsdl:input&name=&sayHelloRequest&
&&&&&&&&&&&&&&&&message=&tns:sayHelloRequest&&/&
&&&&&&&&&&&&&wsdl:output&name=&sayHelloResponse&
&&&&&&&&&&&&&&&&message=&tns:sayHelloResponse&&/&
&&&&&&&&&/wsdl:operation&
&&&&&/wsdl:portType&
&!--binding&元素描述特定服务接口的协议、数据格式、安全性和其它属性。&&&*&针对操作和portType中使用的消息指定实际的协议和数据格式规范--!&
&&&&&wsdl:binding&name=&HelloServiceHttpBinding&
&&&&&&&&type=&tns:HelloServicePortType&&
&&&&&&&&&wsdlsoap:binding&style=&document&
&&&&&&&&&&&&transport=&&/&
&&&&&&&&&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&
&!--service元素。服务元素包含一组port元素。端口将端点与来自服务接口定义的binding&元素关联起来。& port指定一个绑定的地址,这样定义一个通信的终端。--!&
&&&&&wsdl:service&name=&HelloService&&
&&&&&&&&&wsdl:port&name=&HelloServiceHttpPort&
&&&&&&&&&&&&binding=&tns:HelloServiceHttpBinding&&
&&&&&&&&&&&&&wsdlsoap:address
&&&&&&&&&&&&&&&&location=&&/&
&&&&&&&&&/wsdl:port&
&&&&&/wsdl:service&
&/wsdl:definitions&
本文已收录于以下专栏:
相关文章推荐
通俗的讲:WSDL文档描述了Web Service如下3个方面:
WHAT--该 Web Service包含&什么&操作
HOW--该 Web Service的操作应该&怎样&调用
解析以下内容均来自尚硅谷
&wsdl:definitions xmlns:xsd=&http://www.w3.org/2001/XMLSchema&
xmlns:wsdl=&http://s...
Order.java
package com.
import javax.xml.bind.annotation.XmlE
public class Order ...
一、下载apache-cfx.zip,解压后将lib下的jar包添加到工程(服务器端),启动服务器,拿到wsdl,拷贝到客户端。
二、在apache-cfx.zip解压后的文件中有一个bin目录下的...
WSDL的主要文档元素
WSDL文档可以分为两部分。顶部分由抽象定义组成,而底部分则由具体描述组成。抽象部分以独立于平台和语言的方式定义SOAP消息,它们并不包含任何随机器或语言而变的元素。这就定义...
WSDL文档案例
WSDL文档结构
a. portType : 
i. 它可描述一个 web service、可被执行的操作,以及相关的消息。
ii. 可以把
作为webservice客户端开发,在日常工作中可能经常会拿到一个对方提供的wsdl地址或文档,那么拿到这个地址后我们如何编写客户端调用代码呢,前面几篇只是以个人经验的方式写了下,那么真正要根据wsd...
他的最新文章
讲师:汪剑
讲师:刘道宽
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)本帖子已过去太久远了,不再提供回复功能。

我要回帖

更多关于 wsdl中element 的type 的文章

 

随机推荐