【发布时间】:2018-07-25 11:43:42
【问题描述】:
我正在自动化一个肥皂服务,我需要发送带有标头的 SAML 请求。
String endpoint ="https://xyz";
File xml = new File("path of xml") ;
String req = FileUtils. readFileToString(xml) ;
SOAPConnectionFactory fact =
SOAPConnectionFactory.newInstance();
SOAPConnection conn = fact.createConnection();
URL end = new URL(endpoint) ;
SOAPMessage Sr = messageFactory.createMesaage(new
javax.xml.soap.Mineheaders(), New ByteArrayInputStream(message.getBytes(Charset.forName("UTF-8))));
SOAPMessage soapRes = connection.call(Sr,end);
OutputStream out = new ByteArrayOutputStream() ;
soapRes.writeTo(out);
这是我正在使用的代码。 现在我想设置一些标头我应该如何为请求设置它们? 标题:
POST : afahagajahs 主持人:hsghgfgg Cobtent-type : 文本 内容长度:258 肥皂动作:“”
【问题讨论】: