我在WSO2 ESB中创建了代理服务,使用xst转换,当我从esb发送请求时,我会在日志中查看服务的响应:
"<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/[\r][\n]" {org.apache.synapse.transport.http.wire}
"[0x9]<soap:Header/>" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} - >> "[0x9]<soap:Body> <m:putResponse xmlns:m="http://www.lmsoftmdm.ru">[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} - >> "[0x9]<m:return xmlns:xs="http://www.w3.org/2001/XMLSchema"[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} - >> "[0x9][0x9][0x9]xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} - >> "[0x9][0x9]<m:isError>true</m:isError>[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} - >> "[0x9]</m:return>[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} - >> "</m:putResponse></soap:Body>[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} - >> "</soap:Envelope>'
但ESB会在发送之前对其进行更改:
"<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">[\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2015-03-05 18:45:24,018] DEBUG {org.apache.synapse.transport.http.wire} - << "[0x9]<soap:Header></soap:Header>[\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2015-03-05 18:45:24,018] DEBUG {org.apache.synapse.transport.http.wire} - << "[0x9]<soap:Body> <m:putResponse xmlns:m="http://www.lmsoftmdm.ru">[\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2015-03-05 18:45:24,018] DEBUG {org.apache.synapse.transport.http.wire} - << "[0x9]<m:return xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">[\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2015-03-05 18:45:24,018] DEBUG {org.apache.synapse.transport.http.wire} - << "[0x9][0x9]<m:isError>true</m:isError>[\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2015-03-05 18:45:24,018] DEBUG {org.apache.synapse.transport.http.wire} - << "[0x9]</m:return>[\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2015-03-05 18:45:24,018] DEBUG {org.apache.synapse.transport.http.wire} - << "</m:putResponse></soap:Body>[\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2015-03-05 18:45:24,018] DEBUG {org.apache.synapse.transport.http.wire} - << "</soap:Envelope></soapenv:Body></soapenv:Envelope>
如何解决此问题? 提前谢谢!
答案 0 :(得分:0)
这是因为您在xslt样式表中使用了soap信封。 ESB的作用是,它只将body元素传递给xslt mediator。所以你只能使用xslt介体而不是soap信封或soap标头来操纵body元素。所以在xslt转换之后,转换后的内容将被添加到原始soap的主体中。所以,如果你的转型中有肥皂包裹,那么它将被视为身体的一部分。因此,使用xslt介体仅操纵主体并使用富集介体来操作soap信封