Package javax.xml.ws

Examples of javax.xml.ws.WebServiceException


          action = "POST"; //$NON-NLS-1$
        }
        dispatch.getRequestContext().put(MessageContext.HTTP_REQUEST_METHOD, action);
        if (source != null && !"POST".equalsIgnoreCase(action)) { //$NON-NLS-1$
          if (this.executionFactory.getXMLParamName() == null) {
            throw new WebServiceException(WSExecutionFactory.UTIL.getString("http_usage_error")); //$NON-NLS-1$
          }
          try {
            Transformer t = TransformerFactory.newInstance().newTransformer();
            StringWriter writer = new StringWriter();
            //TODO: prevent this from being too large
                t.transform(source, new StreamResult(writer));
            String param = Util.httpURLEncode(this.executionFactory.getXMLParamName())+"="+Util.httpURLEncode(writer.toString()); //$NON-NLS-1$
            endpoint = WSConnection.Util.appendQueryString(endpoint, param);
          } catch (TransformerException e) {
            throw new WebServiceException(e);
          }
        }
      } else {
        if (action != null) {
          dispatch.getRequestContext().put(Dispatch.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
View Full Code Here


        method = "POST"; //$NON-NLS-1$
      }
     
      dispatch.getRequestContext().put(MessageContext.HTTP_REQUEST_METHOD, method);
      if (payload != null && !"POST".equalsIgnoreCase(method)) { //$NON-NLS-1$
        throw new WebServiceException(WSExecutionFactory.UTIL.getString("http_usage_error")); //$NON-NLS-1$
      }

      DataSource ds = null;
      if (payload instanceof String) {
        ds = new InputStreamFactory.ClobInputStreamFactory(new SerialClob(((String)payload).toCharArray()));
View Full Code Here

          ObjectConverterUtil.write(os, is, -1);
        }
       
        return new HttpDataSource(url, httpConn);
      } catch (IOException e) {
        throw new WebServiceException(e);
      }
    }
View Full Code Here

   */
  private Message getMultiPartMessageWithAttachement() throws UnsupportedEncodingException {
    if(input != null){
        String boundary = contentType.getParameter("boundary");
          if (boundary == null || boundary.equals("")) {
              throw new WebServiceException("MIME boundary parameter not found" + contentType);
          }
          
          MIMEMessage message =  new MIMEMessage(input, boundary);
          MIMEPart  jsonPart  = null;   
      for(MIMEPart mimeAttach : message.getAttachments()){
View Full Code Here

            // add the additional provider
            Port port = null;
            try  {
                port = EndpointReferenceUtils.getPort(bus.getWSDLManager(), ref);
            } catch (WSDLException ex) {
                throw new WebServiceException("Could not get port from wsdl", ex);
            }
            portConfiguration.getProviders().add(new WsdlPortProvider(port));
        }       
        return portConfiguration;
    }
View Full Code Here

        try {
            BindingFactory factory = bus.getBindingManager().getBindingFactory(bindingId);
            assert factory != null : "unable to find binding factory for " + bindingId;
            binding = factory.createClientBinding(ref);
        } catch (Exception ex) {
            throw new WebServiceException(ex);
        }
        return binding;
    }
View Full Code Here

    private void throwWebServiceException(Throwable t) {
        if (null != t) {
            LOG.log(Level.SEVERE, "DISPATCH_INVOKE_EXC", cl.getSimpleName());
            throw isJAXWSException(t)
                  ? (WebServiceException)t
                  : new WebServiceException(t);
        }
    }
View Full Code Here

            Method faultInfoMethod = fault.getClass().getMethod("getFaultInfo");
            if (faultInfoMethod != null) {
                return faultInfoMethod.invoke(fault);
            }
        } catch (Exception ex) {
            throw new WebServiceException("Could not get faultInfo out of Exception", ex);
        }

        return null;
    }
View Full Code Here

        try {
            obj = JAXBEncoderDecoder.unmarshall(callback.getJAXBContext(),
                                                callback.getSchema(), childNode,
                                                elName, ClassHelper.forName(wrapperType));
        } catch (ClassNotFoundException e) {
            throw new WebServiceException("Could not unmarshall wrapped type (" + wrapperType + ") ", e);
        }

        if (isOutBound && callback.getWebResult() != null) {
            Method method = callback.getMethod();
            if (JAXBUtils.isAsync(method)) {
                Method syncMethod = callback.getSyncMethod();
                Type gtype = method.getGenericReturnType();
               
                if (Future.class.equals(method.getReturnType())) {
                    Type types[] = method.getGenericParameterTypes();
                    if (types.length > 0 && types[types.length - 1] instanceof ParameterizedType) {
                        gtype = types[types.length - 1];
                    }
                }
                if (gtype instanceof ParameterizedType
                    && ((ParameterizedType)gtype).getActualTypeArguments().length == 1
                    && ((ParameterizedType)gtype).getActualTypeArguments()[0] instanceof Class) {
                    Class cls = (Class)((ParameterizedType)gtype).getActualTypeArguments()[0];
                    if (cls.getName().equals(wrapperType)) {
                        syncMethod = null;
                    }
                }
                method = syncMethod;
            }
            if (method != null) {
                Object retVal = callback.getWrappedPart(callback.getWebResultQName().getLocalPart(),
                                                        obj,      
                                                        method.getReturnType());
                objCtx.setReturn(retVal);
            } else {
                objCtx.setReturn(obj);
            }
        }

        WebParam.Mode ignoreParamMode = isOutBound ? WebParam.Mode.IN : WebParam.Mode.OUT;
        int noArgs = callback.getMethod().getParameterTypes().length;
        try {
            for (int idx = 0; idx < noArgs; idx++) {
                WebParam param = callback.getWebParam(idx);
                if ((param.mode() != ignoreParamMode) && !param.header()) {
                    Class<?> cls = callback.getMethod().getParameterTypes()[idx];               
                    if (param.mode() != WebParam.Mode.IN) {
                        //INOUT and OUT Params are mapped to Holder<T>.
                        Type[] genericParameterTypes = callback.getMethod().getGenericParameterTypes();
                        //ParameterizedType represents Holder<?>
                        ParameterizedType paramType = (ParameterizedType)genericParameterTypes[idx];
                        Class<?> c =
                            JAXBEncoderDecoder.getClassFromType(paramType.getActualTypeArguments()[0]);
                        Object partValue = callback.getWrappedPart(param.name(), obj, c);
                        //TO avoid type safety warning the Holder
                        //needs tobe set as below.                       
                        cls.getField("value").set(methodArgs[idx], partValue);
                    } else {
                        methodArgs[idx] = callback.getWrappedPart(param.name(), obj, cls);
                    }
                }
            }
        } catch (IllegalAccessException iae) {
            throw new WebServiceException("Could not unwrap the parts.", iae);
        } catch (NoSuchFieldException nsfe) {
            throw new WebServiceException("Could not unwrap the parts.", nsfe);
        }
    }
View Full Code Here

        } catch (InvocationTargetException ite) {
            LOG.log(Level.SEVERE, "BINDING_PROVIDER_METHOD_EXC", method.getName());
            if (WebServiceException.class.isAssignableFrom(ite.getCause().getClass())) {
                throw (WebServiceException)ite.getCause();
            }
            throw new WebServiceException(ite.getCause());
        } catch (Exception ex) {
            LOG.log(Level.SEVERE, "BINDING_PROVIDER_METHOD_EXC", method.getName());
            throw new WebServiceException(ex);
        }
    }
View Full Code Here

TOP

Related Classes of javax.xml.ws.WebServiceException

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.