Search in sources :

Example 1 with OperationDesc

use of org.apache.axis.description.OperationDesc in project spring-cloud-digital-sign by SpringForAll.

the class UserAPIServiceSoapBindingStub method _initOperationDesc2.

private static void _initOperationDesc2() {
    OperationDesc oper;
    ParameterDesc param;
    oper = new OperationDesc();
    oper.setName("queryCertBySerialNumber");
    param = new ParameterDesc(new QName("", "serialNumber"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "accountHash"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "json"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    oper.setReturnType(new QName("http://service.ra.tca.topca.cn/", "queryCertResult"));
    oper.setReturnClass(QueryCertResult.class);
    oper.setReturnQName(new QName("", "return"));
    oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
    oper.setUse(org.apache.axis.constants.Use.LITERAL);
    oper.addFault(new org.apache.axis.description.FaultDesc(new QName("http://service.ra.tca.topca.cn/", "RaServiceUnavailable"), "RaServiceUnavailable", new QName("http://service.ra.tca.topca.cn/", "RaServiceUnavailable"), true));
    _operations[10] = oper;
    oper = new OperationDesc();
    oper.setName("synchroTemplate");
    param = new ParameterDesc(new QName("", "accountHash"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    oper.setReturnType(new QName("http://service.ra.tca.topca.cn/", "accountConfigResult"));
    oper.setReturnClass(AccountConfigResult.class);
    oper.setReturnQName(new QName("", "return"));
    oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
    oper.setUse(org.apache.axis.constants.Use.LITERAL);
    oper.addFault(new org.apache.axis.description.FaultDesc(new QName("http://service.ra.tca.topca.cn/", "RaServiceUnavailable"), "RaServiceUnavailable", new QName("http://service.ra.tca.topca.cn/", "RaServiceUnavailable"), true));
    _operations[11] = oper;
    oper = new OperationDesc();
    oper.setName("renewCert");
    param = new ParameterDesc(new QName("", "userInfo"), ParameterDesc.IN, new QName("http://service.ra.tca.topca.cn/", "userInfo"), UserInfo.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "origin"), ParameterDesc.IN, new QName("http://service.ra.tca.topca.cn/", "certInfo"), CertInfo.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "accountHash"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "json"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    oper.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);
    oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
    oper.setUse(org.apache.axis.constants.Use.LITERAL);
    oper.addFault(new org.apache.axis.description.FaultDesc(new QName("http://service.ra.tca.topca.cn/", "RaServiceUnavailable"), "RaServiceUnavailable", new QName("http://service.ra.tca.topca.cn/", "RaServiceUnavailable"), true));
    _operations[12] = oper;
    oper = new OperationDesc();
    oper.setName("revokeCert");
    param = new ParameterDesc(new QName("", "serialNumber"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "certReqChallenge"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "certRevokeReason"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "accountHash"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "json"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    oper.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);
    oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
    oper.setUse(org.apache.axis.constants.Use.LITERAL);
    oper.addFault(new org.apache.axis.description.FaultDesc(new QName("http://service.ra.tca.topca.cn/", "RaServiceUnavailable"), "RaServiceUnavailable", new QName("http://service.ra.tca.topca.cn/", "RaServiceUnavailable"), true));
    _operations[13] = oper;
    oper = new OperationDesc();
    oper.setName("suspendCert");
    param = new ParameterDesc(new QName("", "serialNumber"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "accountHash"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "json"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    oper.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);
    oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
    oper.setUse(org.apache.axis.constants.Use.LITERAL);
    oper.addFault(new org.apache.axis.description.FaultDesc(new QName("http://service.ra.tca.topca.cn/", "RaServiceUnavailable"), "RaServiceUnavailable", new QName("http://service.ra.tca.topca.cn/", "RaServiceUnavailable"), true));
    _operations[14] = oper;
    oper = new OperationDesc();
    oper.setName("enrollCertAA");
    param = new ParameterDesc(new QName("", "userInfo"), ParameterDesc.IN, new QName("http://service.ra.tca.topca.cn/", "userInfo"), UserInfo.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "certReqBuf"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "accountHash"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "aaCheckPoint"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "passCode"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("", "json"), ParameterDesc.IN, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
    param.setOmittable(true);
    oper.addParameter(param);
    oper.setReturnType(new QName("http://service.ra.tca.topca.cn/", "certInfo"));
    oper.setReturnClass(CertInfo.class);
    oper.setReturnQName(new QName("", "return"));
    oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
    oper.setUse(org.apache.axis.constants.Use.LITERAL);
    oper.addFault(new org.apache.axis.description.FaultDesc(new QName("http://service.ra.tca.topca.cn/", "RaServiceUnavailable"), "RaServiceUnavailable", new QName("http://service.ra.tca.topca.cn/", "RaServiceUnavailable"), true));
    _operations[15] = oper;
}
Also used : ParameterDesc(org.apache.axis.description.ParameterDesc) CertInfo(com.liumapp.digitalsign.test.ca.tianwei.cert.CertInfo) QName(javax.xml.namespace.QName) OperationDesc(org.apache.axis.description.OperationDesc)

Example 2 with OperationDesc

use of org.apache.axis.description.OperationDesc in project tomee by apache.

the class EjbRpcProvider method processMessage.

/**
 * @param msgContext msgContext
 * @param reqEnv reqEnv
 * @param resEnv resEnv
 * @param obj obj
 * @throws Exception
 */
@Override
public void processMessage(MessageContext msgContext, SOAPEnvelope reqEnv, SOAPEnvelope resEnv, Object obj) throws Exception {
    RPCElement body = getBody(reqEnv, msgContext);
    OperationDesc operation = getOperationDesc(msgContext, body);
    AxisRpcInterceptor interceptor = new AxisRpcInterceptor(operation, msgContext);
    SOAPMessage message = msgContext.getMessage();
    try {
        message.getSOAPPart().getEnvelope();
        msgContext.setProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION, Boolean.FALSE);
        RpcContainer container = (RpcContainer) ejbDeployment.getContainer();
        Object[] arguments = { msgContext, interceptor };
        Class callInterface = ejbDeployment.getServiceEndpointInterface();
        Object result = container.invoke(ejbDeployment.getDeploymentID(), InterfaceType.SERVICE_ENDPOINT, callInterface, operation.getMethod(), arguments, null);
        interceptor.createResult(result);
    } catch (ApplicationException e) {
        interceptor.createExceptionResult(e.getCause());
    } catch (Throwable throwable) {
        throw new AxisFault("Web Service EJB Invocation failed: method " + operation.getMethod(), throwable);
    }
}
Also used : AxisFault(org.apache.axis.AxisFault) RpcContainer(org.apache.openejb.RpcContainer) ApplicationException(org.apache.openejb.ApplicationException) RPCElement(org.apache.axis.message.RPCElement) OperationDesc(org.apache.axis.description.OperationDesc) SOAPMessage(javax.xml.soap.SOAPMessage)

Example 3 with OperationDesc

use of org.apache.axis.description.OperationDesc in project tomee by apache.

the class JavaServiceDescBuilder method createServiceDesc.

public JavaServiceDesc createServiceDesc() throws OpenEJBException {
    Class serviceEndpointInterface;
    try {
        serviceEndpointInterface = classLoader.loadClass(serviceInfo.serviceEndpointInterface);
    } catch (ClassNotFoundException e) {
        throw new OpenEJBException("Unable to load the service endpoint interface " + serviceInfo.serviceEndpointInterface, e);
    }
    JavaServiceDesc serviceDesc = new JavaServiceDesc();
    serviceDesc.setName(serviceInfo.name);
    serviceDesc.setEndpointURL(serviceInfo.endpointURL);
    serviceDesc.setWSDLFile(serviceInfo.wsdlFile);
    BindingStyle bindingStyle = serviceInfo.defaultBindingStyle;
    switch(bindingStyle) {
        case RPC_ENCODED:
            serviceDesc.setStyle(Style.RPC);
            serviceDesc.setUse(Use.ENCODED);
            break;
        case RPC_LITERAL:
            serviceDesc.setStyle(Style.RPC);
            serviceDesc.setUse(Use.LITERAL);
            break;
        case DOCUMENT_ENCODED:
            serviceDesc.setStyle(Style.DOCUMENT);
            serviceDesc.setUse(Use.ENCODED);
            break;
        case DOCUMENT_LITERAL:
            serviceDesc.setStyle(Style.DOCUMENT);
            serviceDesc.setUse(Use.LITERAL);
            break;
        case DOCUMENT_LITERAL_WRAPPED:
            serviceDesc.setStyle(Style.WRAPPED);
            serviceDesc.setUse(Use.LITERAL);
            break;
    }
    // Operations
    for (JaxRpcOperationInfo operationInfo : serviceInfo.operations) {
        OperationDesc operationDesc = buildOperationDesc(operationInfo, serviceEndpointInterface);
        serviceDesc.addOperationDesc(operationDesc);
    }
    // Type mapping registry
    TypeMappingRegistryImpl typeMappingRegistry = new TypeMappingRegistryImpl();
    typeMappingRegistry.doRegisterFromVersion("1.3");
    serviceDesc.setTypeMappingRegistry(typeMappingRegistry);
    // Type mapping
    TypeMapping typeMapping = typeMappingRegistry.getOrMakeTypeMapping(serviceDesc.getUse().getEncoding());
    serviceDesc.setTypeMapping(typeMapping);
    // Types
    for (JaxRpcTypeInfo type : serviceInfo.types) {
        registerType(type, typeMapping);
    }
    return new ReadOnlyServiceDesc(serviceDesc);
}
Also used : OpenEJBException(org.apache.openejb.OpenEJBException) BindingStyle(org.apache.openejb.server.axis.assembler.BindingStyle) JavaServiceDesc(org.apache.axis.description.JavaServiceDesc) JaxRpcOperationInfo(org.apache.openejb.server.axis.assembler.JaxRpcOperationInfo) TypeMappingRegistryImpl(org.apache.axis.encoding.TypeMappingRegistryImpl) TypeMapping(org.apache.axis.encoding.TypeMapping) JaxRpcTypeInfo(org.apache.openejb.server.axis.assembler.JaxRpcTypeInfo) OperationDesc(org.apache.axis.description.OperationDesc)

Example 4 with OperationDesc

use of org.apache.axis.description.OperationDesc 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;
}
Also used : ParameterDesc(org.apache.axis.description.ParameterDesc) OpenEJBException(org.apache.openejb.OpenEJBException) JaxRpcFaultInfo(org.apache.openejb.server.axis.assembler.JaxRpcFaultInfo) OperationDesc(org.apache.axis.description.OperationDesc) Method(java.lang.reflect.Method) JaxRpcParameterInfo(org.apache.openejb.server.axis.assembler.JaxRpcParameterInfo) FaultDesc(org.apache.axis.description.FaultDesc)

Example 5 with OperationDesc

use of org.apache.axis.description.OperationDesc in project tomee by apache.

the class AxisWsContainerTest method testInvokeSOAP.

public void testInvokeSOAP() throws Exception {
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    JavaServiceDesc serviceDesc = new JavaServiceDesc();
    serviceDesc.setEndpointURL("http://127.0.0.1:8080/axis/services/echo");
    // serviceDesc.setWSDLFile(portInfo.getWsdlURL().toExternalForm());
    serviceDesc.setStyle(Style.RPC);
    serviceDesc.setUse(Use.ENCODED);
    TypeMappingRegistryImpl tmr = new TypeMappingRegistryImpl();
    tmr.doRegisterFromVersion("1.3");
    TypeMapping typeMapping = tmr.getOrMakeTypeMapping(serviceDesc.getUse().getEncoding());
    serviceDesc.setTypeMappingRegistry(tmr);
    serviceDesc.setTypeMapping(typeMapping);
    OperationDesc op = new OperationDesc();
    op.setName("echoString");
    op.setStyle(Style.RPC);
    op.setUse(Use.ENCODED);
    Class beanClass = EchoBean.class;
    op.setMethod(beanClass.getMethod("echoString", String.class));
    ParameterDesc parameter = new ParameterDesc(new QName("http://ws.apache.org/echosample", "in0"), ParameterDesc.IN, typeMapping.getTypeQName(String.class), String.class, false, false);
    op.addParameter(parameter);
    serviceDesc.addOperationDesc(op);
    serviceDesc.getOperations();
    ReadOnlyServiceDesc sd = new ReadOnlyServiceDesc(serviceDesc);
    Class pojoClass = cl.loadClass("org.apache.openejb.server.axis.EchoBean");
    RPCProvider provider = new PojoProvider();
    SOAPService service = new SOAPService(null, provider, null);
    service.setServiceDescription(sd);
    service.setOption("className", "org.apache.openejb.server.axis.EchoBean");
    URL wsdlURL = new URL("http://fake/echo.wsdl");
    URI location = new URI(serviceDesc.getEndpointURL());
    Map wsdlMap = new HashMap();
    AxisWsContainer container = new AxisWsContainer(wsdlURL, service, wsdlMap, cl);
    InputStream in = cl.getResourceAsStream("echoString-req.txt");
    try {
        AxisRequest req = new AxisRequest(504, "text/xml; charset=utf-8", new ServletIntputStreamAdapter(in), HttpRequest.Method.GET, new HashMap<String, String>(), location, new HashMap<String, String>(), "127.0.0.1");
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        AxisResponse res = new AxisResponse("text/xml; charset=utf-8", "127.0.0.1", null, null, 8080, new ServletOutputStreamAdapter(out));
        req.setAttribute(WsConstants.POJO_INSTANCE, pojoClass.newInstance());
        container.onMessage(req, res);
        out.flush();
    // log.debug(new String(out.toByteArray()));
    } finally {
        if (in != null) {
            try {
                in.close();
            } catch (IOException ignore) {
            // ignore
            }
        }
    }
}
Also used : ParameterDesc(org.apache.axis.description.ParameterDesc) HashMap(java.util.HashMap) TypeMappingRegistryImpl(org.apache.axis.encoding.TypeMappingRegistryImpl) RPCProvider(org.apache.axis.providers.java.RPCProvider) URI(java.net.URI) URL(java.net.URL) ServletIntputStreamAdapter(org.apache.openejb.server.httpd.ServletIntputStreamAdapter) JavaServiceDesc(org.apache.axis.description.JavaServiceDesc) SOAPService(org.apache.axis.handlers.soap.SOAPService) QName(javax.xml.namespace.QName) InputStream(java.io.InputStream) OperationDesc(org.apache.axis.description.OperationDesc) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) ServletOutputStreamAdapter(org.apache.openejb.server.httpd.ServletOutputStreamAdapter) TypeMapping(org.apache.axis.encoding.TypeMapping) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

OperationDesc (org.apache.axis.description.OperationDesc)6 ParameterDesc (org.apache.axis.description.ParameterDesc)4 QName (javax.xml.namespace.QName)3 CertInfo (com.liumapp.digitalsign.test.ca.tianwei.cert.CertInfo)2 JavaServiceDesc (org.apache.axis.description.JavaServiceDesc)2 TypeMapping (org.apache.axis.encoding.TypeMapping)2 TypeMappingRegistryImpl (org.apache.axis.encoding.TypeMappingRegistryImpl)2 OpenEJBException (org.apache.openejb.OpenEJBException)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Method (java.lang.reflect.Method)1 URI (java.net.URI)1 URL (java.net.URL)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 SOAPMessage (javax.xml.soap.SOAPMessage)1 AxisFault (org.apache.axis.AxisFault)1 FaultDesc (org.apache.axis.description.FaultDesc)1 SOAPService (org.apache.axis.handlers.soap.SOAPService)1