---
title: "wsdl文件的portType和binding的关系"
author: "bleet"
date: "2010-07-12T22:13:12Z"
tags: []
categories: ["企业架构"]
slug: "wsdl-porttype-binding"
draft: false
lastmod: "2010-07-12T22:14:51Z"
id: 711109
url: "https://bleet.iteye.com/blog/711109"
---

本文所有描述参照一下wsdl文件：

```java

<message name="getTermRequest">
   <part name="term" type="xs:string" />
</message>

<message name="getTermResponse">
   <part name="value" type="xs:string" />
</message>

<portType name="glossaryTerms">
  <operation name="getTerm">
      <input message="getTermRequest" />
      <output message="getTermResponse" />
  </operation>
</portType>

<binding type="glossaryTerms" name="b1">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
  <operation>
    <soap:operation
     soapAction="http://example.com/getTerm" />
    <input>
      <soap:body use="literal" />
    </input>
    <output>
      <soap:body use="literal" />
    </output>
  </operation>
</binding>

```


所谓portType，好多人翻译为端口，实在是让人不好理解，我觉得就是这个wsdl提供的操作之一嘛，就是一个远程调用的方法

而所谓binding就是绑定啦，那么绑定肯定是把某某东西绑定到XX东西上，这里某某就是消息的格式和协议的细节，XX就是刚才的portType，即我说的远程调用方法

总体就是把消息的格式和协议的细节绑定到远程调用方法上，那么也就是给远程调用方法设置消息格式和协议细节。

这就是portType和binding的关系