use of org.apache.axis.description.FaultDesc in project tomee by apache.
the class JavaServiceDescBuilder method buildFaultDesc.
private FaultDesc buildFaultDesc(JaxRpcFaultInfo faultInfo) throws OpenEJBException {
FaultDesc faultDesc = new FaultDesc(faultInfo.qname, faultInfo.javaType, faultInfo.xmlType, faultInfo.complex);
ArrayList<ParameterDesc> parameters = new ArrayList<ParameterDesc>();
for (JaxRpcParameterInfo parameterInfo : faultInfo.parameters) {
ParameterDesc parameterDesc = buildParameterDesc(parameterInfo);
parameters.add(parameterDesc);
}
faultDesc.setParameters(parameters);
return faultDesc;
}
use of org.apache.axis.description.FaultDesc in project tomee by apache.
the class JavaServiceDescBuilder method buildOperationDesc.
private OperationDesc buildOperationDesc(JaxRpcOperationInfo operationInfo, Class serviceEndpointInterface) throws OpenEJBException {
OperationDesc operationDesc = new OperationDesc();
operationDesc.setName(operationInfo.name);
// Binding type
switch(operationInfo.bindingStyle) {
case RPC_ENCODED:
operationDesc.setStyle(Style.RPC);
operationDesc.setUse(Use.ENCODED);
break;
case RPC_LITERAL:
operationDesc.setStyle(Style.RPC);
operationDesc.setUse(Use.LITERAL);
break;
case DOCUMENT_ENCODED:
operationDesc.setStyle(Style.DOCUMENT);
operationDesc.setUse(Use.ENCODED);
break;
case DOCUMENT_LITERAL:
operationDesc.setStyle(Style.DOCUMENT);
operationDesc.setUse(Use.LITERAL);
break;
case DOCUMENT_LITERAL_WRAPPED:
operationDesc.setStyle(Style.WRAPPED);
operationDesc.setUse(Use.LITERAL);
break;
}
// Operation style
switch(operationInfo.operationStyle) {
case NOTIFICATION:
operationDesc.setMep(OperationType.NOTIFICATION);
break;
case ONE_WAY:
operationDesc.setMep(OperationType.ONE_WAY);
break;
case REQUEST_RESPONSE:
operationDesc.setMep(OperationType.REQUEST_RESPONSE);
break;
case SOLICIT_RESPONSE:
operationDesc.setMep(OperationType.SOLICIT_RESPONSE);
break;
}
// Build parameters
Class[] paramTypes = new Class[operationInfo.parameters.size()];
int i = 0;
for (JaxRpcParameterInfo parameterInfo : operationInfo.parameters) {
ParameterDesc parameterDesc = buildParameterDesc(parameterInfo);
operationDesc.addParameter(parameterDesc);
paramTypes[i++] = parameterDesc.getJavaType();
}
// Java method
try {
Method method = serviceEndpointInterface.getMethod(operationInfo.javaMethodName, paramTypes);
operationDesc.setMethod(method);
} catch (NoSuchMethodException e) {
String args = "";
for (Class paramType : paramTypes) {
if (args.length() > 0) {
args += ", ";
}
args += paramType.getName();
}
throw new OpenEJBException("Mapping references non-existent method in service-endpoint: " + operationInfo.javaMethodName + "(" + args + ")");
}
//
if (operationInfo.returnQName != null) {
operationDesc.setReturnQName(operationInfo.returnQName);
operationDesc.setReturnType(operationInfo.returnXmlType);
try {
Class<?> returnClass = classLoader.loadClass(operationInfo.returnJavaType);
operationDesc.setReturnClass(returnClass);
} catch (ClassNotFoundException e) {
throw new OpenEJBException();
}
} else if (operationInfo.operationStyle == JaxRpcOperationInfo.OperationStyle.REQUEST_RESPONSE) {
operationDesc.setReturnQName(null);
operationDesc.setReturnType(XMLType.AXIS_VOID);
operationDesc.setReturnClass(void.class);
}
// Build faults
for (JaxRpcFaultInfo faultInfo : operationInfo.faults) {
FaultDesc faultDesc = buildFaultDesc(faultInfo);
operationDesc.addFault(faultDesc);
}
return operationDesc;
}
Aggregations