我在处理 SOAP 请求时遇到问题。我可以从信封中读取所有内容,但无法解析名称空间修饰参数(cs:measurand)。
在这里,您可以找到 SOAP 信封:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:cs="urn://Ocpp/Cs/2012/06/" xmlns:soap-enc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<cs:identity>17083A00001101</cs:identity>
<a:From>
<a:Address>http://172.0.0.0:9080</a:Address>
</a:From>
<a:MessageID>urn:uuid:xxxxxxxxxxxx</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To>http://172.0.0.0:8080/ws/ocp</a:To>
<a:Action>/MValues</a:Action>
</soap:Header>
<soap:Body>
<cs:mValuesRequest>
<cs:id>1</cs:id>
<cs:transactionId>1881</cs:transactionId>
<cs:values>
<cs:timestamp>2019-03-07T13:41:52.405Z</cs:timestamp>
<cs:value cs:measurand="e.a.i.r" cs:unit="Wh">300</cs:value>
<cs:value cs:measurand="c.i" cs:unit="Amp">38.5</cs:value>
<cs:value cs:measurand="v" cs:unit="Volt">399.5</cs:value>
<cs:value cs:measurand="p.a.i" cs:unit="W">15380</cs:value>
<cs:value cs:measurand="t" cs:unit="Celsius">35</cs:value>
</cs:values>
</cs:mValuesRequest>
</soap:Body>
</soap:Envelope>
以下是接收请求的服务:
@Action("/MValues")
@ResponsePayload
public JAXBElement<MValuesResponse> receive(@RequestPayload MValuesRequest request,
MessageContext messageContext) {
....
}
胡子哥哥
炎炎设计
相关分类