Package javax.xml.soap

Examples of javax.xml.soap.MessageFactory


       
        Service service = Service.create(wsdlURL, SERVICE_NAME);
        Dispatch<SOAPMessage> dispatcher = service.createDispatch(
            portName, SOAPMessage.class, Service.Mode.MESSAGE);
      
        MessageFactory factory = MessageFactory.newInstance();
       
        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


            portName,
            SOAPMessage.class,
            Service.Mode.MESSAGE
        );
      
        MessageFactory factory = MessageFactory.newInstance();
       
        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

        ObjectMessageContext objectCtx = new ObjectMessageContextImpl();
        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

    public void testhasFault() throws Exception {
        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);
        soapCtx.setMessage(faultMsg);
        assertFalse(clientBinding.getBindingImpl().hasFault(soapCtx));
    }
View Full Code Here

    public void testWrite() throws Exception {
        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");
   
            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

            wsdlURL = wsdlFile.toURL();
        } else {
            wsdlURL = new URL(args[0]);
        }

        MessageFactory factory = MessageFactory.newInstance();
        System.out.println(wsdlURL + "\n\n");

        final String ns = "http://objectweb.org/hello_world_soap_http";
        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

            wsdlURL = wsdlFile.toURL();
        } else {
            wsdlURL = new URL(args[0]);
        }
       
        MessageFactory factory = MessageFactory.newInstance();
        System.out.println(wsdlURL + "\n\n");

        QName serviceName1 = new QName("http://objectweb.org/hello_world_soap_http", "SOAPService1");
        QName portName1 = new QName("http://objectweb.org/hello_world_soap_http", "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");
        SOAPMessage soapResp = dispSOAPMsg.invoke(soapReq1);       
        System.out.println("Response from server: " + soapResp.getSOAPBody().getTextContent());       

        QName serviceName2 = new QName("http://objectweb.org/hello_world_soap_http", "SOAPService2");
        QName portName2 = new QName("http://objectweb.org/hello_world_soap_http", "SoapPort2");
       
        SOAPService2 service2 = new SOAPService2(wsdlURL, serviceName2);
        InputStream is2 =  Client.class.getResourceAsStream("GreetMeDocLiteralReq2.xml");
        SOAPMessage soapReq2 = factory.createMessage(null, is2);
        DOMSource domReqMessage = new DOMSource(soapReq2.getSOAPPart());

        Dispatch<DOMSource> dispDOMSrcMessage = service2.createDispatch(portName2,
                                                                        DOMSource.class, Mode.MESSAGE);
        System.out.println("Invoking server through Dispatch interface using DOMSource in MESSAGE Mode");
View Full Code Here

    private SOAPMessage greetMeResponse;
   
    public HWSoapMessageProvider() {
      
        try {
            MessageFactory 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();
        }
    }
View Full Code Here

TOP

Related Classes of javax.xml.soap.MessageFactory

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.