Package javax.wsdl

Examples of javax.wsdl.WSDLException


            ExtensibilityElement el = o instanceof ExtensibilityElement ? (ExtensibilityElement)o
                : new JAXBExtensibilityElement(o);
            el.setElementType(qname);
            return el;
        } catch (Exception ex) {
            throw new WSDLException(WSDLException.PARSER_ERROR,
                                    "Error reading element " + qname,
                                    ex);
        } finally {
            try {
                StaxUtils.close(reader);
            } catch (XMLStreamException ex) {
                throw new WSDLException(WSDLException.PARSER_ERROR, ex.getMessage(), ex);
            }
        }
    }
View Full Code Here


                    } catch (Exception e) {
                        //ignore - probably not DOM level 3
                    }
                }
            } catch (Exception e) {
                throw new WSDLException(WSDLException.PARSER_ERROR, e.getMessage(), e);
            } finally {
                try {
                    StaxUtils.close(xmlReader);
                } catch (XMLStreamException ex) {
                    throw new WSDLException(WSDLException.PARSER_ERROR, ex.getMessage(), ex);
                }
            }
            def = reader.readWSDL(wsdlLocator, doc.getDocumentElement());
        } else {
            def = reader.readWSDL(wsdlLocator);
View Full Code Here

    public void marshall(Class parentType, QName elementType, ExtensibilityElement extension, PrintWriter pw,
                         Definition def, ExtensionRegistry extReg) throws WSDLException {
        try {
            writeXml(((Schema)extension).getElement(), pw);
        } catch (TransformerException e) {
            throw new WSDLException("", "Could not write schema.", e);
        }
    }
View Full Code Here

                    URL url = getAbsoluteURL(classLoader, filePath);
                    if(url == null) {
                        if(log.isDebugEnabled()) {
                            log.debug("Could not locate URL for wsdl. Reporting error");
                        }
                            throw new WSDLException("WSDL4JWrapper : ", e.getMessage(), e);
                        }
                    else {
                        urlCon = openConnection(url);
                        if(log.isDebugEnabled()) {
                             log.debug("Found URL for WSDL from jar");
                        }
                    }
                }
                else {
                    if(log.isDebugEnabled()) {
                        log.debug("Could not get URL from classloader. Reporting " +
                        "error due to no file path.");
                    }
                    throw new WSDLException("WSDL4JWrapper : ", e.getMessage(), e);
                }
            }
            if(is != null) {
                is.close();
            }
            this.wsdlExplicitURL = urlCon.getURL().toString();
            getDefinition();
        } catch (FileNotFoundException ex) {
            throw ex;
        } catch (UnknownHostException ex) {
            throw ex;
        } catch (ConnectException ex) {
            throw ex;
        } catch(IOException ex)  {
            throw ex;
        } catch (Exception ex) {
            throw new WSDLException("WSDL4JWrapper : ", ex.getMessage(), ex);
        }
    }
View Full Code Here

                    } catch (Exception e) {
                        //ignore - probably not DOM level 3
                    }
                }
            } catch (Exception e) {
                throw new WSDLException(WSDLException.PARSER_ERROR, e.getMessage(), e);
            } finally {
                StaxUtils.close(xmlReader);
            }
            def = reader.readWSDL(wsdlLocator, doc.getDocumentElement());
        } else {
View Full Code Here

            });
           
            u.marshal(mObj, writer);
            writer.flush();           
        } catch (Exception ex) {
            throw new WSDLException(WSDLException.PARSER_ERROR,
                                    "",
                                    ex);
        }

    }
View Full Code Here

            if (null != el) {
                el.setElementType(qname);
            }
            return el;
        } catch (Exception ex) {
            throw new WSDLException(WSDLException.PARSER_ERROR,
                                    "Error reading element " + qname,
                                    ex);
        } finally {
            StaxUtils.close(reader);
        }
View Full Code Here

       
        JbiEndpoint jbiEndpoint = (JbiEndpoint) extReg.createExtension(parentType, elementType);

        String role = DOMUtils.getAttribute(el, JbiExtension.ROLE);
        if (role == null) {
            throw new WSDLException(WSDLException.OTHER_ERROR, "Role must be specified");
        } else if (JbiExtension.ROLE_CONSUMER.equals(role)) {
            jbiEndpoint.setRole(Role.CONSUMER);
        } else if (JbiExtension.ROLE_PROVIDER.equals(role)) {
            jbiEndpoint.setRole(Role.PROVIDER);
        } else {
            throw new WSDLException(WSDLException.OTHER_ERROR, "Unrecognized role: " + role);
        }

        String defaultMep = DOMUtils.getAttribute(el, JbiExtension.DEFAULT_MEP);
        if (defaultMep == null) {
            defaultMep = JbiExtension.DEFAULT_MEP_IN_OUT;
View Full Code Here

     */
    public static Port getPort(WSDLManager manager, EndpointReferenceType ref) throws WSDLException {

        Definition def = getWSDLDefinition(manager, ref);
        if (def == null) {
            throw new WSDLException(WSDLException.OTHER_ERROR, "unable to find definition for reference");
        }

        MetadataType metadata = ref.getMetadata();
        for (Object obj : metadata.getAny()) {
           
            if (obj instanceof JAXBElement) {
                Object jaxbVal = ((JAXBElement)obj).getValue();

                if (jaxbVal instanceof ServiceNameType) {
                    Port port = null;
                    ServiceNameType snt = (ServiceNameType)jaxbVal;
                    LOG.log(Level.FINEST, "found service name " + snt.getValue().getLocalPart());
                    Service service = def.getService(snt.getValue());
                    if (service == null) {
                        LOG.log(Level.WARNING, "can't find the service name ["
                                + snt.getValue()
                                + "], using the default service name in wsdl");
                        service = (Service)def.getServices().values().iterator().next();
                        if (service == null) {
                            return null;
                        }
                    }
                    String endpoint = snt.getEndpointName();
                    if ("".equals(endpoint) && service.getPorts().size() == 1) {
                        port = (Port)service.getPorts().values().iterator().next();
                    } else {
                        port = service.getPort(endpoint);
                    }
                    // FIXME this needs to be looked at service.getPort(endpoint)
                    //should not return null when endpoint is valid
                    if (port == null) {
                        LOG.log(Level.WARNING, "can't find the port name ["
                                + endpoint
                                + "], using the default port name in wsdl");
                        port = (Port)service.getPorts().values().iterator().next();
                    }
                    return port;
                }
            }
        }

        if (def.getServices().size() == 1) {
            Service service = (Service)def.getServices().values().iterator().next();
            if (service.getPorts().size() == 1) {
                return (Port)service.getPorts().values().iterator().next();
            }
        }
       
        QName serviceName = getServiceName(ref, null);
        if (null != serviceName) {
            if (StringUtils.isEmpty(serviceName.getNamespaceURI())) {
                serviceName = new QName(def.getTargetNamespace(), serviceName.getLocalPart());
            }
            Service service = def.getService(serviceName);
            if (service == null) {
                throw new WSDLException(WSDLException.OTHER_ERROR, "Cannot find service for " + serviceName);
            }
            if (service.getPorts().size() == 1) {
                return (Port)service.getPorts().values().iterator().next();
            }
            String str = getPortName(ref);
            LOG.log(Level.FINE, "getting port " + str + " from service " + service.getQName());
            Port port = service.getPort(str);
            if (port == null) {
                throw new WSDLException(WSDLException.OTHER_ERROR, "unable to find port " + str);
            }
            return port;
        }
        // TODO : throw exception here
        return null;
View Full Code Here

                } catch (Exception e) {
                    // ignore - probably not DOM level 3
                }
            }
        } catch (Exception e) {
            throw new WSDLException(WSDLException.PARSER_ERROR, e.getMessage(), e);
        }
       
        Definition def = reader.readWSDL(wsdlLocator, doc.getDocumentElement());
        synchronized (definitionsMap) {
            definitionsMap.put(url, def);
View Full Code Here

TOP

Related Classes of javax.wsdl.WSDLException

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.