【发布时间】:2018-02-09 23:36:47
【问题描述】:
我正在尝试解析我在 MuleSoft 中创建的端点之一收到的请求。
这是来自 Salesforce 的 SOAP 请求,我不能只获取 XML 并从中获取值。肥皂请求消息如下。
SOAP 请求示例:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<notifications
xmlns="http://soap.sforce.com/2005/09/outbound">
<OrganizationId>00123jhk1h230AQ</OrganizationId>
<ActionId>04215wergf2345AA0</ActionId>
<SessionId>00Dn00000008w1T!AQ0AQLiuZg345345EGC8LAY00OqInU_Exn4.FVinnwwc2j.Naerwt2323g0R4qi9ykmHt.eertert212342dh</SessionId>
<EnterpriseUrl>https://12fwghoft.cs50.my.salesforce.com/services/Soap/c/39.0/00Dn00000008w1T</EnterpriseUrl>
<PartnerUrl>https://12fwghoft.cs50.my.salesforce.com/services/Soap/u/39.0/00Dn00000008w1T</PartnerUrl>
<Notification>
<Id>04l45611902IG</Id>
<sObject xsi:type="sf:Account"
xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>00q2sv2224ggwAV</sf:Id>
</sObject>
</Notification>
</notifications>
</soapenv:Body>
</soapenv:Envelope>
MULE 入站消息详细信息:
org.mule.DefaultMuleMessage
{
id=114f2110-0058-11e7-9989-5ce0c55142df
payload=[Ljava.lang.Object;
correlationId=<not set>
correlationGroup=-1
correlationSeq=-1
encoding=UTF-8
exceptionPayload=<not set>
Message properties:
INVOCATION scoped properties:
_ApikitResponseTransformer_AcceptedHeaders=*/*
_ApikitResponseTransformer_apikitRouterRequest=yes
_ApikitResponseTransformer_contractMimeTypes=[]
cxf_operation={http://soap.sforce.com/2005/09/outbound}notifications
cxf_service={http://soap.sforce.com/2005/09/outbound}NotificationPortService
method=public abstract boolean sfdc.account.NotificationPort.notifications(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.util.List)
INBOUND scoped properties:
accept-encoding=gzip
cache-control=max-age=259200
content-length=1028
content-type=text/xml; charset=utf-8
host=36ce69be.ngrok.io
http.listener.path=/api/*
http.method=POST
http.query.params=ParameterMap{[]}
http.query.string=
http.relative.path=/api/netsuite/customers
http.remote.address=/127.0.0.1:59266
http.request.path=/api/netsuite/customers
http.request.uri=/api/netsuite/customers
http.scheme=http
http.uri.params=ParameterMap{[]}
http.version=HTTP/1.1
soapaction=""
user-agent=Jakarta Commons-HttpClient/3.1
x-forwarded-for=136.147.62.8
OUTBOUND scoped properties:
MULE_ENCODING=UTF-8
SESSION scoped properties:
}
【问题讨论】:
-
您的意思是要从示例请求中提取节点值??
-
CXF 自动从信封中提取皂体,即;
<notifications>...</notifications>。之后使用 dataweave 或 xpath 从中提取值。