Package javax.wsdl

Examples of javax.wsdl.WSDLException


               bindingType = elementType.getNamespaceURI();
            }
         }

         if (bindingType == null)
            throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot obtain binding type for: " + srcBindingQName);

         // Ignore unknown bindings
         if (Constants.NS_SOAP11.equals(bindingType) == false && Constants.NS_SOAP12.equals(bindingType) == false)
            return false;
View Full Code Here


    */
   private Binding getDefinedBinding(Port srcPort) throws WSDLException
   {
      Binding srcBinding = srcPort.getBinding();
      if (srcBinding == null)
         throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find binding for port: " + srcPort.getName());

      QName srcBindingName = srcBinding.getQName();
      if (srcBinding.isUndefined())
      {
         String nsURI = srcBindingName.getNamespaceURI();
         List<Binding> bindings = bindingsByNamespace.get(nsURI);
         if (bindings == null)
            throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find bindings for namespace: " + nsURI);
        
         for (Binding auxBinding : bindings)
         {
            if (srcBindingName.equals(auxBinding.getQName()))
            {
View Full Code Here

   {
      QName srcBindingQName = srcBinding.getQName();

      PortType srcPortType = srcBinding.getPortType();
      if (srcPortType == null)
         throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find port type for binding: " + srcBindingQName);

      QName srcPortTypeName = srcPortType.getQName();
      if (srcPortType.isUndefined())
      {
         String nsURI = srcPortTypeName.getNamespaceURI();
         List<PortType> portTypes = portTypesByNamespace.get(nsURI);
         if (portTypes == null)
            throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find port types for namespace: " + nsURI);

         for (PortType auxPortType : portTypes)
         {
            if (srcPortTypeName.equals(auxPortType.getQName()))
            {
View Full Code Here

                  }
               }
            }

            if (elementName == null)
               throw new WSDLException(WSDLException.INVALID_WSDL, "Could not determine element name from header: " + key);

            WSDLSOAPHeader soapHeader = new WSDLSOAPHeader(elementName, headerPartName);
            soapHeader.setIncludeInSignature(!isImplicitHeader);
            reference.addSoapHeader(soapHeader);
            if (Constants.URI_STYLE_DOCUMENT == destIntfOperation.getStyle())
View Full Code Here

            log.warn("Unprocessed extension element: " + elementType);
         }
      }

      if (soapAddress == null)
         throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot obtain SOAP address");

      return soapAddress;
   }
View Full Code Here

            attrStrValue = strBuf.toString();
          }
          else
          {
            throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
                                    "Unknown type of extension attribute '" +
                                    attrName + "': " +
                                    tempAttrVal.getClass().getName());
          }
        }
        else
        {
          attrStrValue = "";
        }
      }
      else
      {
        throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
                                "Unknown type of extension attribute '" +
                                attrName + "': " +
                                attrValue.getClass().getName());
      }
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);
            }
            def = reader.readWSDL(wsdlLocator, doc.getDocumentElement());
        } else {
            def = reader.readWSDL(wsdlLocator);
        }
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

        props.put("yoko.orb.id", "Yoko-Client-Binding");

        orb = ORB.init(new String[0], props);
        if (orb == null) {
            LOG.severe("Could not create instance of the ORB");
            throw new WSDLException(WSDLException.OTHER_ERROR,
                    "Could not create instance of the ORB");
        }

        try {
            // obtain a reference to the target object
            Port wsdlPort = EndpointReferenceUtils.getPort(b.getWSDLManager(),
                    this.endpointRef);

            List extElements = wsdlPort.getExtensibilityElements();
            AddressType address = null;
            for (Iterator iter = extElements.iterator(); iter.hasNext();) {
                Object e = iter.next();
                if (e instanceof AddressType) {
                    address = (AddressType) e;
                    break;
                }
            }

            if (address == null) {
                LOG.log(Level.SEVERE, "Unable to locate a valid CORBA address");
                throw new CorbaBindingException("Unable to locate a valid CORBA address");
            }
           
            if (!isBindingCompatible(address.getLocation())) {
                LOG.log(Level.SEVERE, "Address not a valid CORBA address");
                throw new CorbaBindingException("Address not a valid CORBA address");
            }

            target = CorbaUtils.importObjectReference(orb, address.getLocation());
        } catch (java.lang.Exception ex) {
            LOG.log(Level.SEVERE, "Could not resolve target object");
            throw new WSDLException(WSDLException.OTHER_ERROR, "Could not resolve target object", ex);
        }

        corbaBinding = new CorbaBindingImpl(b, ref, orb, false);
    }
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.