我有这种情况:
我从数据服务中获取一些信息,从另一个数据服务中获取另一个信息,我希望在一个唯一的响应中合并这两个信息。
在这个测试中我不使用数据服务,我在SOAPUI中使用模拟服务,两个模拟服务都可以单独工作。
我要合并的数据,例如:
数据服务1响应:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:obt="http://informatizacion.uci.cu/servicios/assets/ObtenerPersonas">
<soap:Header/>
<soap:Body>
<obt:Personas>
<!--Zero or more repetitions:-->
<obt:Persona>
<obt:idExpediente>T123654</obt:idExpediente>
<obt:primerNombre>yanaka</obt:primerNombre>
<obt:primerApellido>perez</obt:primerApellido>
<obt:segundoApellido>perez</obt:segundoApellido>
<obt:sexo>F</obt:sexo>
<obt:ci>920125848</obt:ci>
<obt:provincia>ok</obt:provincia>
<obt:municipio>yes</obt:municipio>
<obt:area>facultad</obt:area>
<obt:esDocente>false</obt:esDocente>
</obt:Persona>
</obt:Personas>
</soap:Body>
</soap:Envelope>
数据服务2响应:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:preg="http://pregrado.uci.cu">
<soap:Header/>
<soap:Body>
<preg:Personas>
<!--Zero or more repetitions:-->
<preg:Persona>
<preg:idExpediente>11111</preg:idExpediente>
<preg:primerNombre>jorge</preg:primerNombre>
<preg:primerApellido>infante</preg:primerApellido>
<preg:segundoApellido>osorio</preg:segundoApellido>
<preg:sexo>M</preg:sexo>
<preg:ci>1221122112211221</preg:ci>
<preg:provincia>rdf</preg:provincia>
<preg:municipio>dsf</preg:municipio>
<preg:area>df</preg:area>
<preg:esDocente>true</preg:esDocente>
</preg:Persona>
<preg:Persona>
<preg:idExpediente>gero et</preg:idExpediente>
<preg:primerNombre>sonoras imperio</preg:primerNombre>
<preg:primerApellido>quae divum incedo</preg:primerApellido>
<preg:segundoApellido>verrantque per auras</preg:segundoApellido>
<preg:sexo>per auras</preg:sexo>
<preg:ci>circum claustra</preg:ci>
<preg:provincia>nimborum in</preg:provincia>
<preg:municipio>foedere certo</preg:municipio>
<preg:area>profundum quippe ferant</preg:area>
<preg:esDocente>false</preg:esDocente>
</preg:Persona>
</preg:Personas>
</soap:Body>
</soap:Envelope>
所以我构建了这个代理服务:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="PersonaPoC"
transports="https,http" statistics="disable" trace="disable"
startOnLoad="true">
<target inSequence="conf:/PersonaPoC/obtener_estudiantes"/>
<publishWSDL key="conf:/wsdl/PersonaSimplev2.wsdl"/>
<description></description>
</proxy>
使用此序列:
姓名:obtener_estudiantes。
<sequence xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory>
<format>
<preg:ObtenerEstudiantesPoC xmlns:preg="http://pregrado.uci.cu"/>
</format>
</payloadFactory>
<send receive="conf:/PersonaPoC/guardar_Estudiantes">
<endpoint>
<address uri="http://destrono:8088/mockPregradoWSSOAP12Binding/"/>
</endpoint>
</send>
</sequence>
姓名:guardar_Estudiantes。
<sequence xmlns="http://ws.apache.org/ns/synapse">
<enrich>
<source clone="false" type="body"/>
<target action="replace" type="property"
property="listado_estudiantes"/>
</enrich>
<payloadFactory>
<format>
<obt:ObtenerPersonasPoC
xmlns:obt="http://informatizacion.uci.cu/servicios/assets/ObtenerPersonas"/>
</format>
</payloadFactory>
<log level="full"/>
<send receive="conf:/PersonaPoC/unir_Personas">
<endpoint>
<address uri="http://destrono:8888/mockAssetsSOAP12Binding"/>
</endpoint>
</send>
</sequence>
此时我在执行服务时在ESB中看到此错误:
这是发送给第二个服务mockAssetsSOAP12Binding的消息的日志。我不知道为什么会出现这个名称空间 请求中的xmlns:preg = http://pregrado.uci.cu,因为我没有在payloadfactory介体中使用它。
[2013-04-10 20:17:17,303] INFO - LogMediator To:
http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: ,
MessageID: urn:uuid:26b0c552-d8e6-4285-8814-84c595dae544, Direction:
response, Envelope:
<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:preg="http://pregrado.uci.cu">
<soap:Body>
<obt:ObtenerPersonasPoC
xmlns:obt="http://informatizacion.uci.cu/servicios/assets/ObtenerPersonas"/>
</soap:Body>
</soap:Envelope>
错误:
[2013-04-10 19:49:30,472] ERROR - RelayUtils Error while building Passthrough stream
org.apache.axiom.soap.SOAPProcessingException: Transport level information does not match with SOAP Message namespace URI
at
org.apache.axis2.builder.BuilderUtil.validateSOAPVersion(BuilderUtil.java:77
4)
at
org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:58)
at
org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocumen
t(DeferredMessageBuilder.java:146)
at
org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUti
ls.java:150)
at
org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtil
s.java:91)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediat
or.java:62)
at
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.
java:114)
at
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2Syn
apseEnvironment.java:223)
at
org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseC
allbackReceiver.java:443)
at
org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbac
kReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at
org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:217
)
at
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerP
ool.java:172)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:11
10)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:6
03)
at java.lang.Thread.run(Thread.java:722)
当我在AS 5.1.0中使用数据服务时,我看到了这个错误: org.apache.axiom.soap.SOAPProcessingException:First Element必须包含本地名称Envelope,但是找到了faultstring
如果我把TCPMon我可以看到这个消息交换:
Incoming message:
POST /mockAssetsSOAP12Binding HTTP/1.1
Content-Encoding: gzip
Content-Type: application/soap+xml; charset=UTF-8
Server: Jetty(6.1.x)
Transfer-Encoding: chunked
Host: 127.0.0.1:8888
Connection: Keep-Alive
124
<?xml version='1.0' encoding='UTF-8'?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:preg="http://pregrado.uci.cu"><soap:Body>
<obt:ObtenerPersonasPoC
xmlns:obt="http://informatizacion.uci.cu/servicios/assets/ObtenerPersonas"/>
</soap:Body></soap:Envelope>
0
传出消息:
HTTP/1.1 500 Internal Server Error
Content-Type: text/html; charset=iso-8859-1
Transfer-Encoding: chunked
Server: Jetty(6.1.x)
1a0
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>Server</soap:Value>
</soap:Code>
<soap:Reason>
<!--1 or more repetitions:-->
<soap:Text xml:lang="en">java.io.IOException: Decompression of response failed</soap:Text>
</soap:Reason>
</soap:Fault>
</soap:Body>
</soap:Envelope>
0
这是最后一个序列。 姓名:unir_Personas。
<sequence xmlns="http://ws.apache.org/ns/synapse">
<enrich>
<source clone="false" type="body"/>
<target action=" sibling" type="property"
property="listado_estudiantes"/>
</enrich>
<send/>
</sequence>
有什么想法吗?
答案 0 :(得分:0)
我不知道为什么会出现这个命名空间: 请求中的xmlns:preg = http://pregrado.uci.cu因为我没用过 它在有效载荷中介中。
您可以从端点的响应中获得该信息。您仅对主体使用有效负载,并且在rootlevel上显示该特定命名空间。无论如何,这不是您面临的问题的原因。在中间你提到了SOAP12服务。检查命名空间是否正确,如果端点接受SOAP 12请求,请将端点格式更改为soap12