2017-08-08 140 views
0

嘗試使用SoapJaxbDataFormat元帥方法構造soap請求。 路線:使用SoapJaxbDataFormat元帥構造SOAP請求

private SoapJaxbDataFormat soap = new SoapJaxbDataFormat("<manage order generated package path>"); 

public void configure() throws Exception { 
    soap.setVersion("1.2"); 
    from("direct:" + "invokeSoapServiceRoute") 
     .process(new constructManageOrderRequestObject()) 
     .setHeader(Exchange.SOAP_ACTION, simple(MANAGE_ORDER_SOAP_ACTION)) 
     .setHeader(Exchange.HTTP_METHOD, simple(HTTP_METHOD_POST)) 
     .setHeader(Exchange.CONTENT_TYPE, constant("application/soap+xml;charset=UTF-8")) 
     .marshal(soap) //request 
     .log(LoggingLevel.DEBUG, LOG, "request ===========>${body}") 
    .end(); 
} 

constructManageOrderRequestObject處理器創建ManageOrderRequest對象(在編譯時間使用maven從WSDL產生類),並且將它的所有不同的特性(其它參考文獻)和對象設置爲交換體。當我使用上面的代碼編組體,它被記錄在下面輸出 -

<?xml version="1.0" encoding="UTF-8"?> 
<ns0:Envelope xmlns:ns0="http://www.w3.org/2003/05/soap-envelope"> 
    <ns0:Body> 
     <ns1:manageOrderRequest xmlns:ns1="http://cap.xe.com/xsd/ManageOrder/2010/06/01">[email protected]</ns1:manageOrderRequest> 
    </ns0:Body> 
</ns0:Envelope> 

它不轉換ManageOrderRequest對象的XML,而使用皁體內其對象引用。

有人可以幫我解決這個問題。

+0

有人可以幫助我在這裏請! – Bappa

回答

0

我找到了解決辦法:

需要使用soap.setContextPath設置上下文路徑(「包名」)