当前位置: 首页>>代码示例>>Java>>正文


Java MessageHeaders类代码示例

本文整理汇总了Java中com.sun.xml.internal.ws.api.message.MessageHeaders的典型用法代码示例。如果您正苦于以下问题:Java MessageHeaders类的具体用法?Java MessageHeaders怎么用?Java MessageHeaders使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MessageHeaders类属于com.sun.xml.internal.ws.api.message包,在下文中一共展示了MessageHeaders类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeTo

import com.sun.xml.internal.ws.api.message.MessageHeaders; //导入依赖的package包/类
/**
 * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)}
 */
@Override
public void writeTo(XMLStreamWriter w) throws XMLStreamException {
    String soapNsUri = soapVersion.nsUri;
    w.writeStartDocument();
    w.writeStartElement("S","Envelope",soapNsUri);
    w.writeNamespace("S",soapNsUri);
    if(hasHeaders()) {
        w.writeStartElement("S","Header",soapNsUri);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(w);
        }
        w.writeEndElement();
    }
    // write the body
    w.writeStartElement("S","Body",soapNsUri);

    writePayloadTo(w);

    w.writeEndElement();
    w.writeEndElement();
    w.writeEndDocument();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:AbstractMessageImpl.java

示例2: writeToBodyStart

import com.sun.xml.internal.ws.api.message.MessageHeaders; //导入依赖的package包/类
public void writeToBodyStart(XMLStreamWriter w) throws XMLStreamException {
    String soapNsUri = soapVersion.nsUri;
    w.writeStartDocument();
    w.writeStartElement("S","Envelope",soapNsUri);
    w.writeNamespace("S",soapNsUri);
    if(hasHeaders()) {
        w.writeStartElement("S","Header",soapNsUri);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(w);
        }
        w.writeEndElement();
    }
    // write the body
    w.writeStartElement("S","Body",soapNsUri);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:AbstractMessageImpl.java

示例3: writeTo

import com.sun.xml.internal.ws.api.message.MessageHeaders; //导入依赖的package包/类
/**
 * Writes the whole envelope as SAX events.
 */
@Override
public void writeTo( ContentHandler contentHandler, ErrorHandler errorHandler ) throws SAXException {
    String soapNsUri = soapVersion.nsUri;

    contentHandler.setDocumentLocator(NULL_LOCATOR);
    contentHandler.startDocument();
    contentHandler.startPrefixMapping("S",soapNsUri);
    contentHandler.startElement(soapNsUri,"Envelope","S:Envelope",EMPTY_ATTS);
    if(hasHeaders()) {
        contentHandler.startElement(soapNsUri,"Header","S:Header",EMPTY_ATTS);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(contentHandler,errorHandler);
        }
        contentHandler.endElement(soapNsUri,"Header","S:Header");
    }
    // write the body
    contentHandler.startElement(soapNsUri,"Body","S:Body",EMPTY_ATTS);
    writePayloadTo(contentHandler,errorHandler, true);
    contentHandler.endElement(soapNsUri,"Body","S:Body");
    contentHandler.endElement(soapNsUri,"Envelope","S:Envelope");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:AbstractMessageImpl.java

示例4: init

import com.sun.xml.internal.ws.api.message.MessageHeaders; //导入依赖的package包/类
private void init(@Nullable MessageHeaders headers, @NotNull AttachmentSet attachmentSet, @NotNull XMLStreamReader reader, @NotNull SOAPVersion soapVersion) {
    this.headers = headers;
    this.attachmentSet = attachmentSet;
    this.reader = reader;

    if(reader.getEventType()== START_DOCUMENT)
        XMLStreamReaderUtil.nextElementContent(reader);

    //if the reader is pointing to the end element </soapenv:Body> then its empty message
    // or no payload
    if(reader.getEventType() == XMLStreamConstants.END_ELEMENT){
        String body = reader.getLocalName();
        String nsUri = reader.getNamespaceURI();
        assert body != null;
        assert nsUri != null;
        //if its not soapenv:Body then throw exception, we received malformed stream
        if(body.equals("Body") && nsUri.equals(soapVersion.nsUri)){
            this.payloadLocalName = null;
            this.payloadNamespaceURI = null;
        }else{ //TODO: i18n and also we should be throwing better message that this
            throw new WebServiceException("Malformed stream: {"+nsUri+"}"+body);
        }
    }else{
        this.payloadLocalName = reader.getLocalName();
        this.payloadNamespaceURI = reader.getNamespaceURI();
    }

    // use the default infoset representation for headers
    int base = soapVersion.ordinal()*3;
    this.envelopeTag = DEFAULT_TAGS.get(base);
    this.headerTag = DEFAULT_TAGS.get(base+1);
    this.bodyTag = DEFAULT_TAGS.get(base+2);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:StreamMessage.java

示例5: DOMMessage

import com.sun.xml.internal.ws.api.message.MessageHeaders; //导入依赖的package包/类
public DOMMessage(SOAPVersion ver, MessageHeaders headers, Element payload, AttachmentSet attachments) {
    super(ver);
    this.headers = headers;
    this.payload = payload;
    this.attachmentSet = attachments;
    assert payload!=null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:DOMMessage.java

示例6: JAXBMessage

import com.sun.xml.internal.ws.api.message.MessageHeaders; //导入依赖的package包/类
private JAXBMessage( BindingContext context, Object jaxbObject, SOAPVersion soapVer, MessageHeaders headers, AttachmentSet attachments ) {
        super(soapVer);
//        this.bridge = new MarshallerBridge(context);
        this.bridge = context.createFragmentBridge();
        this.rawContext = null;
        this.jaxbObject = jaxbObject;
        this.headers = headers;
        this.attachmentSet = attachments;
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:JAXBMessage.java

示例7: PayloadSourceMessage

import com.sun.xml.internal.ws.api.message.MessageHeaders; //导入依赖的package包/类
public PayloadSourceMessage(@Nullable MessageHeaders headers,
    @NotNull Source payload, @NotNull AttachmentSet attSet,
    @NotNull SOAPVersion soapVersion) {

    super(headers, SourceReaderFactory.createSourceReader(payload, true),
            attSet, soapVersion);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:PayloadSourceMessage.java

示例8: getMessage

import com.sun.xml.internal.ws.api.message.MessageHeaders; //导入依赖的package包/类
/**
 * This should be called by first checking if the payload is modified.
 *
 * @param headers
 * @param attachments
 * @param binding
 * @return
 */
public Message getMessage(MessageHeaders headers, AttachmentSet attachments, WSBinding binding) {
    assert isPayloadModifed();
    if(isPayloadModifed()) {
        return lm.getMessage(headers,attachments,binding);
    } else {
        return packet.getMessage();
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:LogicalMessageImpl.java

示例9: configureRequestPacket

import com.sun.xml.internal.ws.api.message.MessageHeaders; //导入依赖的package包/类
private void configureRequestPacket(Packet packet, RequestContext requestContext) {
    // fill in Packet
    packet.proxy = this;
    packet.handlerConfig = binding.getHandlerConfig();

    // to make it multi-thread safe we need to first get a stable snapshot
    Header[] hl = userOutboundHeaders;
    if (hl != null) {
        MessageHeaders mh = packet.getMessage().getHeaders();
        for (Header h : hl) {
            mh.add(h);
        }
    }

    requestContext.fill(packet, (binding.getAddressingVersion() != null));
    packet.addSatellite(wsdlProperties);

    if (addrVersion != null) {
        // populate request WS-Addressing headers
        MessageHeaders headerList = packet.getMessage().getHeaders();
        AddressingUtils.fillRequestAddressingHeaders(headerList, wsdlPort, binding, packet);


        // Spec is not clear on if ReferenceParameters are to be added when addressing is not enabled,
        // but the EPR has ReferenceParameters.
        // Current approach: Add ReferenceParameters only if addressing enabled.
        if (endpointReference != null) {
            endpointReference.addReferenceParametersToList(packet.getMessage().getHeaders());
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:Stub.java

示例10: getWSDLOperationMapping

import com.sun.xml.internal.ws.api.message.MessageHeaders; //导入依赖的package包/类
public WSDLOperationMapping getWSDLOperationMapping(Packet request) throws DispatchException {
    MessageHeaders hl = request.getMessage().getHeaders();
    String action = AddressingUtils.getAction(hl, av, binding.getSOAPVersion());

    if (action == null)
        // Addressing is not enagaged, return null to use other ways to dispatch.
        return null;

    Message message = request.getMessage();
    QName payloadName;
    String localPart = message.getPayloadLocalPart();
    if (localPart == null) {
        payloadName = EMPTY_PAYLOAD;
    } else {
        String nsUri = message.getPayloadNamespaceURI();
        if (nsUri == null)
            nsUri = EMPTY_PAYLOAD_NSURI;
        payloadName = new QName(nsUri, localPart);
    }

    WSDLOperationMapping opMapping = uniqueOpSignatureMap.get(new ActionBasedOperationSignature(action, payloadName));
    if (opMapping != null)
        return opMapping;

    //Seems like in Wstrust STS wsdls, the payload does not match what is specified in the wsdl leading to incorrect
    //  wsdl operation resolution. Use just wsa:Action to dispatch as a last resort.
    //try just with wsa:Action
    opMapping = actionMap.get(action);
    if (opMapping != null)
        return opMapping;

    // invalid action header
    Message result = Messages.create(action, av, binding.getSOAPVersion());

    throw new DispatchException(result);

}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:38,代码来源:ActionBasedOperationFinder.java


注:本文中的com.sun.xml.internal.ws.api.message.MessageHeaders类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。