Examples of MessageFactory


Examples of javax.xml.soap.MessageFactory

    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

Examples of javax.xml.soap.MessageFactory

    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

Examples of javax.xml.soap.MessageFactory

    }

    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

Examples of javax.xml.soap.MessageFactory

    }
   
    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

Examples of javax.xml.soap.MessageFactory

            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

Examples of javax.xml.soap.MessageFactory

            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

Examples of javax.xml.soap.MessageFactory

    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

Examples of javax.xml.soap.MessageFactory

      log.debug("MDX query: " + queryStr);
    }
   
    try
    {
      MessageFactory mf = MessageFactory.newInstance();
      SOAPMessage message = mf.createMessage();

      MimeHeaders mh = message.getMimeHeaders();
      mh.setHeader("SOAPAction", "\"urn:schemas-microsoft-com:xml-analysis:Execute\"");

      SOAPPart soapPart = message.getSOAPPart();
View Full Code Here

Examples of javax.xml.soap.MessageFactory

    if (_protocolException instanceof SOAPFaultException) {
      SOAPFaultException sfe = (SOAPFaultException) _protocolException;
      SOAPFault fault = sfe.getFault();

      try {
        MessageFactory factory = _soapContext.getMessageFactory();
        SOAPMessage message = factory.createMessage();
        message.getSOAPBody().addChildElement(fault);
        _soapContext.setMessage(message);
        _source = _soapContext.getMessage().getSOAPPart().getContent();
      }
      catch (SOAPException se) {
View Full Code Here

Examples of javax.xml.soap.MessageFactory

  private void serializeRuntimeException()
    throws WebServiceException
  {
    try {
      MessageFactory factory = _soapContext.getMessageFactory();
      SOAPMessage message = factory.createMessage();

      QName faultcode = new QName(message.getSOAPBody().getNamespaceURI(),
                                  "Server",
                                  message.getSOAPBody().getPrefix());
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.