借助jdk的wsimort.exe工具生成客户端代码 格式:wsimport -keep url   //url为wsdl文件的路径

直接生成客户端代码会抛异常, 无法生成客户端代码, 解决办法:

  1. 将对应的wsdl文档保存到本地
  2. 修改wsdl文档的部分内容:

 <s:element ref="s:schema" /><s:any /> 替换成 <s:any minOccurs="2" maxOccurs="2"/>

备注: 这个是Java调用net的webservice都有的问题

<?xml version='1.0' encoding='UTF-8'?>
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://ws.day01_ws.atguigu.com/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:ns1="http://schemas.xmlsoap.org/soap/http"
name="HelloWSImplService"
targetNamespace="http://ws.day01_ws.atguigu.com/">
<!--
types
schema : 定义了一些标签结构
-->
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://ws.day01_ws.atguigu.com/" elementFormDefault="unqualified"
targetNamespace="http://ws.day01_ws.atguigu.com/" version="1.0"> <!--
//用于请求
<sayHello>
<arg0>string</arg0>
</sayHello>
<q0:sayHello>
<arg0>BB</arg0>
</q0:sayHello> //用于响应
<sayHelloResponse>
<return>string</return>
</sayHelloResponse>
<ns2:sayHelloResponse">
<return>Hello BB</return>
</ns2:sayHelloResponse>
--> <xs:element name="sayHello" type="tns:sayHello" />
<xs:element name="sayHelloResponse" type="tns:sayHelloResponse" />
<xs:complexType name="sayHello">
<xs:sequence>
<xs:element minOccurs="" name="arg0" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="sayHelloResponse">
<xs:sequence>
<xs:element minOccurs="" name="return" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types> <!--
message: 用来定义消息的结构 soap消息
part : 指定引用types中定义的标签片断
--> <wsdl:message name="sayHelloResponse">
<wsdl:part element="tns:sayHelloResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="sayHello">
<wsdl:part element="tns:sayHello" name="parameters">
</wsdl:part>
</wsdl:message> <!--
portType: 用来定义服务器端的SEI
operation : 用来指定SEI中的处理请求的方法
input : 指定客户端应用传过来的数据, 会引用上面的定义的<message>
output : 指定服务器端返回给客户端的数据, 会引用上面的定义的<message>
-->
<wsdl:portType name="HelloWS">
<wsdl:operation name="sayHello">
<wsdl:input message="tns:sayHello" name="sayHello">
</wsdl:input>
<wsdl:output message="tns:sayHelloResponse" name="sayHelloResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType> <!--
binding : 用于定义SEI的实现类
type属性: 引用上面的<portType>
<soap:binding style="document"> : 绑定的数据是一个document(xml)
operation : 用来定义实现的方法
<soap:operation style="document" /> 传输的是document(xml)
input: 指定客户端应用传过来的数据
<soap:body use="literal" /> : 文本数据
output : 指定服务器端返回给客户端的数据
<soap:body use="literal" /> : 文本数据
--> <wsdl:binding name="HelloWSImplServiceSoapBinding" type="tns:HelloWS">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="sayHello">
<soap:operation soapAction="" style="document" />
<wsdl:input name="sayHello">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="sayHelloResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding> <!--
service : 一个webservice的容器
name属性: 它用一指定客户端容器类
port : 用来指定一个服务器端处理请求的入口(就SEI的实现)
binding属性: 引用上面定义的<binding>
address : 当前webservice的请求地址
-->
<wsdl:service name="HelloWSImplService">
<wsdl:port binding="tns:HelloWSImplServiceSoapBinding" name="HelloWSImplPort">
<soap:address location="http://192.168.10.165:8888/day01_ws/hellows" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

总体就是下面这个结构:

<definitions>

              <types>

                     <schema>

                            <element>

              </types>

              <message>

                     <part>

</message>

              <portType>

                     <operation>

                            <input>

                            <output>

</portType>

              <binding>

                     <operation>

                            <input>

                            <output>

</binding>

              <service>

                     <port>

                            <address>

</service>

</definitions>

文档结构图:

WSDL文档深入分析的更多相关文章

  1. 【WebService】WebService之WSDL文档深入分析(三)

    WSDL概念 WSDL(网络服务描述语言,Web Services Description Language)是一门基于 XML 的语言,用于描述 Web Services 以及如何对它们进行访问. ...

  2. WSDL 文档解析

    学习webservice,就离不了WSDL文档,他是我们开发WebService的基础,虽说,现在现在有许多WebService的开源框架使得我们可以根据WSDL生成客户端代码,但是,了解WSDL文档 ...

  3. 【Web Service】WSDL文档

    WSDL文档仅仅是一个简单的XML文档. 它包含一系列描述某个web service的定义. WSDL WSDL 是基于 XML 的语言,用于描述 Web services 以及如何访问它们. WSD ...

  4. 利用wsdl.exe自动将wsdl文档转换为C#代码

    1.获取完整的wsdl文档 获取下面这个博客中提到的wsdl http://www.cnblogs.com/LCCRNblog/p/3716406.html 将获取到的wsdl放到一个文本中,改后缀( ...

  5. webservice学习01:wsdl文档结构

    webservice学习01:wsdl文档结构 wsdl文档结构 WSDL文档示例 <wsdl:definitions xmlns:xsd="http://www.w3.org/200 ...

  6. WSDL 文档-一个简单的 XML 文档

    WSDL 文档是利用这些主要的元素来描述某个 web service 的: <portType>-web service 执行的操作 <message>-web service ...

  7. 一个完整的WSDL文档及各标签详解

    <?xml version="1.0" encoding="UTF8" ?> <wsdl:definitions targetNamespac ...

  8. 11.修改WSDL文档

    http://localhost:8077/person?wsdl可以由你来控制的.拿Person这个例子来说.

  9. WSDL文档

    portType 相当于一个类. operation 相当于该类里有一个方法名,方法名为processAPNManagement,该方法里有一个输入消息,一个输出消息,一个错误消息.

随机推荐

  1. Xamarin.Forms的相对布局RelativeLayout

    Xamarin.Forms的相对布局RelativeLayout   相对布局RelativeLayout是App中常用的布局方式.它是以界面中的某个元素为基准,设置另外一个元素的位置和大小.通过这种 ...

  2. String,StringBuffer,StringBuilder源码分析

    1.类结构 String Diagrams StringBuffer Diagrams StringBuilder Diagrams 通过以上Diagrams可以看出,String,StringBuf ...

  3. eclipse 五种断点

    1. Line BreakpointLine Breakpoin是最简单的Eclipse断点,只要双击某行代码对应的左侧栏,就对该行设置上断点. 2. WatchpointLine Breakpoin ...

  4. xshell登陆腾讯云服务器

    2016-12-11   00:17:36 前段时间在同学的介绍下关注了一下腾讯云:然后里面有学生优惠可以拿到免费的域名和云服务器.所以感兴趣就实验了一下,今天中午抢到了“1元特惠的学生包”,里面有免 ...

  5. C#报错"线程间操作无效: 从不是创建控件“XXX”的线程访问它"--解决示例

    C# Winform程序中,使用线程对界面进行更新需要特殊处理,否则会出现异常“线程间操作无效: 从不是创建控件“taskView”的线程访问它.” 在网文“http://www.cnblogs.co ...

  6. 利用Python自动发送邮件

    # -*- coding:utf-8 -*-from email.mime.text import MIMETextfrom email.header import Headerimport smtp ...

  7. vue2.0 + vux (一)Header 组件

    1.main.js import Vue from 'vue' import FastClick from 'fastclick' import VueRouter from 'vue-router' ...

  8. d3js 获取元素以及设置属性

    <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8&quo ...

  9. 3.nginx反向代理服务器+负载均衡

    nginx反向代理服务器+负载均衡 用nginx做反向代理和负载均衡非常简单, 支持两个用法: 1个proxy, 1个upstream,分别用来做反向代理,和负载均衡 以反向代理为例, nginx不自 ...

  10. 爬虫基本操作、requests和BeautifulSoup

    1. 爬虫基本操作 例如舆情系统: 获取汽车之家新闻放到自己数据库里,创建自己的app,发布内容,注明来源,自己创业. URL指定内容获取到 - 发送Http请求:http://www.autohom ...