Java 8 MessageFactory - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 MessageFactory class.

This code example shows how to use the following methods:createMessage
     
     
     
     
    private SOAPMessage createStudentRequest() throws SOAPException {
        SOAPMessage message = messageFactory.createMessage();
         
        //SOAPEnvelope envelope = message.getSOAPPart().getEnvelope(); 
        
        SOAPBody soapBody = message.getSOAPBody();
         
        QName studentRequestName = new QName(NAMESPACE_URI, "studentRequest", PREFIX);
         
        SOAPBodyElement studentRequest = soapBody.addBodyElement(studentRequestName);
         
        QName childName = new QName("Name");
        SOAPElement name = studentRequest.addChildElement(childName);
        name.addTextNode("ʹÓÃSpringWS·¢²¼À´×ÔÆõÔ¼ÓÅÏȵÄWebService");
         
        childName = new QName("Subject1");
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createMessage
        //reader should be on the start element for the  
        assertEquals(XMLStreamReader.START_ELEMENT, xmlReader.next());
        assertEquals("Body", xmlReader.getLocalName());
         
        factory = MessageFactory.newInstance();
        soapMessage = factory.createMessage();
    } 
 
    @Test
    public void testUsingStaxUtilsCopyWithSAAJWriterData0() throws Exception {
        testUsingStaxUtilsCopyWithSAAJWriter(0); 
    } 
 
    @Test
    public void testUsingStaxUtilsCopyWithSAAJWriterData1() throws Exception {
        testUsingStaxUtilsCopyWithSAAJWriter(1); 
    } 
 
    @Test
    public void testUsingStaxUtilsCopyWithSAAJWriterData2() throws Exception {
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createMessage
    public static SOAPMessage createMessage(String bindingId) throws SOAPException {
        SOAPMessage message = null;
        if (bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING) || bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
            message = SOAP12_MESSAGE_FACTORY.createMessage();
        } else { 
            message = SOAP11_MESSAGE_FACTORY.createMessage();
        } 
        return message;
    } 
 
    /** 
     * Returns the SOAP Message factory of version 1.1 or 1.2 based on binding id. The binding Id  
     * can be one of javax.xml.ws.soap.SOAPBinding ids. 
     *  
     * @param bindingId SOAPBinding type 
     * @return javax.xml.soap.MessageFactory 
     */ 
    public static MessageFactory getFactory(String bindingId) {
        MessageFactory factory = null;
        if (bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING) || bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createMessage
This code example shows how to use the following methods:createMessage
This code example shows how to use the following methods:createMessage
        Assert.assertEquals("Invalid prefix", qName.getPrefix(), name.getPrefix());
    } 
 
    @Test
    public void testToQName() throws Exception {
        SOAPMessage message = messageFactory.createMessage();
        Name name = message.getSOAPPart().getEnvelope().createName("localPart", null, null);
        QName qName = SaajUtils.toQName(name);
        Assert.assertNotNull("Invalid qName", qName);
        Assert.assertEquals("Invalid namespace", name.getURI(), qName.getNamespaceURI());
        Assert.assertFalse("Invalid prefix", StringUtils.hasLength(qName.getPrefix()));
        Assert.assertFalse("Invalid namespace", StringUtils.hasLength(qName.getNamespaceURI()));
    } 
 
    @Test
    public void testToQNameNamespace() throws Exception {
        SOAPMessage message = messageFactory.createMessage();
        Name name = message.getSOAPPart().getEnvelope().createName("localPart", null, "namespace");
        QName qName = SaajUtils.toQName(name);
        Assert.assertNotNull("Invalid qName", qName);
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createMessage
    public HWDOMSourceMessageProvider() { 
 
        try { 
            factory = MessageFactory.newInstance();
            InputStream is = getClass().getResourceAsStream("resources/sayHiRpcLiteralResp.xml");
            sayHiResponse =  factory.createMessage(null, is);
            is.close();
            is = getClass().getResourceAsStream("resources/GreetMeRpcLiteralResp.xml");
            greetMeResponse =  factory.createMessage(null, is);
            is.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } 
    } 
 
    public DOMSource invoke(DOMSource request) {
        QName qn = (QName)ctx.getMessageContext().get(MessageContext.WSDL_OPERATION);
        if (qn == null) {
            throw new RuntimeException("No Operation Name");
        } 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createMessage
                "multipart/related; " + 
                "boundary=MIMEBoundaryurn_uuid_E3F7CE4554928DA89B1231365678616; " + 
                "type=\"text/xml\"; " + 
                "start=\"<0.urn:uuid:E3F7CE4554928DA89B1231365678617@apache.org>\""); 
        InputStream in = TestUtils.getTestFile("SwAmessage.bin");
        SOAPMessage message = mf.createMessage(headers, in);
        SOAPPart soapPart = message.getSOAPPart();
        assertEquals("<0.urn:uuid:E3F7CE4554928DA89B1231365678617@apache.org>", 
                soapPart.getContentId());
        Iterator attachments = message.getAttachments();
        assertTrue(attachments.hasNext());
        AttachmentPart ap = (AttachmentPart)attachments.next();
        assertEquals("<urn:uuid:E3F7CE4554928DA89B1231365678347>", 
                ap.getContentId());
        assertFalse(attachments.hasNext());
    } 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createMessage
This code example shows how to use the following methods:createMessage
See Code Examples for Java 8 MessageFactory Methods: