本文整理了Java中javax.xml.soap.SOAPHeader.setPrefix()
方法的一些代码示例,展示了SOAPHeader.setPrefix()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SOAPHeader.setPrefix()
方法的具体详情如下:
包路径:javax.xml.soap.SOAPHeader
类名称:SOAPHeader
方法名:setPrefix
暂无
代码示例来源:origin: stackoverflow.com
SOAPEnvelope envelope = smc.getMessage().getSOAPPart()
.getEnvelope();
SOAPHeader header = envelope.getHeader();
if( header == null ){
envelope.addHeader();
header = envelope.getHeader();
}
header.setPrefix(envelope.getPrefix());
代码示例来源:origin: org.jboss.ws.native/jbossws-native-core
soapHeader.setPrefix(domHeader.getPrefix());
代码示例来源:origin: org.lorislab.corn/corn
private Path writeToFile(Path parent) {
Path path = parent.resolve(input.file);
try {
Source sc;
if (xsdDefinition.isWsdl()) {
SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
soapMessage.getSOAPBody().addDocument(document);
soapMessage.getSOAPPart().getEnvelope().removeNamespaceDeclaration("SOAP-ENV");
soapMessage.getSOAPPart().getEnvelope().addNamespaceDeclaration("soap", "http://schemas.xmlsoap.org/soap/envelope/");
soapMessage.getSOAPPart().getEnvelope().setPrefix("soap");
soapMessage.getSOAPHeader().setPrefix("soap");
soapMessage.getSOAPBody().setPrefix("soap");
sc = soapMessage.getSOAPPart().getContent();
} else {
sc = new DOMSource(document);
}
try (BufferedWriter writer = Files.newBufferedWriter(path)) {
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer();
t.setOutputProperty(OutputKeys.INDENT, "yes");
t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
t.transform(sc, new StreamResult(writer));
} catch (Exception ex) {
throw new RuntimeException("Error write XML ", ex);
}
} catch (Exception exx) {
throw new RuntimeException(exx);
}
return path;
}
代码示例来源:origin: stackoverflow.com
private void alterSoapEnvelope(SaajSoapMessage soapResponse) {
try {
SOAPMessage soapMessage = soapResponse.getSaajMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
SOAPHeader header = soapMessage.getSOAPHeader();
SOAPBody body = soapMessage.getSOAPBody();
SOAPFault fault = body.getFault();
envelope.removeNamespaceDeclaration(envelope.getPrefix());
envelope.addNamespaceDeclaration(PREFERRED_PREFIX, SOAP_ENV_NAMESPACE);
envelope.setPrefix(PREFERRED_PREFIX);
header.setPrefix(PREFERRED_PREFIX);
body.setPrefix(PREFERRED_PREFIX);
if (fault != null) {
fault.setPrefix(PREFERRED_PREFIX);
}
} catch (SOAPException e) {
e.printStackTrace();
}
}
内容来源于网络,如有侵权,请联系作者删除!