2017-03-24 57 views
0

我試圖使用彈簧集成來執行soapcall。 WSDL是soap 1.2。內容 - 使用彈簧集成的肥皂呼叫的類型

我的Spring配置:

<int:channel id="inputChannel" /> 

<int:channel id="outputChannel" /> 

<int:header-enricher input-channel="inputChannel" output-channel="outputChannel">    
    <int:header name="#{T(org.springframework.http.HttpHeaders).CONTENT_TYPE}" value="text/xml" /> 
</int:header-enricher> 

<bean id="eduflexWsTemplate" class="org.springframework.ws.client.core.WebServiceTemplate" 
    p:marshaller-ref="eduflexMarshaller" 
    p:unmarshaller-ref="eduflexMarshaller" 
    p:defaultUri="http://srv-nl-edu65/wsParalax/" 
    p:messageFactory-ref="soap12MessageFactory" 
/> 

<bean id="soap12MessageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"> 
    <property name="soapVersion"> 
     <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_12"/> 
    </property> 
</bean> 

Java代碼:

MyRequestXml request = new MyRequestXml(); 
    //construct request 

    MyResponse response = (MyResponse) m_template.marshalSendAndReceive(request, new WebServiceMessageCallback() { 

     public void doWithMessage(WebServiceMessage message) { 
      SoapMessage soapMessage = (SoapMessage) message; 
      soapMessage.setSoapAction("soapAction"); 
     } 
    }); 

Initialy肥皂動作沒有設置和我有關的錯誤,所以我固定,通過使用WebServiceMessageCallback。

但現在我得到有關內容類型的錯誤:

org.springframework.ws.client.WebServiceTransportException: Unsupported Media Type [415] 

我想使用Spring的集成頭,濃縮塔來覆蓋它,但在Wireshark的我看到標題內容類型仍然是多部分/相關。

所以我的問題是我如何強制春天集成設置內容類型爲文本/ XML?強制肥皂版本1.2似乎也沒有效果。

+0

問題是:爲什麼不使用Spring集成WS通道適配器:http://docs.spring.io/spring-integration/reference/html/ws.html?因此,您不需要手動設置「Content-Type」。你的代碼在這個問題上還不清楚。我們看到'',但不清楚誰訂閱了'outputChannel' ... –

回答

0

我發現我的問題,我有一個Jaxb2Marshaller與mtomEnabled設置爲true。