0
我發送請求的servlet,類似的的OutputStream /的SOAPMessage要HTTP郵政與Apache駱駝
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// Decode incoming SOAP message
InputStream in = req.getInputStream();
...
以下處理數據是發佈流我的客戶端代碼與Servlet
SOAPMessage soapMessage = messageFactory.createMessage();
...
OutputStream out = httpUrlConnection.getOutputStream();
soapMessage.writeTo(out);
現在我想開發http客戶端在Apache的駱駝後像下面
from("timer:foo?period=5s")
.process( new Processor() {
public void process(Exchange exchange) throws Exception {
...
exchange.getOut().setHeader(Exchange.HTTP_METHOD,"POST");
exchange.getOut().setBody(soapMessage);
} })
.to("jetty:http://localhost:8180/app/sendStream");
編輯: 我試圖運行上面的代碼並面臨以下錯誤
org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl to the required type: java.io.InputStream with value [email protected]42a6d5a
at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:177)
at org.apache.camel.component.jetty.JettyHttpProducer.processInternal(JettyHttpProducer.java:166)
你至今嘗試過什麼?你有沒有把你的肥皂信息放進交換機構並試圖發送它?你面臨什麼問題? –
發佈更新,我發現沒有類型的轉換器可用 – ImranRazaKhan