Package org.servicemix.jbi.jaxp

Examples of org.servicemix.jbi.jaxp.SourceTransformer


                            "). WSDL description may be unusable.");
            }
           
            // put service description
            try {
                SourceTransformer st = new SourceTransformer();
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                component.getXFire().generateWSDL(svc.getName(), baos);
                Node node = st.toDOMNode(new StreamSource(new ByteArrayInputStream(baos.toByteArray())));
                Definition d = WSDLFactory.newInstance().newWSDLReader().readWSDL(null, (Document) node);
                javax.wsdl.Service service = d.getService(serviceName);
                if (service != null) {
                    if (service.getPorts().values().size() == 1) {
                        endpointName = ((Port) service.getPorts().values().iterator().next()).getName();
                        // Check if this is the same as defined in endpoint spec
                        if (es.getEndpointName() == null) {
                            es.setEndpointName(endpointName);
                        } else if (!es.getEndpointName().equals(endpointName)) {
                            logger.warn("The endpoint name defined in the wsdl (" + endpointName +
                                    ") does not match the endpoint name defined in the endpoint spec (" + es.getEndpointName() +
                            "). WSDL description may be unusable.");
                        }
                    }
                }
                if (es.getEndpointName() == null) {
                    throw new IllegalArgumentException("endpointName should be provided on the endpointSpec");
                }
                component.setServiceDescription(es.getServiceName(), es.getEndpointName(), (Document) node);
                if (logger.isDebugEnabled()) {
                    logger.debug("WSDL: " + st.toString(node));
                }
            } catch (Exception e) {
                logger.warn("Could not set endpoint description", e);
            }
View Full Code Here


        }
    }

    public void notify(Topic topic, Object object) throws JMSException, IOException, TransformerException {
      if (object instanceof Node) {
        SourceTransformer st = new SourceTransformer();
        String s = st.toString((Node) object);
            notify(topic, s);
      }
      else if (object instanceof String) {
            notify(topic, (String) object);
        }
View Full Code Here

        try {
          // Only DOMSource and SAXSource are allowed for validating
          // See http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/validation/Validator.html#validate(javax.xml.transform.Source,%20javax.xml.transform.Result)
          // As we expect a DOMResult as output, we must ensure that the input is a
          // DOMSource
          Source src = new SourceTransformer().toDOMSource(out.getContent());
            validator.validate(src, result);
            if (errorHandler.hasErrors()) {
                Fault fault = exchange.createFault();
                fault.setProperty("org.servicemix.schema", schema);
                fault.setContent(new DOMSource(result.getNode(), result.getSystemId()));
View Full Code Here

    protected SourceTransformer transformer;
    protected int messageCount = 20;
    protected SpringJBIContainer jbi;

    protected void setUp() throws Exception {
        transformer = new SourceTransformer();

        context = createBeanFactory();
        // TODO: check where this method is
        //context.setXmlValidating(false);
View Full Code Here

    // Properties
    //-------------------------------------------------------------------------
    public SourceTransformer getTransformer() {
        if (transformer == null) {
            transformer = new SourceTransformer();
        }
        return transformer;
    }
View Full Code Here

  }

  public InputStream getInput() {
    if (is == null) {
      try {
        SourceTransformer st = new SourceTransformer();
        StreamSource ss = st.toStreamSource(in.getContent());
        is = ss.getInputStream();
        if (is == null) {
          Reader r = ss.getReader();
          StringBuilder sb = new StringBuilder();
          char[] buffer = new char[1024];
View Full Code Here

            if (rtEndpointInfo.needWSDLGeneration()) {
                rtEndpointInfo.generateWSDL();
            }
            // put service description
            try {
                SourceTransformer st = new SourceTransformer();
                Map<String, DocInfo> docs = rtEndpointInfo.getDocMetadata();
                Set<Entry<String, DocInfo>> entries = docs.entrySet();
                for (Entry<String, DocInfo> entry : entries) {
                    DocInfo docInfo = (DocInfo)entry.getValue();
                    DOC_TYPE docType = docInfo.getDocType();
                    if (docType == DOC_TYPE.WSDL) {
                        Node node = st.toDOMNode(new StreamSource(docInfo.getDoc()));
                        component.setServiceDescription(es.getServiceName(), es.getEndpointName(), (Document) node);
                        if (logger.isDebugEnabled()) {
                            logger.debug("WSDL: " + st.toString(node));
                        }
                    }
                }
            } catch (Exception e) {
                logger.warn("Could not set endpoint description", e);
View Full Code Here

    protected SourceTransformer transformer;
    protected int messageCount = 20;
    protected SpringJBIContainer jbi;

    protected void setUp() throws Exception {
        transformer = new SourceTransformer();
        context = createBeanFactory();
        jbi = (SpringJBIContainer) context.getBean("jbi");
    }
View Full Code Here

        JAXWSComponent component = new JAXWSComponent();
        container.activateComponent(new ActivationSpec("jaxws", component));
        component.getServiceUnitManager().deploy("addNumbers", path.getAbsolutePath());
        component.start("addNumbers");

        SourceTransformer transformer = new SourceTransformer();
        QName serviceName = new QName("http://jaxws.components.servicemix.org/", "AddNumbersImplService");
        String file = "requestWithEnvelope.xml";
        Object answer = requestServiceWithFileRequest(serviceName, file);
        if (answer instanceof Source) {
            answer = transformer.toDOMNode((Source) answer);
        }
        assertTrue("Should return a DOM Node: " + answer, answer instanceof Node);
        Node node = (Node) answer;
        System.out.println(transformer.toString(node));
        String text = textValueOfXPath(node, "//return").trim();
        System.out.println("Result: " + text);
        assertTrue("Result text should not be empty", text.length() > 0);
       
        component.stop("addNumbers");
View Full Code Here

        NormalizedMessage in=exchange.getInMessage();
        in.setContent(new StringSource("<ping>Pinging you</ping>"));
        System.out.println("SENDING; exchange.status="+exchange.getStatus());
        client.sendSync(exchange);
        assertNotNull(exchange.getOutMessage());
        System.out.println("GOT RESPONSE; exchange.out="+new SourceTransformer().toString(exchange.getOutMessage().getContent()));
        client.done(exchange);
    }
View Full Code Here

TOP

Related Classes of org.servicemix.jbi.jaxp.SourceTransformer

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.