本文整理汇总了Java中org.apache.axiom.soap.SOAPHeader类的典型用法代码示例。如果您正苦于以下问题:Java SOAPHeader类的具体用法?Java SOAPHeader怎么用?Java SOAPHeader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SOAPHeader类属于org.apache.axiom.soap包,在下文中一共展示了SOAPHeader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: removeSOAPHeader
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
private void removeSOAPHeader(MessageDataSource messageDataSource) throws SOAPException {
SOAPEnvelope soapEnvelope = (SOAPEnvelope) messageDataSource.getDataObject();
SOAPHeader soapHeader = soapEnvelope.getHeader();
if (soapHeader != null) {
for (Iterator iter = soapHeader.examineAllHeaderBlocks(); iter.hasNext(); ) {
Object o = iter.next();
if (o instanceof SOAPHeaderBlock) {
SOAPHeaderBlock headerBlk = (SOAPHeaderBlock) o;
if (name.equals(headerBlk.getLocalName())) {
headerBlk.detach();
}
} else if (o instanceof OMElement) {
OMElement headerElem = (OMElement) o;
if (name.equals(headerElem.getLocalName())) {
headerElem.detach();
}
}
}
}
}
开发者ID:wso2-attic,项目名称:carbon-gateway-framework,代码行数:22,代码来源:HeaderMediator.java
示例2: buildSoapEnvelope
import org.apache.axiom.soap.SOAPHeader; //导入依赖的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;
}
开发者ID:wso2,项目名称:product-ei,代码行数:24,代码来源:LoadBalanceSessionFullClient.java
示例3: buildSoapEnvelope
import org.apache.axiom.soap.SOAPHeader; //导入依赖的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;
}
开发者ID:wso2,项目名称:product-ei,代码行数:24,代码来源:LoadbalanceFailoverClient.java
示例4: checkSOAP12
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
protected void checkSOAP12() throws XdsWSException {
if (MessageContext.getCurrentMessageContext().isSOAP11()) {
throwFault("SOAP 1.1 not supported");
}
SOAPEnvelope env = MessageContext.getCurrentMessageContext().getEnvelope();
if (env == null)
throwFault("No SOAP envelope found");
SOAPHeader hdr = env.getHeader();
if (hdr == null)
throwFault("No SOAP header found");
if ( !hdr.getChildrenWithName(new QName("http://www.w3.org/2005/08/addressing","Action")).hasNext()) {
throwFault("WS-Action required in header");
}
}
开发者ID:jembi,项目名称:openxds,代码行数:17,代码来源:AppendixV.java
示例5: extractSoapHeaderParts
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
private static void extractSoapHeaderParts(org.apache.ode.bpel.iapi.Message message,
Definition wsdl,
org.apache.axiom.soap.SOAPHeader soapHeader,
List<javax.wsdl.extensions.soap.SOAPHeader> headerDefs,
Message msg) throws BPELFault {
// Checking that the definitions we have are at least there
for (javax.wsdl.extensions.soap.SOAPHeader headerDef : headerDefs) {
handleSoapHeaderPartDef(message, wsdl, soapHeader, headerDef, msg);
}
// Extracting whatever header elements we find in the message, binding and abstract parts
// aren't reliable enough given what people do out there.
Iterator headersIter = soapHeader.getChildElements();
while (headersIter.hasNext()) {
OMElement header = (OMElement) headersIter.next();
String partName = findHeaderPartName(headerDefs, wsdl, header.getQName());
message.setHeaderPart(partName, OMUtils.toDOM(header));
}
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:20,代码来源:SOAPUtils.java
示例6: addAttachmentIDHeader
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
/**
* Adding the attachment ids iteratively to the SOAP Header
*
* @param header Header Element where the child elements going to be included
* @param attachmentIDList attachment ids
*/
private void addAttachmentIDHeader(SOAPHeader header, List<Long> attachmentIDList) {
final String namespace = Constants.ATTACHMENT_ID_NAMESPACE;
final String namespacePrefix = Constants.ATTACHMENT_ID_NAMESPACE_PREFIX;
final String parentElementName = Constants.ATTACHMENT_ID_PARENT_ELEMENT_NAME;
final String childElementName = Constants.ATTACHMENT_ID_CHILD_ELEMENT_NAME;
OMNamespace omNs = soapFactory.createOMNamespace(namespace, namespacePrefix);
OMElement headerElement = soapFactory.createOMElement(parentElementName, omNs);
for (Long id : attachmentIDList) {
OMElement idElement = soapFactory.createOMElement(childElementName, omNs);
idElement.setText(String.valueOf(id));
headerElement.addChild(idElement);
}
header.addChild(headerElement);
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:25,代码来源:SOAPHelper.java
示例7: init
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
/**
* @param envelope
* @throws WebServiceException
*/
private void init(SOAPEnvelope envelope) throws WebServiceException {
root = envelope;
soapFactory = MessageUtils.getSOAPFactory(root);
// Advance past the header
SOAPHeader header = root.getHeader();
if (header == null) {
header = soapFactory.createSOAPHeader(root);
}
// Now advance the parser to the body element
SOAPBody body = root.getBody();
if (body == null) {
// Create the body if one does not exist
body = soapFactory.createSOAPBody(root);
}
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:XMLSpineImpl.java
示例8: testCustomBuilder
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
public void testCustomBuilder(){
try{
SOAPEnvelope env = getMockEnvelope();
SOAPHeader header = env.getHeader();
SOAPBody body = env.getBody();
ParserInputStreamCustomBuilder customBuilder = new ParserInputStreamCustomBuilder("UTF-8");
InputStream payload = new ByteArrayInputStream(mockPayload.getBytes());
OMElement om= customBuilder.create("urn:sample", "invokeOp",(OMContainer) body, parser, OMAbstractFactory.getOMFactory(), payload);
assertTrue(om!=null);
assertTrue(om instanceof OMSourcedElement);
OMSourcedElement ose = (OMSourcedElement)om;
assertNotNull(ose.getDataSource());
assertTrue((ose.getDataSource()) instanceof ParserInputStreamDataSource);
}catch(Exception e){
fail(e.getMessage());
}
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:18,代码来源:ParserInputStreamCustomBuilderTests.java
示例9: init
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
@Before
public void init() throws Exception {
super.init();
soapCommandProcessor = new SoapTransportCommandProcessor(contextResolution, "X-RequestTimeout", new JdkEmbeddedXercesSchemaValidationFailureParser());
init(soapCommandProcessor);
ContentTypeNormaliser ctn = mock(ContentTypeNormaliser.class);
when(ctn.getNormalisedResponseMediaType(any(HttpServletRequest.class))).thenReturn(MediaType.APPLICATION_XML_TYPE);
soapCommandProcessor.setContentTypeNormaliser(ctn);
identityTokenResolver = mock(SoapIdentityTokenResolver.class);
when(identityTokenResolver.resolve(any(SOAPHeader.class), any(X509Certificate[].class))).thenReturn(new ArrayList<IdentityToken>());
soapCommandProcessor.setValidatorRegistry(validatorRegistry);
soapCommandProcessor.bind(serviceBinding);
soapCommandProcessor.onCougarStart();
command=super.createCommand(identityTokenResolver, Protocol.SOAP);
}
开发者ID:betfair,项目名称:cougar,代码行数:18,代码来源:SoapTransportCommandProcessorTest.java
示例10: invoke
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
@Override
public ListenableFuture<? extends SOAPResponse> invoke(InvocationContext context, SOAPEnvelope request, Handler<SOAPEnvelope,SOAPResponse> nextHandler) {
Credentials credentials = context.getAttribute(Credentials.class);
if (credentials != null) {
OMFactory factory = request.getOMFactory();
SOAPHeader header = request.getOrCreateHeader();
OMNamespace ns = factory.createOMNamespace("admin", "ns");
header.addAttribute("SecurityEnabled", "true", ns);
if (credentials instanceof BasicAuthCredentials) {
BasicAuthCredentials basicAuthCreds = (BasicAuthCredentials)credentials;
factory.createOMElement("username", null, header).setText(basicAuthCreds.getUsername());
factory.createOMElement("password", null, header).setText(basicAuthCreds.getPassword());
factory.createOMElement("LoginMethod", null, header).setText("BasicAuth");
} else {
// TODO: proper exception
throw new UnsupportedOperationException();
}
}
return nextHandler.invoke(context, request);
}
开发者ID:veithen,项目名称:visualwas,代码行数:21,代码来源:SecurityInterceptor.java
示例11: invoke
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
@Override
public ListenableFuture<Object> invoke(InvocationContext context, Invocation invocation) {
InvocationContextImpl contextImpl = (InvocationContextImpl)context;
OperationHandler operationHandler = invocation.getOperation().getAdapter(OperationHandler.class);
SOAPFactory factory = metaFactory.getSOAP11Factory();
SOAPEnvelope request = factory.createSOAPEnvelope();
if (!operationHandler.isSuppressSOAPHeader()) {
SOAPHeader header = factory.createSOAPHeader(request);
OMNamespace ns1 = factory.createOMNamespace("admin", "ns");
header.addAttribute("JMXMessageVersion", "1.2.0", ns1);
header.addAttribute("JMXVersion", "1.2.0", ns1);
// TODO: need this to prevent Axiom from skipping serialization of the header
header.addHeaderBlock("dummy", factory.createOMNamespace("urn:dummy", "p")).setMustUnderstand(false);
}
SOAPBody body = factory.createSOAPBody(request);
operationHandler.createRequest(body, invocation.getParameters(), contextImpl);
SettableFuture<Object> result = SettableFuture.create();
Futures.addCallback(
soapHandler.invoke(context, request),
new UnmarshallingCallback(operationHandler, faultReasonHandler, contextImpl, result),
context.getExecutor());
return result;
}
开发者ID:veithen,项目名称:visualwas,代码行数:24,代码来源:MarshallingHandler.java
示例12: invoke
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
/**
*
* Process the security block from the message context header.
*/
public final InvocationResponse invoke(final MessageContext msgContext) throws AxisFault {
/* Get header */
final SOAPHeader header = msgContext.getEnvelope().getHeader();
if (header != null) {
final Iterator<?> blocks = header.examineAllHeaderBlocks();
while (blocks.hasNext()) {
/* Get header block */
final SOAPHeaderBlock block = (SOAPHeaderBlock) blocks.next();
if (block != null) {
/* Check for security header block */
if (block.getLocalName().equalsIgnoreCase("Security") || block.getLocalName().equalsIgnoreCase("Action")
|| block.getLocalName().equalsIgnoreCase("To")) {
logger.debug("----Inside invoke; found '" + block.getLocalName() + "' header. Marking it processed");
/* Mark it processed to avoid exception at client side */
block.setProcessed();
}
}
}
}
return InvocationResponse.CONTINUE;
}
开发者ID:inbravo,项目名称:scribe,代码行数:35,代码来源:MSSOAPMustUnderstandHandler.java
示例13: getHeadersLogMessage
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
private String getHeadersLogMessage(CarbonMessage carbonMessage, Reader reader) throws Exception {
StringBuffer sb = new StringBuffer();
MessageDataSource messageDataSource = carbonMessage.getMessageDataSource();
if (messageDataSource == null) {
messageDataSource = reader.makeMessageReadable(carbonMessage);
}
if (messageDataSource.getDataObject() != null && messageDataSource.getDataObject() instanceof OMElement) {
OMElement omElement = (OMElement) messageDataSource.getDataObject();
if (omElement instanceof SOAPEnvelope) {
try {
SOAPHeader header = (SOAPHeader) ((SOAPEnvelope) omElement).getHeader();
if (header != null) {
for (Iterator iter = header.examineAllHeaderBlocks(); iter.hasNext(); ) {
Object o = iter.next();
if (o instanceof SOAPHeaderBlock) {
SOAPHeaderBlock headerBlk = (SOAPHeaderBlock) o;
sb.append(separator).append(headerBlk.getLocalName()).
append(" : ").append(headerBlk.getText());
} else if (o instanceof OMElement) {
OMElement headerElem = (OMElement) o;
sb.append(separator).append(headerElem.getLocalName()).
append(" : ").append(headerElem.getText());
}
}
}
} catch (Exception e) {
log.error("Exception occurred while processing SOAPHeader", e);
return null;
}
}
}
setCustomProperties(sb, carbonMessage, reader);
return trimLeadingSeparator(sb);
}
开发者ID:wso2-attic,项目名称:carbon-gateway-framework,代码行数:37,代码来源:LogMediator.java
示例14: getBSTHeader
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
private String getBSTHeader(Request request) throws IOException, XMLStreamException {
org.apache.coyote.Request coyoteReq = request.getCoyoteRequest();
InputBuffer buf = coyoteReq.getInputBuffer();
ByteChunk bc = new ByteChunk();
buf.doRead(bc, coyoteReq);
try (InputStream is = new ByteArrayInputStream(getUTF8Bytes(bc.toString()))) {
XMLStreamReader reader = StAXUtils.createXMLStreamReader(is);
StAXBuilder builder = new StAXSOAPModelBuilder(reader);
SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
envelope.build();
SOAPHeader header = envelope.getHeader();
Iterator headerEls = header.getChildrenWithLocalName("Security");
if (!headerEls.hasNext()) {
return null;
}
OMElement securityHeader = (OMElement) headerEls.next();
Iterator securityHeaderEls = securityHeader.getChildrenWithLocalName("BinarySecurityToken");
if (!securityHeaderEls.hasNext()) {
return null;
}
OMElement bstHeader = (OMElement) securityHeaderEls.next();
bstHeader.build();
return bstHeader.getText();
}
}
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:28,代码来源:BSTAuthenticator.java
示例15: testCreateElement
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
@Test
public void testCreateElement() throws Exception {
// Creating SOAP envelope
SOAPEnvelope env = SOAPEnv.createEnvelope(SOAPEnv.SOAPVersion.SOAP_12);
// Adding header
Messaging.createElement(env);
// Check if header contains Messaging header block with mustUnderstand=true
SOAPHeader header = env.getHeader();
ArrayList blocks = header.getHeaderBlocksWithNSURI(EbMSConstants.EBMS3_NS_URI);
assertTrue(blocks.size()>0);
assertTrue(((SOAPHeaderBlock) blocks.get(0)).getMustUnderstand());
}
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:14,代码来源:MessagingTest.java
示例16: populateSOAPHeaders
import org.apache.axiom.soap.SOAPHeader; //导入依赖的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");
}
}
}
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:33,代码来源:SOAPUtils.java
示例17: handleSoapHeaderPartDef
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
private static void handleSoapHeaderPartDef(org.apache.ode.bpel.iapi.Message odeMessage,
Definition wsdl,
SOAPHeader header,
javax.wsdl.extensions.soap.SOAPHeader headerdef,
Message msgType) throws BPELFault {
// Is this header part of the "payload" messsage?
boolean payloadMessageHeader = headerdef.getMessage() == null
|| headerdef.getMessage().equals(msgType.getQName());
boolean requiredHeader = payloadMessageHeader
|| (headerdef.getRequired() != null && headerdef.getRequired());
if (requiredHeader && header == null) {
throw new BPELFault("SOAP Header missing required element.");
}
if (header == null) {
return;
}
Message hdrMsg = wsdl.getMessage(headerdef.getMessage());
if (hdrMsg == null) {
return;
}
Part p = hdrMsg.getPart(headerdef.getPart());
if (p == null || p.getElementName() == null) {
return;
}
OMElement headerEl = header.getFirstChildWithName(p.getElementName());
if (requiredHeader && headerEl == null) {
throw new BPELFault("SOAP Header missing required element: " + p.getElementName());
}
if (headerEl == null) {
return;
}
odeMessage.setHeaderPart(p.getName(), OMUtils.toDOM(headerEl));
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:38,代码来源:SOAPUtils.java
示例18: getSOAPHeaders
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static List<javax.wsdl.extensions.soap.SOAPHeader> getSOAPHeaders(
final ElementExtensible eee) {
return CollectionsX.filter(new ArrayList<javax.wsdl.extensions.soap.SOAPHeader>(),
(Collection<Object>) eee.getExtensibilityElements(),
javax.wsdl.extensions.soap.SOAPHeader.class);
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:8,代码来源:SOAPUtils.java
示例19: createSoapRequest
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
/**
* Create a SOAP request and add a list of attachment ids to the SOAP Header
*
* @param msgCtx base message context which will be manipulated through out the operation
* @param message element to be included in the SOAP Body
* @param op operation incorporated with the request
* @param attachmentIDList list of attachment ids to be included in the SOAP header
* @throws AxisFault Exception if operation/input not found for the binding or if any exception thrown from
* the axis2 level operations
*/
public void createSoapRequest(MessageContext msgCtx, Element message, Operation op, List<Long> attachmentIDList)
throws AxisFault {
createSoapRequest(msgCtx, message, op);
SOAPHeader header = msgCtx.getEnvelope().getHeader();
if (attachmentIDList != null && !attachmentIDList.isEmpty()) {
addAttachmentIDHeader(header, attachmentIDList);
}
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:21,代码来源:SOAPHelper.java
示例20: addCoordinationContext
import org.apache.axiom.soap.SOAPHeader; //导入依赖的package包/类
/**
* Adding ws-Coordination context to soap request.
*
* @param msgCtx MessageContext
* @param messageID UUID as a WS-Coordination identifier
* @param registrationService URL of the ws-coordination registration service.
*/
public void addCoordinationContext(MessageContext msgCtx, String messageID, String registrationService) {
SOAPHeader header = msgCtx.getEnvelope().getHeader();
EndpointReference epr = new EndpointReference();
epr.setAddress(registrationService);
CoordinationContext context = new HumanTaskCoordinationContextImpl(messageID, epr);
header.addChild(context.toOM());
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:15,代码来源:SOAPHelper.java
注:本文中的org.apache.axiom.soap.SOAPHeader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论