Package org.oasisopen.sca

Examples of org.oasisopen.sca.ServiceRuntimeException


                    processor = null;
                    return false;
                }
            }
        } catch (Throwable e) {
            throw new ServiceRuntimeException(e);
        }
        return true;
    }
View Full Code Here


                subject1.getPolicySets().addAll(subject2.getPolicySets());
                subject1.getRequiredIntents().addAll(subject2.getRequiredIntents());
            }
            return binding;
        } catch (Throwable e) {
            throw new ServiceRuntimeException(e);
        }

    }
View Full Code Here

     */
    protected QName chooseBinding(RuntimeEndpointReference endpointReference) {
        if(endpointReference.getTargetEndpoint().isRemote()) {
            RuntimeComponentReference ref = (RuntimeComponentReference)endpointReference.getReference();
            if(ref.getInterfaceContract() != null && !ref.getInterfaceContract().getInterface().isRemotable()) {
                throw new ServiceRuntimeException("Reference interface not remotable for component: "
                        + endpointReference.getComponent().getName()
                        + " and reference: "
                        + ref.getName());
            }
           
View Full Code Here

        InterfaceContract targetInterfaceContract = target.getComponentServiceInterfaceContract();
        try {
            interfaceContractMapper.checkCompatibility(wsdlInterfaceContract, targetInterfaceContract,
                                                       Compatibility.SUBSET, true, false);
        } catch (IncompatibleInterfaceContractException exc) {
            throw new ServiceRuntimeException(exc);
        }

        String dataBinding = getDataBinding();

        // Clone
        try {
            wsdlInterfaceContract = (WSDLInterfaceContract)wsdlInterfaceContract.clone();
        } catch (CloneNotSupportedException exc) {
            throw new ServiceRuntimeException(exc);
        }

        if (wsdlInterfaceContract.getInterface() != null) {            
            wsdlInterfaceContract.getInterface().resetDataBinding(dataBinding);
        }
View Full Code Here

               
                SOAPBody body = env.getBody();
                body.addChild(operationNameElement);
               
            } else if (wsBinding.isRpcEncoded()){
                throw new ServiceRuntimeException("rpc/encoded WSDL style not supported for endpoint reference " + endpointReference);
            } else if (wsBinding.isDocEncoded()){
                throw new ServiceRuntimeException("doc/encoded WSDL style not supported for endpoint reference " + endpointReference);
           // } else if (wsBinding.isDocLiteralUnwrapped()){
           //     throw new ServiceRuntimeException("doc/literal/unwrapped WSDL style not supported for endpoint reference " + endpointReference);
            } else if (wsBinding.isDocLiteralWrapped() ||
                       wsBinding.isDocLiteralUnwrapped()){
                // it's doc/lit
                SOAPBody body = env.getBody();
                for (Object bc : args) {
                    if (bc instanceof OMElement) {
                        body.addChild((OMElement)bc);
                    } else {
                        throw new IllegalArgumentException( "Can't handle mixed payloads between OMElements and other types for endpoint reference " + endpointReference);
                    }
                }
            } else {
                throw new ServiceRuntimeException("Unrecognized WSDL style for endpoint reference " + endpointReference);
            }
        }
       
        final MessageContext requestMC = new MessageContext();
        requestMC.setEnvelope(env);
View Full Code Here

        if (options.getTo() == null) {
            Endpoint ep = msg.getTo();
            if (ep != null && ep.getBinding() != null) {
                address = ep.getBinding().getURI();
            } else {
                throw new ServiceRuntimeException("[BWS20025] Unable to determine destination endpoint for endpoint reference " + endpointReference);
            }
        } else {
          address = options.getTo().getAddress();
        }
       
View Full Code Here

                        JSONObject jsonResponse = new JSONObject();
                        jsonResponse.put("result", "");
                        //get response to send to client
                        return jsonResponse.toString().getBytes("UTF-8");
                    } catch (Exception e) {
                        throw new ServiceRuntimeException("Unable to create JSON response", e);
                    }

                } else {
                    // regular operation returning some value
                    try {
                        result = responseMessage.getBody();
                        JSONObject jsonResponse = new JSONObject();
                        //JSONObject put will remove the entry if it's value is null
                        //and per javadoc, we should pass JSONObject.NULL
                        if(result == null) {
                            jsonResponse.put("result", JSONObject.NULL);
                        } else {
                            jsonResponse.put("result", result);
                        }
                        jsonResponse.putOpt("id", id);
                        //get response to send to client
                        return jsonResponse.toString().getBytes("UTF-8");
                    } catch (Exception e) {
                        throw new ServiceRuntimeException("Unable to create JSON response", e);
                    }
                }
            }
        } else {
            //exception thrown while executing the invocation
View Full Code Here

                            return msg;
                        }

                        //check requestId
                        if (!requestId.equalsIgnoreCase(jsonResponse.optString("id"))) {
                            throw new ServiceRuntimeException("Invalid response id:" + requestId);
                        }

                        Object rawResult = jsonResponse.get("result");
                        if (rawResult == null) {
                            processException(jsonResponse);
                        }

                        Class<?> returnClass = returnType.getPhysical();
                        Type genericReturnType = returnType.getGenericType();

                        ObjectMapper mapper = createObjectMapper(returnClass);
                        String json = rawResult.toString();

                        // Jackson requires the quoted String so that readValue can work
                        if (returnClass == String.class) {
                            json = "\"" + json + "\"";
                        }
                        Object body = mapper.readValue(json, TypeFactory.type(genericReturnType));

                        msg.setBody(body);
                    } else {
                        msg.setBody(entityResponse);
                    }

                } catch (Exception e) {
                    //FIXME Exceptions are not handled correctly here
                    // They should be reported to the client JavaScript as proper
                    // JavaScript exceptions.
                    throw new ServiceRuntimeException("Unable to parse response", e);
                }
            }
        } catch (Exception e) {
            // e.printStackTrace();
            msg.setFaultBody(e);
View Full Code Here

     * Generate and throw exception based on the data in the 'responseMessage'
     */
    protected void processException(JSONObject responseMessage) throws JSONException {
        JSONObject error = (JSONObject)responseMessage.get("error");
        if (error != null) {
            throw new ServiceRuntimeException(error.toString());
        } else {
            throw new ServiceRuntimeException(responseMessage.toString());
        }
    }
View Full Code Here

                runningComponentContributions.put(componentName, curi);
            }
            txn.commit();
        } catch (Throwable e) {
            txn.rollback();
            throw new ServiceRuntimeException(e);
        }
        logger.info("Add endpoint - " + endpoint);
    }
View Full Code Here

TOP

Related Classes of org.oasisopen.sca.ServiceRuntimeException

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.