1
我想知道是否可以通過肥皂請求發送一個字節[]。是嗎?如果是這樣,我怎麼能使用javax.xml.soap。*?Java - 如何發送Soap請求上的字節數組?
我只知道如何發送字符串。
private static SOAPMessage createSOAPRequest() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("ws", "http://www.qwert.com.ar/");
SOAPBody soapBody = envelope.getBody();
SOAPElement soapBodyElem = soapBody.addChildElement("ronkMotor", "ws");
SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("file");
//How to add byte[] here?
//soapBodyElem1.addTextNode("[email protected]");
MimeHeaders headers = soapMessage.getMimeHeaders();
headers.addHeader("SOAPAction", "ronkNow");
soapMessage.saveChanges();
soapMessage.writeTo(System.out);
return soapMessage;
}
的WS簽名是:
@WebMethod(operationName = "ronkNow", action = "urn:rs")
Response ronkNow(@WebParam(name = "file")byte[] data);
你有沒有解決這個問題?我有完全相同的問題... – Seb