Package javax.xml.soap

Examples of javax.xml.soap.SOAPMessage


        EasyMock.expectLastCall().andReturn(Boolean.valueOf(outbound));
        context.get(REQUESTOR_ROLE_PROPERTY);
        EasyMock.expectLastCall().andReturn(Boolean.valueOf(requestor));
        String mapProperty = getMAPProperty(requestor, outbound);
        AddressingPropertiesImpl maps = getMAPs(exposeAs, outbound);
        SOAPMessage message = control.createMock(SOAPMessage.class);
        context.getMessage();
        EasyMock.expectLastCall().andReturn(message);
        SOAPHeader header = setUpSOAPHeader(context, message, outbound);
        JAXBContext jaxbContext = control.createMock(JAXBContext.class);
        ContextUtils.setJAXBContext(jaxbContext);
View Full Code Here


        try {
            methodCalled("handleMessage");
            printHandlerInfo("handleMessage", isOutbound(ctx));
            Object b  = ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
            boolean outbound = (Boolean)b;
            SOAPMessage msg = ctx.getMessage();

            if (isServerSideHandler()) {
                if (outbound) {
                    continueProcessing = true;
                } else {
                    continueProcessing = getReturnValue(outbound, ctx);
                    if (!continueProcessing) {
                        outbound = true;
                    }
                }

                if (outbound) {
                    try {
                        // append handler id to SOAP response message
                        SOAPBody body = msg.getSOAPBody();
                        Node resp = body.getFirstChild();

                        if (resp.getNodeName().contains("pingResponse")) {
                            Node child = resp.getFirstChild();
                            Document doc = resp.getOwnerDocument();
                            Node info = doc.createElementNS(child.getNamespaceURI(), child.getLocalName());
                            info.setPrefix("ns4");
                            info.appendChild(doc.createTextNode(getHandlerId()));
                            resp.appendChild(info);
                            msg.saveChanges();
                        }
                    } catch (DOMException e) {
                        e.printStackTrace();
                    }
                } else {
View Full Code Here

            return true;
        }

        boolean ret = true;
        try {
            SOAPMessage msg  = ctx.getMessage();
            SOAPBody body = msg.getSOAPBody();

            if (body.getFirstChild().getFirstChild() == null) {
                return true;
            }
View Full Code Here

        binding.marshal(objContext,
                         soapContext,
                         new JAXBDataBindingCallback(objContext.getMethod(),
                                                     DataBindingCallback.Mode.PARTS,
                                                     null));
        SOAPMessage msg = soapContext.getMessage();
       
        PersistenceUtils pu = new PersistenceUtils();
        InputStream is = pu.getContextAsInputStream(soapContext);
        assert null != is;       
        MessageContext restored = pu.getContext(is);
        assertEquals(3, restored.keySet().size());
        assertEquals(soapContext.get(ObjectMessageContext.MESSAGE_INPUT),
                     restored.get(ObjectMessageContext.MESSAGE_INPUT));
        Object[] params = (Object[])soapContext.get(ObjectMessageContext.METHOD_PARAMETERS);
        Object[] restoredParams = (Object[])restored.get(ObjectMessageContext.METHOD_PARAMETERS);
        assertEquals(params.length, restoredParams.length);
        assertEquals(params[0], restoredParams[0]);
        SOAPMessage restoredMsg = ((SOAPMessageContext)binding.
            createBindingMessageContext(objContext)).getMessage();
        assertEquals(msg.getSOAPBody().getChildNodes().getLength(),
                     restoredMsg.getSOAPBody().getChildNodes().getLength());
        assertNull(msg.getSOAPHeader());
        assertNull(restoredMsg.getSOAPHeader());
       
        InputStream is2 = pu.getContextAsInputStream(restored);
        is.reset();
        is2.reset();       
        assertEquals(is.available(), is2.available());
View Full Code Here

        objectCtx.put(ObjectMessageContext.MESSAGE_INPUT, Boolean.FALSE);
        objectCtx.put(MESSAGE_OUTBOUND_PROPERTY, Boolean.TRUE);
        SOAPMessageContext context = (SOAPMessageContext)sb.createBindingMessageContext(objectCtx);

        MessageFactory msgFactory = MessageFactory.newInstance();
        SOAPMessage msg = msgFactory.createMessage();
        msg.setProperty(SOAPMessage.WRITE_XML_DECLARATION, "true");
        msg.getSOAPPart().getEnvelope().addNamespaceDeclaration(W3CConstants.NP_SCHEMA_XSD,
                                                                W3CConstants.NU_SCHEMA_XSD);
        msg.getSOAPPart().getEnvelope().addNamespaceDeclaration(W3CConstants.NP_SCHEMA_XSI,
                                                                W3CConstants.NU_SCHEMA_XSI);
        context.setMessage(msg);
       
        RMPropertiesImpl rmps = new RMPropertiesImpl();
        RMContextUtils.storeRMProperties(context, rmps, true);
View Full Code Here

        RMContextUtils.storeRMProperties(context, rmps, true);
        return context;
    }

    private void verifyHeaders(SOAPMessageContext context, String... names) throws SOAPException {
        SOAPMessage message = context.getMessage();
        SOAPEnvelope env = message.getSOAPPart().getEnvelope();
        SOAPHeader header = env.getHeader();

        // check all expected headers are present

        for (String name : names) {
View Full Code Here

        ctx.put("c", new Integer(Integer.MIN_VALUE));
        ctx.put("d", mn);
        ctx.put("e", this);
        InputStream mis = RMHandlerTest.class.getResourceAsStream("resources/GreetMeDocLiteralRequest.xml");
        SOAPBindingImpl binding = new SOAPBindingImpl(false);
        SOAPMessage smsg = binding.getMessageFactory().createMessage(null, mis);
        ctx.put(SOAP_MSG_KEY, smsg);
        InputStream cis = RMUtils.getPersistenceUtils().getContextAsInputStream(ctx);
        EasyMock.expect(msg.getContextAsStream()).andReturn(cis);
       
        control.replay();
View Full Code Here

            assertEquals("astring", mc.get("a"));
            assertTrue((Boolean)mc.get("b"));
            assertEquals(Integer.MIN_VALUE, ((Integer)mc.get("c")).intValue());
            assertEquals(mn, (BigInteger)mc.get("d"));
            assertNull(mc.get("e"));
            SOAPMessage smsg = (SOAPMessage)mc.get(SOAP_MSG_KEY);
            for (int i = 0; i < smsg.getSOAPBody().getChildNodes().getLength(); i++) {
                Node node = smsg.getSOAPBody().getChildNodes().item(i);
                if (Node.ELEMENT_NODE == node.getNodeType()) {
                    assertEquals("greetMeRequest", node.getLocalName());
                }
            }
        }
View Full Code Here

        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);

        InputStream is =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
        SOAPMessage soapReqMsg = MessageFactory.newInstance().createMessage(null,  is);
        assertNotNull(soapReqMsg);
       
        InputStream is1 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq1.xml");
        SOAPMessage soapReqMsg1 = MessageFactory.newInstance().createMessage(null,  is1);
        assertNotNull(soapReqMsg1);
       
        InputStream is2 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq2.xml");
        SOAPMessage soapReqMsg2 = MessageFactory.newInstance().createMessage(null,  is2);
        assertNotNull(soapReqMsg2);
       
        InputStream is3 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq3.xml");
        SOAPMessage soapReqMsg3 = MessageFactory.newInstance().createMessage(null,  is3);
        assertNotNull(soapReqMsg3);

        Dispatch<SOAPMessage> disp = service.createDispatch(portName,
                                                            SOAPMessage.class, Service.Mode.MESSAGE);
        SOAPMessage soapResMsg = disp.invoke(soapReqMsg);
        assertNotNull(soapResMsg);
        String expected = "Hello TestSOAPInputMessage";
        assertEquals("Response should be : Hello TestSOAPInputMessage",
                     expected, soapResMsg.getSOAPBody().getTextContent());
       
        disp.invokeOneWay(soapReqMsg1);
       
        Response response = disp.invokeAsync(soapReqMsg2);
        SOAPMessage soapResMsg2 = (SOAPMessage)response.get();
        assertNotNull(soapResMsg2);
        String expected2 = "Hello TestSOAPInputMessage2";
        assertEquals("Response should be : Hello TestSOAPInputMessage2",
                     expected2, soapResMsg2.getSOAPBody().getTextContent());
       
        TestSOAPMessageHandler tsmh = new TestSOAPMessageHandler();
        Future f = disp.invokeAsync(soapReqMsg3, tsmh);
        assertNotNull(f);
        while (!f.isDone()) {
View Full Code Here

        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);

        InputStream is =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
        SOAPMessage soapReqMsg = MessageFactory.newInstance().createMessage(null, is);
        DOMSource domReqMsg = new DOMSource(soapReqMsg.getSOAPPart());
        assertNotNull(domReqMsg);
       
        InputStream is1 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq1.xml");
        SOAPMessage soapReqMsg1 = MessageFactory.newInstance().createMessage(null, is1);
        DOMSource domReqMsg1 = new DOMSource(soapReqMsg1.getSOAPPart());
        assertNotNull(domReqMsg1);
       
        InputStream is2 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq2.xml");
        SOAPMessage soapReqMsg2 = MessageFactory.newInstance().createMessage(null, is2);
        DOMSource domReqMsg2 = new DOMSource(soapReqMsg2.getSOAPPart());
        assertNotNull(domReqMsg2);
       
        InputStream is3 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq3.xml");
        SOAPMessage soapReqMsg3 = MessageFactory.newInstance().createMessage(null, is3);
        DOMSource domReqMsg3 = new DOMSource(soapReqMsg3.getSOAPPart());
        assertNotNull(domReqMsg3);
   

        Dispatch<DOMSource> disp = service.createDispatch(portName,
                                                            DOMSource.class, Service.Mode.MESSAGE);
View Full Code Here

TOP

Related Classes of javax.xml.soap.SOAPMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.