2013-03-15 96 views
1

發送騾頭我有個請求 - 響應http endpoint定義如下:如何不SOAP請求和響應

<http:inbound-endpoint address="${mvi.service.address}" exchange-pattern="request-response"> 
    <cxf:proxy-service wsdlLocation="classpath:mvi.wsdl" namespace="http://pennmutual.com/services/mvi" service="MVIService" /> 
</http:inbound-endpoint> 

它發送回客戶端的響應已經騾頭所附象下面這樣:

<soap:Header> 
    <mule:header xmlns:mule="http://www.muleumo.org/providers/soap/1.0"> 
    <mule:MULE_CORRELATION_ID>4784545a-4fad-44ac-171e-1bc150ccdcb2</mule:MULE_CORRELATION_ID> 
    <mule:MULE_CORRELATION_GROUP_SIZE>-1</mule:MULE_CORRELATION_GROUP_SIZE> 
    <mule:MULE_CORRELATION_SEQUENCE>-1</mule:MULE_CORRELATION_SEQUENCE> 
    </mule:header> 

我怎樣才能擺脫<mule:header>元素?

回答

3

地址:

enableMuleSoapHeaders="false" 

cxf:proxy-service。並且還添加了全球CXF配置元素:

<cxf:configuration enableMuleSoapHeaders="false"/> 
+0

我使用SoapUI進行測試,仍然看到騾頭接入元素 – 2013-03-15 19:42:28

+0

道歉我忘記了全局CXF配置元素。再試一次。 – 2013-03-15 20:03:33

+0

謝謝,這次工作。好奇全局CXF配置元素是如何工作的,它不被元素引用。 – 2013-03-16 00:53:13

0

有使用cxf:outInterceptors和Java類,如下所示刪除騾頭的另一種方式: -

<http:inbound-endpoint address="${mvi.service.address}" exchange-pattern="request-response"/> 
<cxf:proxy-service wsdlLocation="classpath:mvi.wsdl" namespace="http://pennmutual.com/services/mvi" service="MVIService" > 
<cxf:outInterceptors > 
    <spring:bean id="outfault" class="com.SOAPInterceptorOutboundHeaderRemover"/> 
</cxf:outInterceptors> 
</cxf:proxy-service> 

,並在你的SOAPInterceptorOutboundHeaderRemover Java類: -

public class SOAPInterceptorOutboundHeaderRemover extends AbstractSoapInterceptor { 

public SOAPInterceptorOutboundHeaderRemover() { 
super(Phase.PRE_PROTOCOL); 
} 

@Override 
public void handleMessage(SoapMessage arg0) throws Fault { 
List<Header> headerList = arg0.getHeaders(); 
Header muleHeader = null; 
boolean isMuleHeader = false; 
for (Header header : headerList) { 
ElementNSImpl element = (ElementNSImpl) header.getObject(); 
if ("mule:header".equals(element.getNodeName())) { 
isMuleHeader = true; 
muleHeader = header; 
} 
} 
if (isMuleHeader) { 
arg0.getHeaders().remove(muleHeader); 
} 

} 
} 

cxf:outInterceptors Java類從響應騾頭和工作正常

相關問題