`
290434409
  • 浏览: 27006 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

soap协议版本引发的血案

阅读更多

    利用HTTP+POST发送基于SOAP协议的XML,总是报错 Transport level information does not match with SOAP Message namespace URI;看上去是找不到命名空间,穷尽各种办法,不能解决。然后重新看了一遍SOAP协议规范也未见成果。最后,意外中找到了SOAP的英文说明文档,其中描述:

Using SOAP Namespace
Every XML message contains namespaces to properly qualify the entities within it. In SOAP 1.1 and SOAP 1.2 specifications, each had defined its own unique namespaces to define the entities belonging to those specifications.
 
 
 
This is the easiest and sometimes the only method some people use. You can look at the SOAP namespace of a SOAP message and easily determine its version.
 
 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    <soapenv:Header>
        .........
    </soapenv:Header>
    <soapenv:Body>
        ....
    </soapenv:Body>
</soapenv:Envelope>
SOAP 1.1 message
 
You might argue that this is the only method you need to know to differentiate two different SOAP versions. This might not be the case all the time. For example, there can be a situation where you will need to know the SOAP version even before reading the SOAP message itself. Even though the previous statement seems unusual, this is how it is when we have two different object models or two different builders for the two SOAP versions. In such situations, as a developer, you cannot afford to touch the SOAP message to find out the version. Perhaps you can cheat by temporarily recording the first few events or entities, but that might not be the best solution.
 
In the next section, we will use transport binding rules, if available, to differentiate between the two different versions.

看完此段,才知SOAP协议现在又1.2和1.1两个版本,之前一直以为一个。。。。然后又发现了。。。
A: When Apache Axis2/Java receives a SOAP message, Axis2 tries to determine the SOAP version this message adheres to. This is required for the validation purposes against the correct SOAP specification. Axis2 has two basic mechanisms to identify the SOAP version.
 
1. Checking the namespace of the SOAP envelope. If the namespace is "http://schemas.xmlsoap.org/soap/envelope/", then it is a SOAP 1.1 message, and if the namespace is "http://www.w3.org/2003/05/soap-envelope", then it is a SOAP 1.2 message.
 
2.If the transport medium is HTTP, Then we check for the existance of SOAPAction HTTP Header. If the message is SOAP 1.1, then there must be a SOAPAction HTTP header. If it is a SOAP 1.2 message, then there may be a SOAPAction parameter inside the Content-type header (this parameter is not mandatory according to SOAP 1.2 specification HTTP binding)
 
When both the above parameters are present, Axis2 compares the outputs from those evaluations. If they do not match, then Axis2 will throw an error saying "Transport level information does not match with SOAP Message namespace URI". So if you encounter this error, check your SOAP message and HTTP headers.
 
看完此段恍然大悟。。。遇到的问题正如黑体字描述所说,然后:
SOAP 1.2 uses "application/soap+xml" as Content-Type and SOAP 1.1 uses "text/xml".SOAP 1.2 does not use SOAPAction header line. SOAP 1.2 uses "http://www.w3.org/2003/05/soap-envelope" as the envolope namespace and SOAP 1.1 uses "http://schemas.xmlsoap.org/soap/envelope/".
问题得以解决。 
 

感谢初中英语老师,感谢高中英语老师,感谢大学英语老师。 
 

 

5
1
分享到:
评论

相关推荐

    SOAP资料,介绍SOAP协议

    了解SOAP协议不仅有助于理解Web服务的工作原理,还能帮助开发者在需要构建跨平台、跨语言的应用时选择合适的通信方式。深入学习SOAP协议,包括其消息结构、错误处理机制以及与WSDL和UDDI的协同工作,对于提升Web服务...

    SOAP协议规范——SOAP详解

    **SOAP协议规范详解** SOAP(Simple Object Access Protocol),即简单对象访问协议,是一种基于XML(Extensible Markup Language)的协议,用于在Web服务中传递结构化的和格式化的信息。SOAP允许应用程序通过HTTP...

    SOAP协议规范

    SOAP协议有多个版本,最常见的是SOAP 1.1和SOAP 1.2。SOAP 1.2在SOAP 1.1的基础上做了很多改进,包括更严格的XML语法、增强的错误处理机制以及对WS-*标准的支持。 **7. SOAP与REST的比较** SOAP以其严谨的协议规范...

    SOAP协议最新规范文档

    SOAP协议由三个主要部分组成: 1. **SOAP封装**:这部分定义了消息的内容结构,包括消息头和消息体。消息头可以包含元数据,如安全信息、路由指令等,而消息体则包含实际的数据。封装确保了消息的完整性和指定处理...

    Soap协议详细介绍

    SOAP以XML形式提供了一个简单、轻量的用于在分散或分布环境中交换结构化和类型信息的机制。SOAP本身并没有定义任何应用程序语 义 ,如编程模型或特定语义的实现;实际上它通过提供一个有标准组件的包模型和在模块中...

    C语言版soap协议栈源代码

    C语言版的SOAP协议栈是实现SOAP通信的基础组件,能够帮助开发者处理SOAP消息的编码、解码和传输。 在C语言版的SOAP协议栈中,通常包含以下关键组成部分: 1. **SOAP消息处理**:这部分代码负责构建和解析SOAP消息...

    简洁、易懂的SOAP协议介绍—PPT

    什么是SOAP协议? SOAP协议用来干什么的? SOAP协议怎么使用? 这个PPT对这些问题进行了阐述(非常简洁、易懂!)

    soap协议规范 soap协议规范

    SOAP协议的设计目标是简单性和可扩展性,因此它并不包含传统消息系统和分布式对象系统的一些特性,例如分布式碎片收集、批量消息传输、对象引用和激活机制。 SOAP协议由三个核心部分组成: 1. **SOAP封装**:这...

    浅谈soap协议

    ### 浅谈SOAP协议 #### 一、为什么需要SOAP? 随着信息技术的发展,现代企业的信息化建设面临着日益复杂的挑战。为了应对这种复杂性,企业需要构建一套兼容性强、支持多平台、多系统的解决方案。这意味着信息系统...

    SOAP协议详解

    **SOAP协议详解** SOAP,全称为Simple Object Access Protocol,即简单对象访问协议,是一种轻量级的、基于XML的协议,用于在Web上交换结构化的和类型化的信息。SOAP允许不同平台上的应用程序通过HTTP或其他传输...

    SOAP协议规范(中文版).doc

    SOAP协议主要包含了以下几个核心概念: 1. **SOAP消息**:SOAP消息是通过HTTP或SMTP等传输协议发送的基本单元,它是一个XML文档,包含头部(Header)和主体(Body)两部分。头部可以包含额外的信息,如安全、路由等...

    Java SOAP协议

    ### Java SOAP协议详解 #### 一、概述与背景 SOAP(Simple Object Access Protocol)是一种轻量级协议,用于在分布式环境中进行数据交换。SOAP最初由IBM、Microsoft等公司在1998年提出,并随后被标准化为W3C推荐...

    soap协议规范

    ### SOAP协议规范详解 #### 一、SOAP协议概述 SOAP(Simple Object Access Protocol)协议是一种基于XML的标准协议,用于在分散或分布环境中交换结构化和类型化的信息。它旨在为不同平台之间的通信提供一个轻量级...

    SOAP协议规范(中文)

    SOAP协议规范,从网上找到的,备份一下。

    webservice 调用实例soap协议

    在本实例中,我们将深入探讨如何使用SOAP协议进行Web服务调用,以及解析XML文档的过程。 首先,理解SOAP协议的关键在于其结构。一个SOAP消息通常包含三个主要部分:SOAP Envelope、SOAP Header和SOAP Body。SOAP ...

    http&soap协议详解

    **SOAP协议详解** SOAP(Simple Object Access Protocol)简单对象访问协议是一种基于XML的协议,主要用于在分布式环境中交换结构化的、可扩展的信息。SOAP消息主要由三部分组成:Envelope(信封)、Header(头部)...

    MFC实现soap协议并获取监控信息

    本项目中,"MFC实现soap协议并获取监控信息"是指利用MFC库来实现SOAP(Simple Object Access Protocol)协议,从而与监控设备进行通信,获取包括设备、硬件、网络和媒体在内的详细信息。SOAP是一种基于XML的协议,...

    SOAP协议安全性的研究与应用

    【SOAP协议安全性】SOAP(Simple Object Access Protocol)协议是一种基于XML的轻量级通信协议,主要用于Web服务。在Web服务的发展中,SOAP协议的安全性问题成为关注的重点,因为不安全的通信可能导致敏感信息泄露、...

    SOAP协议的WEBservice调用

    SOAP使用的简单例子,和WEBSERVICE使用SOAP协议传输

Global site tag (gtag.js) - Google Analytics