提问人:hamchu 提问时间:11/2/2023 更新时间:11/2/2023 访问量:27
XML 元素值作为 SOAP 正文标记属性值
xml element value as soap body tag attribute value
问:
作为初学者,我遇到了一个问题,我必须将消息 ID 标签值作为 Soap Body 的 wsu ID 动态传递,而不是静态传递(到目前为止我一直在这样做。
请帮助实现这一目标。
<?xml version="1.0" encoding="UTF-8"?>
<root>
<ebms:Messaging xmlns:ebms="http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/">
<ebms:UserMessage>
<ebms:MessageInfo>
<ebms:Timestamp>02-11-2023T12:41:11</ebms:Timestamp>
<ebms:MessageId>Body-4652f446-e7f8-4749-b8e2-630d192d521a</ebms:MessageId>
</ebms:MessageInfo>
<ebms:CollaborationInfo>
<ebms:Service type="BATCH">BUPLRQ</ebms:Service>
<ebms:Action>UploadMsg</ebms:Action>
<ebms:ConversationId/>
</ebms:CollaborationInfo>
</ebms:UserMessage>
</ebms:Messaging>
<UploadMsgRq>
<FileType>xml</FileType>
<AsyncRqUID/>
<Attachment>no attachment found20231102124111</Attachment>
</UploadMsgRq>
</root>
下面是我用来创建 SOAP Envelop 的代码,其中将静态值传递给 WSU ID SOAP BODY 标记
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ebms="http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<xsl:copy-of select="*//ebms:Messaging"/>
</soap:Header>
<soap:Body wsu:Id="Body-4652f446-e7f8-4749-b8e2-630d192d521a" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<xsl:copy-of select="*//UploadMsgRq"/>
</soap:Body>
</soap:Envelope>
</xsl:template>
</xsl:stylesheet>
答: 暂无答案
评论