如何去除JMS消息头 -> SOAP
我通过synapse+axis2+activemq来实现webservice异步调用。
我的客户端采用STUB方式。
原先不加synapse跳转,返回的soap消息:
------------------------------------------
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/soap+xml; action="urn:getInfoResponse";charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 23 Aug 2011 07:32:52 GMT
10c
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns:getInfoResponse xmlns:ns="http://test">
<ns:return>webservice:dsfsfsdsdf</ns:return> </ns:getInfoResponse>
</soapenv:Body>
</soapenv:Envelope>
0
------------------------------------------
在自动生成的stub中,他解析获取soapenv:Body -> ns:getInfoResponse ->ns:return 里的值
但经过我synapse跳转后,soap消息如下:
------------------------------------------
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=UTF-8; action="urn:getInfoResponse"
JMS_DESTINATION: ID:sunnaoh-32807-1314058857144-0:2:43
JMS_MESSAGE_ID: ID:sunnaoh-32807-1314058857144-0:3:43:1:1
JMS_EXPIRATION: 0
JMS_COORELATION_ID: ID:sunnaoh-32807-1314058857144-0:2:43:1:1
JMS_PRIORITY: 4
JMS_REDELIVERED: false
JMS_DELIVERY_MODE: 2
Server: Apache-Coyote/1.1
JMS_TIMESTAMP: 1314087564021
Date: Tue, 23 Aug 2011 08:19:24 GMT
Transfer-Encoding: chunked
333
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:MessageID>urn:uuid:6e095461-fe09-4d20-84ff-8696de1de720</wsa:MessageID>
<wsa:Action>urn:getInfoResponse</wsa:Action>
<wsa:RelatesTo>urn:uuid:34D85A466163EF41981314088922900</wsa:RelatesTo>
</soapenv:Header>
<soapenv:Body>
<axis2ns43:text xmlns:axis2ns43="http://ws.apache.org/commons/ns/payload"><?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns:getInfoResponse xmlns:ns="http://test"><ns:return>webservice:dsfsffsssf</ns:return></ns:getInfoResponse></soapenv:Body></soapenv:Envelope></axis2ns43:text> </soapenv:Body>
</soapenv:Envelope>0
------------------------------------------
可以看到,加了JMS消息信息,然后将上面一个SOAP消息包在了自己的BODY中,自动套了axis2ns43:text标签,似乎是以TEXT存放。但这样,以原先stub解析方式就无法取到值了。我应该如何处理这个soap消息?是自己改写stub自带的解析方式(如果要改写解析方式,是怎么一个思路)?还是在synapse这里修改配置,去掉JMS消息头,还是?
在网上搜了半天,也没找到相对应的,仅仅得到一个提示,就是在synapse配置中,
<proxy name="Proxy2" transports="jms">
<target>
<endpoint>
<address uri="http://10.16.64.14:8088/axis2/services/TestInterface"/>
</endpoint>
<outSequence>
<send/>
</outSequence>
</target>
<publishWSDL uri="http://10.16.64.14:8088/axis2/services/TestInterface?wsdl"/>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/soap+xml</default>
</rules>
</parameter>
</proxy>
指定contentType 这样就不会产生axis2ns43:text ,但我加上去之后,还是有这个标签。
谁对这方面有经验,请指教,谢谢。