0
在我WSO2 ESB 4.7.0我已經完成了這個代理:WSO2 PayloadFactory調解空參數
<proxy xmlns="http://ws.apache.org/ns/synapse" name="SendingByJmsAddressProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<send>
<endpoint>
<address uri="http://localhost:8080/RestService/rest/servizio"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log>
<property name="codice" expression="//codice"/>
</log>
<log level="full"/>
<switch source="//codice">
<case regex="asd">
<send/>
</case>
<case regex="0">
<log>
<property name="codice" value="check1"/>
</log>
<send/>
<payloadFactory media-type="xml">
<format>
<code>$1</code>
</format>
<args>
<arg xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" evaluator="xml"
expression="//codice"/>
</args>
</payloadFactory>
<property name="messageType" value="application/xml"/>
<log level="full"/>
<send>
<endpoint>
<address uri="jms:/testQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&java.naming.provider.url=repository/conf/jndi.properties&transport.jms.DestinationType=queue"/>
</endpoint>
</send>
</case>
</switch>
</outSequence>
</target>
<description/>
</proxy>
inSequence中我轉發客戶端的請求REST服務其響應是一個JSON字符串,看起來像這樣:
{
"codice":"0",
"messaggio":"Operazione effettuata 18:12",
"path":"\/path\/1AASSCOGNOME_NOME.111.2231\/",
"documenti":[{
"idAggregatoContenitore":"3508",
"idDocumento":"016601",
"idVersione":"17010",
"numVersione":"1",
"tipoDocumento":"Documento",
"autore":"sysadmin",
"titolo":"prova1",
"fileName":"FStandard.xml",
"checkedOut":"false",
"idDocumentoPadre":"",
"flagAllegati":"false",
"flagDaProtocollare":"true",
"dataCreazione":"11\/02\/2013 19:05",
"dataChekin":"11\/02\/2013 19:05",
"mimeType":"text\/xml",
"empty":"false",
"data":"1660100000",
"cache":"false",
"tipo":"D",
"nome":"prova1",
"keyData":"16601",
"keyNome":"prova1",
"keyNumero":"",
"keyTipo":"D",
"fileExtension":"path\/xml_file.png",
"evidenza":"false",
"originalDocumentoPadreId":"",
"originalDocumentoId":"016601",
"originalAggregatoContenitoreId":"3508"
},
{
"idAggregatoContenitore":"3508",
"idDocumento":"016602",
"idVersione":"17011",
"numVersione":"1",
"tipoDocumento":"Documento",
"autore":"sysadmin",
"titolo":"123456789",
"fileName":"HTTP Proxy Server.jmx",
"checkedOut":"false",
"idDocumentoPadre":"",
"flagAllegati":"false",
"flagDaProtocollare":"true",
"dataCreazione":"11\/02\/2013 19:19",
"dataChekin":"11\/02\/2013 19:19",
"mimeType":"application\/octet-stream",
"empty":"false",
"data":"1660200000",
"cache":"false",
"tipo":"D",
"nome":"123456789",
"keyData":"16602",
"keyNome":"123456789",
"keyNumero":"",
"keyTipo":"D",
"fileExtension":"path\/Documento.png",
"evidenza":"false",
"originalDocumentoPadreId":"",
"originalDocumentoId":"016602",
"originalAggregatoContenitoreId":"3508"
}],
"data":"350800000",
"tipoAggregatoEnum":"R",
"statoEnum":"aperto",
"keyData":"1360602720000",
"keyNome":"1aasscognome_nome.111.2231",
"nomeAggregatoNoNumero":"1AASSCOGNOME_NOME.111.2231",
"keyNumero":"1AASSCOGNOME_NOME.111.2231",
"keyTipo":"R",
"originalAggregatoId":"3508",
"originalAggregatoPadre":"3108"
}
作爲標準行爲ESB將傳入的json消息轉換爲xml格式的消息。 現在在outSequence我想:
1)發送回RestService響應於客戶端:由介
2)然後我想建立XML消息提取所述消息有效負載,然後一些元件以通過其他地方的jms協議發送它。
該代理可以正常工作,但PayloadFactory中介除外。事實上,由有效載荷廠建調解員的消息有它的身體空:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<Body>
<code xmlns="http://ws.apache.org/ns/synapse"/>
</Body>
</soapenv:Envelope>
誰能告訴我,爲什麼指定ARG標記爲空(XPath表達式似乎是正確的)?怎麼了? 謝謝