Package javax.xml.soap

Examples of javax.xml.soap.SOAPMessage


        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.getSOAPBody().extractContentAsDocument());
        assertNotNull(domReqMsg);
       
        InputStream is1 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq1.xml");
        SOAPMessage soapReqMsg1 = MessageFactory.newInstance().createMessage(null,  is1);
        DOMSource domReqMsg1 = new DOMSource(soapReqMsg1.getSOAPBody().extractContentAsDocument());
        assertNotNull(domReqMsg1);
       
        InputStream is2 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq2.xml");
        SOAPMessage soapReqMsg2 = MessageFactory.newInstance().createMessage(null,  is2);
        DOMSource domReqMsg2 = new DOMSource(soapReqMsg2.getSOAPBody().extractContentAsDocument());
        assertNotNull(domReqMsg2);
       
        InputStream is3 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq3.xml");
        SOAPMessage soapReqMsg3 = MessageFactory.newInstance().createMessage(null,  is3);
        DOMSource domReqMsg3 = new DOMSource(soapReqMsg3.getSOAPBody().extractContentAsDocument());
        assertNotNull(domReqMsg3);

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


       
        String replyBuffer;
       
        public void handleResponse(Response<SOAPMessage> response) {
            try {
                SOAPMessage reply = response.get();
                replyBuffer = reply.getSOAPBody().getTextContent();
            } catch (Exception e) {
                e.printStackTrace();
            }           
        }
View Full Code Here

     * @param maps the MAPs to encode
     */
    private void encode(SOAPMessageContext context,
                        AddressingProperties maps) {
        if (maps != null) {
            SOAPMessage message = context.getMessage();
            LOG.log(Level.INFO, "encoding MAPs in SOAP headers");
            try {
                SOAPEnvelope env = message.getSOAPPart().getEnvelope();
                SOAPHeader header = env.getHeader() != null
                                    ? env.getHeader()
                                    : env.addHeader();
                discardMAPs(header);
                header.addNamespaceDeclaration(Names.WSA_NAMESPACE_PREFIX,
View Full Code Here

    private AddressingProperties decode(SOAPMessageContext context) {
        // REVISIT generate MessageAddressingHeaderRequired fault if an
        // expected header is missing
        AddressingProperties maps = null;
        boolean isRequestor = ContextUtils.isRequestor(context);
        SOAPMessage message = context.getMessage();
        maps = unmarshalMAPs(message);
        if (isRequestor && null != maps.getRelatesTo()) {
            ContextUtils.storeCorrelationID(maps.getRelatesTo(),
                                            false,
                                            context);
View Full Code Here

    public SOAPMessageDataReader(DynamicDataBindingCallback cb) {
        callback = cb;
    }

    public Object read(int idx, T input) {
        SOAPMessage src = (SOAPMessage)input;
        Source obj = null;
        try {
            if (DOMSource.class.isAssignableFrom(callback.getSupportedFormats()[0])) {
               
                obj = new DOMSource(src.getSOAPPart());
               
            } else if (SAXSource.class.isAssignableFrom(callback.getSupportedFormats()[0])) {
               
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                src.writeTo(baos);
                ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
                InputSource inputSource = new InputSource(bais);
                obj = new SAXSource(inputSource);
               
            } else if (StreamSource.class.isAssignableFrom(callback.getSupportedFormats()[0])) {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                src.writeTo(baos);
                ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
                obj = new StreamSource(bais);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
View Full Code Here

        binding.marshal(objContext, soapContext,
                                                 new JAXBDataBindingCallback(objContext.getMethod(),
                                                                             DataBindingCallback.Mode.PARTS,
                                                                             null));
        SOAPMessage msg = soapContext.getMessage();
        assertNotNull(msg);
        assertTrue(msg.getSOAPBody().hasChildNodes());
        NodeList list = msg.getSOAPBody().getChildNodes();
        assertEquals(1, list.getLength());
        Node operationNode = list.item(0);
        assertEquals(objContext.getMethod().getName(), operationNode.getLocalName());
        WebService wsAnnotation = objContext.getMethod().getDeclaringClass().getAnnotation(WebService.class);
View Full Code Here

        binding.marshal(objContext, soapContext,
                                                 new JAXBDataBindingCallback(objContext.getMethod(),
                                                                             DataBindingCallback.Mode.PARTS,
                                                                             null));
        SOAPMessage msg = soapContext.getMessage();
        assertNotNull(msg);
        assertTrue(msg.getSOAPBody().hasChildNodes());
        NodeList list = msg.getSOAPBody().getChildNodes();
        assertEquals(1, list.getLength());
        Node operationNode = list.item(0);
        assertEquals(objContext.getMethod().getName() + "Response", operationNode.getLocalName());
       
        WebService wsAnnotation = objContext.getMethod().getDeclaringClass().getAnnotation(WebService.class);
View Full Code Here

        String str = SOAPMessageUtil.createRPCLitSOAPMessage(opName, elName, data);

        TestInputStreamContext inCtx = new TestInputStreamContext(str.getBytes());
        binding.read(inCtx, soapContext);

        SOAPMessage msg = soapContext.getMessage();
        assertNotNull(msg);
        assertTrue(msg.getSOAPBody().hasChildNodes());
        NodeList list = msg.getSOAPBody().getChildNodes();

        assertEquals(1, list.getLength());
        Node operationNode = list.item(0);
        assertEquals(objContext.getMethod().getName(), operationNode.getLocalName());
        assertTrue(operationNode.hasChildNodes());
View Full Code Here

        //Test The InputMessage of GreetMe Operation
        InputStream is =  getClass().getResourceAsStream("resources/GreetMeRpcLiteralReq.xml");       
        soapContext.put(ObjectMessageContext.MESSAGE_INPUT, false);

        assertNotNull(binding.getMessageFactory());
        SOAPMessage soapMessage = binding.getMessageFactory().createMessage(null, is);
        soapContext.setMessage(soapMessage);
        //GreetMe has a IN parameter
        objContext.setMessageObjects(new Object[]{null});

        binding.unmarshal(soapContext, objContext,
View Full Code Here

        String str = SOAPMessageUtil.createRPCLitSOAPMessage(opName, elName, data);
        ByteArrayInputStream in = new ByteArrayInputStream(str.getBytes());

        soapContext.put(ObjectMessageContext.MESSAGE_INPUT, true);
        assertNotNull(binding.getMessageFactory());
        SOAPMessage soapMessage = binding.getMessageFactory().createMessage(null, in);
        soapContext.setMessage(soapMessage);

        binding.unmarshal(soapContext, objContext,
                                 new JAXBDataBindingCallback(objContext.getMethod(),
                                                             DataBindingCallback.Mode.PARTS, null));
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.