[WebService Test]: 3. SOAP

本文介绍了SOAP(简单对象访问协议)的基本概念及其在Web服务中的应用。作为一种基于XML的数据交换协议,SOAP能够描述方法名、参数类型及返回值等,使Web服务的使用者能够了解其提供的接口和服务。

1. 什么是SOAP ?

SOAP :(simple object access protocol,简单对象访问协议),它是简单,轻量级的信息交换协议。

作用是:数据交换。

语言:基于XML的WSDL语言。它可以描述方法名,参数类型,返回值,调用WebService地址,接口,协议和复杂数据结构(如,数组,结构体,集合等)。通过这些,使用者可以判断出这个web服务都有哪些函数接口,每个函数的参数是什么,返回值是什么等。有了这些,才能够构造SOAP报文来调用该Web服务的某个函数接口。

优点:SOAP不需HTTPGETPOST,它不受名称/对的限制,我们可以使用它来发送复杂的对象,包括DataSet(缓存中的数据库)、类和其他对象。

缺点: 由于SOAP消息十分冗长,因此如果存在带宽或者传输性能的问题,会导致接收和发送的消息遗失,在此情况下,建议使用POST或GET。

结构: 消息内容和一个或多个头模块组成,封装在SOAP envelope中。

下面是一个SOAP报文的例子:

<?xml version="1.0" encoding="utf-8"?>

- < wsdl:definitions name =" HPFlights_Service " targetNamespace =" HP.SOAQ.SampleApp " xmlns:wsdl =" http://schemas.xmlsoap.org/wsdl/ " xmlns:soap =" http://schemas.xmlsoap.org/wsdl/soap/ " xmlns:wsu =" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd " xmlns:soapenc =" http://schemas.xmlsoap.org/soap/encoding/ " xmlns:wsam =" http://www.w3.org/2007/05/addressing/metadata " xmlns:tns =" HP.SOAQ.SampleApp " xmlns:wsa =" http://schemas.xmlsoap.org/ws/2004/08/addressing " xmlns:wsp =" http://schemas.xmlsoap.org/ws/2004/09/policy " xmlns:wsap =" http://schemas.xmlsoap.org/ws/2004/08/addressing/policy " xmlns:xsd =" http://www.w3.org/2001/XMLSchema " xmlns:msc =" http://schemas.microsoft.com/ws/2005/12/wsdl/contract " xmlns:wsaw =" http://www.w3.org/2006/05/addressing/wsdl " xmlns:soap12 =" http://schemas.xmlsoap.org/wsdl/soap12/ " xmlns:wsa10 =" http://www.w3.org/2005/08/addressing " xmlns:wsx =" http://schemas.xmlsoap.org/ws/2004/09/mex ">
- < wsdl:types >
- < xsd:schema targetNamespace =" HP.SOAQ.SampleApp/Imports ">
  < xsd:import schemaLocation =" http://yaweijun1:24240/HPFlights_SOAP?xsd=xsd0 " namespace =" HP.SOAQ.SampleApp " />
  < xsd:import schemaLocation =" http://yaweijun1:24240/HPFlights_SOAP?xsd=xsd1 " namespace =" http://schemas.microsoft.com/2003/10/Serialization/ " />
  </ xsd:schema >
  </ wsdl:types >
- < wsdl:message name =" IHPFlights_Service_CreateFlightOrder_InputMessage ">
  < wsdl:part name =" parameters " element =" tns:CreateFlightOrder " />
  </ wsdl:message >

 

 

异常分析:11:07:40.137 [main] DEBUG org.apache.cxf.common.logging.LogUtils - Using org.apache.cxf.common.logging.Slf4jLogger for logging. 11:07:40.294 [main] DEBUG org.apache.cxf.endpoint.dynamic.DynamicClientFactory - Creating client from WSDL https://znwc.cnooc/xcoa/services/WsOaSystemService?wsdl 11:07:40.368 [main] DEBUG org.apache.cxf.resource.DefaultResourceManager - resolving resource <org.apache.cxf.wsdl11.WSDLManagerImpl/bus> type <interface org.apache.cxf.Bus> 11:07:40.369 [main] DEBUG org.apache.cxf.resource.DefaultResourceManager - resolving resource <null> type <interface org.apache.cxf.Bus> 11:08:30.898 [main] DEBUG org.apache.cxf.transport.http.HTTPConduit - Conduit &#39;{http://cxf.apache.org}TransportURIResolver.http-conduit&#39; has been (re)configured for plain http. 11:08:30.908 [main] DEBUG org.apache.cxf.transport.http.HTTPConduit - No Trust Decider configured for Conduit &#39;{http://cxf.apache.org}TransportURIResolver.http-conduit&#39; 11:08:30.910 [main] DEBUG org.apache.cxf.transport.http.HTTPConduit - No Auth Supplier configured for Conduit &#39;{http://cxf.apache.org}TransportURIResolver.http-conduit&#39; 11:08:30.911 [main] DEBUG org.apache.cxf.transport.http.HTTPConduit - Conduit &#39;{http://cxf.apache.org}TransportURIResolver.http-conduit&#39; has been configured for plain http. 11:08:30.921 [main] DEBUG org.apache.cxf.transport.http.HTTPConduit - registering incoming observer: org.apache.cxf.transport.TransportURIResolver$1@34a97744 11:08:31.184 [main] DEBUG org.apache.cxf.transport.https.SSLUtils - The location of the key store has not been set via a system parameter or through configuration so the default value of C:\Users\smartdot/.keystore will be used. 11:08:31.188 [main] DEBUG org.apache.cxf.transport.https.SSLUtils - The key store password has not been set via a system property or through configuration, reading data from the keystore will fail. 11:08:31.191 [main] DEBUG org.apache.cxf.transport.https.SSLUtils - The key password has not been set via a system property or through configuration, reading data from the keystore will fail. 11:08:31.193 [main] DEBUG org.apache.cxf.transport.https.SSLUtils - The keystore type has not been set in configuration so the default value of JKS will be used. 11:08:31.598 [main] DEBUG org.apache.cxf.resource.DefaultResourceManager - resolving resource <C:\Users\smartdot/.keystore> as stream 11:08:31.693 [main] DEBUG org.apache.cxf.transport.https.SSLUtils - No default keystore C:\Users\smartdot/.keystore 11:08:31.696 [main] DEBUG org.apache.cxf.transport.https.SSLUtils - The location of the trust store has not been set via a system parameter or through configuration so the default value of null will be used. 11:08:31.698 [main] DEBUG org.apache.cxf.transport.https.SSLUtils - TRUST_STORE_PASSWORD_NOT_SET 11:08:31.700 [main] DEBUG org.apache.cxf.transport.https.SSLUtils - The trust store type has not been set in configuration so the default value of JKS will be used. 11:08:31.767 [main] DEBUG org.apache.cxf.transport.https.HttpsURLConnectionFactory - The cipher suites have been set to [TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]. 11:08:33.321 [main] DEBUG org.apache.cxf.transport.http.Headers - Accept: */* 11:08:33.322 [main] DEBUG org.apache.cxf.transport.http.HTTPConduit - No Trust Decider for Conduit &#39;{http://cxf.apache.org}TransportURIResolver.http-conduit&#39;. An affirmative Trust Decision is assumed. 11:10:47.826 [main] DEBUG org.apache.cxf.transport.http.HTTPConduit - Conduit &#39;{http://cxf.apache.org}TransportURIResolver.http-conduit&#39; has been (re)configured for plain http. 11:10:47.830 [main] DEBUG org.apache.cxf.transport.http.HTTPConduit - No Trust Decider configured for Conduit &#39;{http://cxf.apache.org}TransportURIResolver.http-conduit&#39; 11:10:47.832 [main] DEBUG org.apache.cxf.transport.http.HTTPConduit - No Auth Supplier configured for Conduit &#39;{http://cxf.apache.org}TransportURIResolver.http-conduit&#39; 11:10:47.834 [main] DEBUG org.apache.cxf.transport.http.HTTPConduit - Conduit &#39;{http://cxf.apache.org}TransportURIResolver.http-conduit&#39; has been configured for plain http. 11:10:47.836 [main] DEBUG org.apache.cxf.transport.http.HTTPConduit - registering incoming observer: org.apache.cxf.transport.TransportURIResolver$1@62d0ac62 11:10:47.841 [main] DEBUG org.apache.cxf.transport.http.Headers - Accept: */* 11:10:47.842 [main] DEBUG org.apache.cxf.transport.http.HTTPConduit - No Trust Decider for Conduit &#39;{http://cxf.apache.org}TransportURIResolver.http-conduit&#39;. An affirmative Trust Decision is assumed. [Fatal Error] WsOaSystemService?wsdl=WsOaSystemService.wsdl:6:3: The element type "hr" must be terminated by the matching end-tag "</hr>". [2025-07-16 11:12:00] 错误: 服务调用失败 异常类型: ServiceConstructionException 错误详情: [Ljava.lang.String;@55caeb35 完整堆栈追踪: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service. at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:76) at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:319) at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:245) at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:238) at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:192) at com.hd.xcoa.project.BasicAuthWebServiceClient.createSecureClient(BasicAuthWebServiceClient.java:94) at com.hd.xcoa.project.BasicAuthWebServiceClient.main(BasicAuthWebServiceClient.java:33) Caused by: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:import): faultCode=PARSER_ERROR: Problem parsing &#39;http://znwc.cnooc/xcoa/services/WsOaSystemService?wsdl=WsOaSystemService.wsdl&#39;.: org.xml.sax.SAXParseException: The element type "hr" must be terminated by the matching end-tag "</hr>". at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2198) at com.ibm.wsdl.xml.WSDLReaderImpl.parseImport(WSDLReaderImpl.java:435) at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(WSDLReaderImpl.java:312) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2352) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2338) at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:255) at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:165) at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:74) ... 6 more Caused by: org.xml.sax.SAXParseExceptionpublicId: http://znwc.cnooc/xcoa/services/WsOaSystemService?wsdl=WsOaSystemService.wsdl; systemId: http://znwc.cnooc/xcoa/services/WsOaSystemService?wsdl=WsOaSystemService.wsdl; lineNumber: 6; columnNumber: 3; The element type "hr" must be terminated by the matching end-tag "</hr>". at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2188) ... 13 more
07-17
基于STM32 F4的永磁同步电机无位置传感器控制策略研究内容概要:本文围绕基于STM32 F4的永磁同步电机(PMSM)无位置传感器控制策略展开研究,重点探讨在不依赖物理位置传感器的情况下,如何通过算法实现对电机转子位置和速度的精确估计与控制。文中结合嵌入式开发平台STM32 F4,采用如滑模观测器、扩展卡尔曼滤波或高频注入法等先进观测技术,实现对电机反电动势或磁链的估算,进而完成无传感器矢量控制(FOC)。同时,研究涵盖系统建模、控制算法设计、仿真验证(可能使用Simulink)以及在STM32硬件平台上的代码实现与调试,旨在提高电机控制系统的可靠性、降低成本并增强环境适应性。; 适合人群:具备一定电力电子、自动控制理论基础和嵌入式开发经验的电气工程、自动化及相关专业的研究生、科研人员及从事电机驱动开发的工程师。; 使用场景及目标:①掌握永磁同步电机无位置传感器控制的核心原理与实现方法;②学习如何在STM32平台上进行电机控制算法的移植与优化;③为开发高性能、低成本的电机驱动系统提供技术参考与实践指导。; 阅读建议:建议读者结合文中提到的控制理论、仿真模型与实际代码实现进行系统学习,有条件者应在实验平台上进行验证,重点关注观测器设计、参数整定及系统稳定性分析等关键环节。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值