本文整理汇总了Java中org.apache.axiom.soap.SOAPFactory.createSOAPHeader方法的典型用法代码示例。如果您正苦于以下问题:Java SOAPFactory.createSOAPHeader方法的具体用法?Java SOAPFactory.createSOAPHeader怎么用?Java SOAPFactory.createSOAPHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axiom.soap.SOAPFactory
的用法示例。
在下文中一共展示了SOAPFactory.createSOAPHeader方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSoapEnvelope
import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private SOAPEnvelope buildSoapEnvelope(String clientID, String value) {
SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
SOAPHeader header = soapFactory.createSOAPHeader();
envelope.addChild(header);
OMNamespace synNamespace = soapFactory.createOMNamespace(
"http://ws.apache.org/ns/synapse", "syn");
OMElement clientIDElement = soapFactory.createOMElement("ClientID", synNamespace);
clientIDElement.setText(clientID);
header.addChild(clientIDElement);
SOAPBody body = soapFactory.createSOAPBody();
envelope.addChild(body);
OMElement valueElement = soapFactory.createOMElement("Value", null);
valueElement.setText(value);
body.addChild(valueElement);
return envelope;
}
示例2: buildSoapEnvelope
import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private SOAPEnvelope buildSoapEnvelope(String clientID, String value) {
SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
SOAPHeader header = soapFactory.createSOAPHeader();
envelope.addChild(header);
OMNamespace synNamespace = soapFactory.
createOMNamespace("http://ws.apache.org/ns/synapse", "syn");
OMElement clientIDElement = soapFactory.createOMElement("ClientID", synNamespace);
clientIDElement.setText(clientID);
header.addChild(clientIDElement);
SOAPBody body = soapFactory.createSOAPBody();
envelope.addChild(body);
OMElement valueElement = soapFactory.createOMElement("Value", null);
valueElement.setText(value);
body.addChild(valueElement);
return envelope;
}
示例3: populateSOAPHeaders
import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private static void populateSOAPHeaders(
org.apache.ode.bpel.iapi.Message messageFromOde,
SOAPEnvelope soapEnvelope,
SOAPFactory soapFactory,
List<javax.wsdl.extensions.soap.SOAPHeader> soapHaderDefinitions,
Operation operation
) throws BPELFault {
if (messageFromOde.getHeaderParts().size() > 0
|| soapHaderDefinitions.size() > 0) {
for (javax.wsdl.extensions.soap.SOAPHeader soapHeaderDefinition : soapHaderDefinitions) {
handleSOAPHeaderElementsInBindingOperation(
soapEnvelope,
soapFactory,
messageFromOde,
operation,
soapHeaderDefinition);
}
org.apache.axiom.soap.SOAPHeader soapHeader = soapEnvelope.getHeader();
if (soapHeader == null) {
soapHeader = soapFactory.createSOAPHeader(soapEnvelope);
}
for (Node headerNode : messageFromOde.getHeaderParts().values()) {
if (headerNode.getNodeType() == Node.ELEMENT_NODE) {
addSOAPHeaderBock(soapHeader, headerNode, soapFactory);
} else {
throw new BPELFault("SOAP Header Must be an Element");
}
}
}
}
示例4: _createEmptyEnvelope
import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
/**
* Create an emtpy envelope
*
* @param protocol
* @param style
* @param factory
* @return
*/
private static SOAPEnvelope _createEmptyEnvelope(Style style, SOAPFactory factory) {
SOAPEnvelope env = factory.createSOAPEnvelope();
// Add an empty body and header
factory.createSOAPBody(env);
factory.createSOAPHeader(env);
// Create a dummy operation element if this is an rpc message
if (style == Style.RPC) {
OMNamespace ns = factory.createOMNamespace("", "");
factory.createOMElement("PLACEHOLDER_OPERATION", ns, env.getBody());
}
return env;
}
示例5: invokeRegistrationService
import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private OMElement invokeRegistrationService(String identifier, String taskProtocolHandlerServiceURL, String registrationService) throws AxisFault {
OMElement payload = SOAPUtils.getRegistrationPayload(identifier, taskProtocolHandlerServiceURL);
SOAPFactory soap11Factory = OMAbstractFactory.getSOAP11Factory();
MessageContext mctx = new MessageContext();
if (mctx.getEnvelope() == null) {
mctx.setEnvelope(soap11Factory.createSOAPEnvelope());
}
if (mctx.getEnvelope().getBody() == null) {
soap11Factory.createSOAPBody(mctx.getEnvelope());
}
if (mctx.getEnvelope().getHeader() == null) {
soap11Factory.createSOAPHeader(mctx.getEnvelope());
}
mctx.getEnvelope().getBody().addChild(payload);
// //Setting basic auth headers. Reading those information using HT server config.
// HumanTaskServerConfiguration serverConfig = HTCoordinationModuleContentHolder.getInstance().getHtServer().getServerConfig();
// String tenantDomain = MultitenantUtils.getTenantDomainFromUrl(registrationService);
// if (registrationService.equals(tenantDomain)) {
// //this is a Super tenant registration service
// if (log.isDebugEnabled()) {
// log.debug("Sending Username" + serverConfig.getRegistrationServiceAuthUsername() + " - " + serverConfig.getRegistrationServiceAuthPassword()); //TODO REMOVE this
// }
// CarbonUtils.setBasicAccessSecurityHeaders(serverConfig.getRegistrationServiceAuthUsername(), serverConfig.getRegistrationServiceAuthPassword(), true, mctx);
// } else {
// if (log.isDebugEnabled()) {
// log.debug("Sending ws-coor Registration request to tenant domain: " + tenantDomain);
// }
// // Tenant's registration service
//
// String username = serverConfig.getRegistrationServiceAuthUsername() + "@" + tenantDomain;
// String pass = serverConfig.getRegistrationServiceAuthPassword();
// if (log.isDebugEnabled()) {
// log.debug("Sending Username" + username + " - " + pass); //TODO REMOVE this
// }
// CarbonUtils.setBasicAccessSecurityHeaders(
// username,
// pass,
// true,
// mctx);
// }
MessageContext responseMsgContext = ServiceUtils.invokeRegistrationService(mctx, registrationService);
if (responseMsgContext.getEnvelope() != null) {
if (responseMsgContext.getEnvelope().getBody() != null) {
return responseMsgContext.getEnvelope().getBody();
}
}
return null;
}
示例6: WSAHeaderWriter
import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
public WSAHeaderWriter(MessageContext mc, boolean isSubmissionNamespace, boolean addMU,
boolean replace, boolean includeOptional, String role) {
if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
log.debug("WSAHeaderWriter: isFinal=" + !isSubmissionNamespace + " addMU=" + addMU +
" replace=" + replace + " includeOptional=" + includeOptional+" role="+role);
}
messageContext = mc;
envelope = mc.getEnvelope();
factory = (SOAPFactory)envelope.getOMFactory();
messageContextOptions = messageContext.getOptions();
addressingNamespace =
isSubmissionNamespace ? Submission.WSA_NAMESPACE : Final.WSA_NAMESPACE;
header = envelope.getHeader();
// if there is no soap header in the envelope being processed, add one.
if (header == null) {
header = factory.createSOAPHeader(envelope);
}else{
ArrayList addressingHeaders = header.getHeaderBlocksWithNSURI(addressingNamespace);
if(addressingHeaders!=null && !addressingHeaders.isEmpty()){
existingWSAHeaders = new ArrayList(addressingHeaders.size());
for(Iterator iter=addressingHeaders.iterator();iter.hasNext();){
SOAPHeaderBlock oe = (SOAPHeaderBlock)iter.next();
if(addressingRole == null || addressingRole.length() ==0 || addressingRole.equals(oe.getRole())){
existingWSAHeaders.add(oe.getLocalName());
}
}
}
if(addressingHeaders != null && addressingHeaders.size() ==0){
addressingHeaders = null;
}
}
isFinalAddressingNamespace = !isSubmissionNamespace;
addMustUnderstandAttribute = addMU;
replaceHeaders = replace;
includeOptionalHeaders = includeOptional;
addressingRole = role;
if(!isFinalAddressingNamespace && mc.getTo() == null){
mc.setTo(new EndpointReference(AddressingConstants.Submission.WSA_ANONYMOUS_URL));
}
}
示例7: createMessageContext
import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private MessageContext createMessageContext(SOAPFactory soapFactory) {
MessageContext messageContext = null;
AxisService as1 = new AxisService("Service1");
ConfigurationContext cc = null;
try {
cc = ConfigurationContextFactory.createEmptyConfigurationContext();
AxisConfiguration ac = cc.getAxisConfiguration();
ac.addService(as1);
messageContext = cc.createMessageContext();
messageContext.setAxisService(as1);
SOAPEnvelope se = soapFactory.createSOAPEnvelope();
SOAPHeader sh = soapFactory.createSOAPHeader(se);
SOAPHeaderBlock shb1 = sh.addHeaderBlock(header_ultimateReceiver,
omFactory.createOMNamespace(namespace, header_ultimateReceiver));
// Since no role was set on the shb1, default is ultimate receiver
shb1.setMustUnderstand(true);
SOAPHeaderBlock shb2 = sh.addHeaderBlock(header_rolePlayed,
omFactory.createOMNamespace(namespace, header_rolePlayed));
shb2.setRole(rolePlayed1);
shb2.setMustUnderstand(true);
SOAPHeaderBlock shb3 = sh.addHeaderBlock(header_roleNotPlayed,
omFactory.createOMNamespace(namespace, header_roleNotPlayed));
shb3.setRole(roleNotPlayed);
shb3.setMustUnderstand(true);
SOAPHeaderBlock shb4 = sh.addHeaderBlock(header_bindingAdded,
omFactory.createOMNamespace(namespace, header_bindingAdded));
shb4.setRole(roleBindingAdded);
shb4.setMustUnderstand(true);
// This header is destined for the ulmiate receiver, but it is already processed
// so it shouldn't cause mustUnderstand fault
SOAPHeaderBlock shb5 = sh.addHeaderBlock(header_ultimateReceiver_processed,
omFactory.createOMNamespace(namespace, header_ultimateReceiver_processed));
// Since no role was set on the shb1, default is ultimate receiver
shb5.setMustUnderstand(true);
shb5.setProcessed();
// Header targeted for SOAP11 role of Next, not set to MustUnderstand
SOAPHeaderBlock shb6 = sh.addHeaderBlock(header_SoapNext,
omFactory.createOMNamespace(soap11Namespace, header_SoapNext));
shb6.setRole(roleSoap11Next);
messageContext.setEnvelope(se);
} catch (AxisFault e) {
fail("Caught unexpected exception creating message context" + e);
}
return messageContext;
}