Package javax.xml.soap

Examples of javax.xml.soap.MessageFactory.createMessage()


        String str="<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:wsdl=\"http://www.jboss.org/bpel/examples/wsdl\">"+
          "<soapenv:Header/><soapenv:Body><wsdl:hello><TestPart>Hello</TestPart></wsdl:hello></soapenv:Body></soapenv:Envelope>";

        java.io.InputStream is=new java.io.ByteArrayInputStream(str.getBytes());
       
        SOAPMessage soapReq1 = factory.createMessage(null, is);
       
        System.out.println("Invoking server through Dispatch interface using SOAPMessage");
        SOAPMessage soapResp = dispatcher.invoke(soapReq1);
       
        String result=soapResp.getSOAPBody().getTextContent();
View Full Code Here


       
        String str="<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:wsdl=\"http://www.jboss.org/bpel/examples/wsdl\">"+
            "<soapenv:Header/><soapenv:Body><wsdl:hello><TestPart>Hello</TestPart></wsdl:hello></soapenv:Body></soapenv:Envelope>";
        java.io.InputStream is=new java.io.ByteArrayInputStream(str.getBytes());
       
        SOAPMessage soapReq1 = factory.createMessage(null, is);
       
          System.out.println("Invoking server through Dispatch interface using SOAPMessage");
          SOAPMessage soapResp = dispatcher.invoke(soapReq1);
          System.out.println("Response from server: " + soapResp.getSOAPBody().getTextContent());
         
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);
View Full Code Here

        TestClientBinding clientBinding = new TestClientBinding(bus, epr);
        SOAPMessageContext soapCtx = new SOAPMessageContextImpl(new GenericMessageContext());

        InputStream is =  getClass().getResourceAsStream("resources/NoSuchCodeDocLiteral.xml");
        MessageFactory msgFactory = MessageFactory.newInstance();
        SOAPMessage faultMsg = msgFactory.createMessage(null,  is);
        soapCtx.setMessage(faultMsg);
        assertTrue(clientBinding.getBindingImpl().hasFault(soapCtx));
       
        is =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
        faultMsg = msgFactory.createMessage(null,  is);
View Full Code Here

        SOAPMessage faultMsg = msgFactory.createMessage(null,  is);
        soapCtx.setMessage(faultMsg);
        assertTrue(clientBinding.getBindingImpl().hasFault(soapCtx));
       
        is =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
        faultMsg = msgFactory.createMessage(null,  is);
        soapCtx.setMessage(faultMsg);
        assertFalse(clientBinding.getBindingImpl().hasFault(soapCtx));
    }

    public void testRead() throws Exception {
View Full Code Here

        TestClientBinding clientBinding = new TestClientBinding(bus, epr);
       
        InputStream is =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
       
        MessageFactory msgFactory = MessageFactory.newInstance();
        SOAPMessage greetMeMsg = msgFactory.createMessage(null,  is);
        is.close();
       
        BufferedReader br =
            new BufferedReader(
                new InputStreamReader(
View Full Code Here

    public DOMSource invoke(DOMSource request) {
        DOMSource response = new DOMSource();
        try {
            MessageFactory factory = MessageFactory.newInstance();
            SOAPMessage soapReq = factory.createMessage();
            soapReq.getSOAPPart().setContent(request);
   
            System.out.println("Incoming Client Request as a DOMSource data in MESSAGE Mode");
            soapReq.writeTo(System.out);
            System.out.println("\n");
View Full Code Here

            System.out.println("Incoming Client Request as a DOMSource data in MESSAGE Mode");
            soapReq.writeTo(System.out);
            System.out.println("\n");
   
            InputStream is = getClass().getResourceAsStream("GreetMeDocLiteralResp2.xml");
            SOAPMessage greetMeResponse =  factory.createMessage(null, is);
            is.close();

            response.setNode(greetMeResponse.getSOAPPart());
        } catch (Exception ex) {
            ex.printStackTrace();
View Full Code Here

    public SOAPMessage invoke(SOAPMessage request) {
        SOAPMessage response = null;       
        try {
            MessageFactory factory = MessageFactory.newInstance();           
            InputStream is = getClass().getResourceAsStream("GreetMeDocLiteralResp1.xml");
            response =  factory.createMessage(null, is);
            is.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return response;
View Full Code Here

        QName serviceName1 = new QName(ns, "SOAPService1");
        QName portName1 = new QName(ns, "SoapPort1");

        SOAPService1 service1 = new SOAPService1(wsdlURL, serviceName1);
        InputStream is1 =  Client.class.getResourceAsStream("GreetMeDocLiteralReq1.xml");
        SOAPMessage soapReq1 = factory.createMessage(null, is1);

        Dispatch<SOAPMessage> dispSOAPMsg = service1.createDispatch(portName1,
                                                                    SOAPMessage.class, Mode.MESSAGE);

        System.out.println("Invoking server through Dispatch interface using SOAPMessage");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.