Search in sources :

Example 1 with JavaMethodImpl

use of com.sun.xml.ws.model.JavaMethodImpl in project metro-jax-ws by eclipse-ee4j.

the class WSDLGenerator method generatePortType.

/**
 * Generates the WSDL portType
 */
protected void generatePortType() {
    PortType portType = portDefinitions.portType().name(model.getPortTypeName().getLocalPart());
    extension.addPortTypeExtension(portType);
    for (JavaMethodImpl method : model.getJavaMethods()) {
        Operation operation = portType.operation().name(method.getOperationName());
        generateParameterOrder(operation, method);
        extension.addOperationExtension(operation, method);
        switch(method.getMEP()) {
            case REQUEST_RESPONSE:
                // input message
                generateInputMessage(operation, method);
                // output message
                generateOutputMessage(operation, method);
                break;
            case ONE_WAY:
                generateInputMessage(operation, method);
                break;
            default:
                break;
        }
        // faults
        for (CheckedExceptionImpl exception : method.getCheckedExceptions()) {
            QName messageName = new QName(model.getTargetNamespace(), exception.getMessageName());
            FaultType paramType = operation.fault().message(messageName).name(exception.getMessageName());
            extension.addOperationFaultExtension(paramType, method, exception);
        }
    }
}
Also used : JavaMethodImpl(com.sun.xml.ws.model.JavaMethodImpl) QName(javax.xml.namespace.QName) CheckedExceptionImpl(com.sun.xml.ws.model.CheckedExceptionImpl) Operation(com.sun.xml.ws.wsdl.writer.document.Operation) FaultType(com.sun.xml.ws.wsdl.writer.document.FaultType) PortType(com.sun.xml.ws.wsdl.writer.document.PortType)

Example 2 with JavaMethodImpl

use of com.sun.xml.ws.model.JavaMethodImpl in project metro-jax-ws by eclipse-ee4j.

the class WsaTubeHelper method getOutputAction.

public String getOutputAction(Packet packet) {
    // String action = AddressingVersion.UNSET_OUTPUT_ACTION;
    String action = null;
    WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping();
    if (wsdlOp != null) {
        JavaMethod javaMethod = wsdlOp.getJavaMethod();
        if (javaMethod != null) {
            JavaMethodImpl jm = (JavaMethodImpl) javaMethod;
            if (jm != null && jm.getOutputAction() != null && !jm.getOutputAction().equals("")) {
                return jm.getOutputAction();
            }
        }
        WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation();
        if (wbo != null)
            return getOutputAction(wbo);
    }
    return action;
}
Also used : WSDLOperationMapping(com.sun.xml.ws.api.model.WSDLOperationMapping) JavaMethodImpl(com.sun.xml.ws.model.JavaMethodImpl) WSDLBoundOperation(com.sun.xml.ws.api.model.wsdl.WSDLBoundOperation) JavaMethod(com.sun.xml.ws.api.model.JavaMethod)

Example 3 with JavaMethodImpl

use of com.sun.xml.ws.model.JavaMethodImpl in project metro-jax-ws by eclipse-ee4j.

the class WsaTubeHelper method getFaultActionFromSEIModel.

String getFaultActionFromSEIModel(Packet requestPacket, Packet responsePacket) {
    String action = null;
    if (seiModel == null || wsdlPort == null) {
        return action;
    }
    try {
        SOAPMessage sm = responsePacket.getMessage().copy().readAsSOAPMessage();
        if (sm == null) {
            return action;
        }
        if (sm.getSOAPBody() == null) {
            return action;
        }
        if (sm.getSOAPBody().getFault() == null) {
            return action;
        }
        Detail detail = sm.getSOAPBody().getFault().getDetail();
        if (detail == null) {
            return action;
        }
        String ns = detail.getFirstChild().getNamespaceURI();
        String name = detail.getFirstChild().getLocalName();
        WSDLOperationMapping wsdlOp = requestPacket.getWSDLOperationMapping();
        JavaMethodImpl jm = (wsdlOp != null) ? (JavaMethodImpl) wsdlOp.getJavaMethod() : null;
        if (jm != null) {
            for (CheckedExceptionImpl ce : jm.getCheckedExceptions()) {
                if (ce.getDetailType().tagName.getLocalPart().equals(name) && ce.getDetailType().tagName.getNamespaceURI().equals(ns)) {
                    return ce.getFaultAction();
                }
            }
        }
        return action;
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }
}
Also used : WSDLOperationMapping(com.sun.xml.ws.api.model.WSDLOperationMapping) JavaMethodImpl(com.sun.xml.ws.model.JavaMethodImpl) WebServiceException(jakarta.xml.ws.WebServiceException) SOAPException(jakarta.xml.soap.SOAPException) CheckedExceptionImpl(com.sun.xml.ws.model.CheckedExceptionImpl) SOAPMessage(jakarta.xml.soap.SOAPMessage) Detail(jakarta.xml.soap.Detail)

Example 4 with JavaMethodImpl

use of com.sun.xml.ws.model.JavaMethodImpl in project metro-jax-ws by eclipse-ee4j.

the class ServiceArtifactSchemaGenerator method generate.

public void generate(SchemaOutputResolver resolver) {
    xsdResolver = resolver;
    List<WrapperParameter> wrappers = new ArrayList<>();
    for (JavaMethodImpl method : model.getJavaMethods()) {
        if (method.getBinding().isRpcLit())
            continue;
        for (ParameterImpl p : method.getRequestParameters()) {
            if (p instanceof WrapperParameter) {
                if (WrapperComposite.class.equals((p.getTypeInfo().type))) {
                    wrappers.add((WrapperParameter) p);
                }
            }
        }
        for (ParameterImpl p : method.getResponseParameters()) {
            if (p instanceof WrapperParameter) {
                if (WrapperComposite.class.equals((p.getTypeInfo().type))) {
                    wrappers.add((WrapperParameter) p);
                }
            }
        }
    }
    if (wrappers.isEmpty())
        return;
    HashMap<String, Schema> xsds = initWrappersSchemaWithImports(wrappers);
    postInit(xsds);
    for (WrapperParameter wp : wrappers) {
        String tns = wp.getName().getNamespaceURI();
        Schema xsd = xsds.get(tns);
        Element e = xsd._element(Element.class);
        e._attribute("name", wp.getName().getLocalPart());
        e.type(wp.getName());
        ComplexType ct = xsd._element(ComplexType.class);
        ct._attribute("name", wp.getName().getLocalPart());
        ExplicitGroup sq = ct.sequence();
        for (ParameterImpl p : wp.getWrapperChildren()) if (p.getBinding().isBody())
            addChild(sq, p);
    }
    for (Schema xsd : xsds.values()) xsd.commit();
}
Also used : JavaMethodImpl(com.sun.xml.ws.model.JavaMethodImpl) ParameterImpl(com.sun.xml.ws.model.ParameterImpl) Schema(com.sun.xml.ws.wsdl.writer.document.xsd.Schema) LocalElement(org.glassfish.jaxb.runtime.v2.schemagen.xmlschema.LocalElement) Element(org.glassfish.jaxb.runtime.v2.schemagen.xmlschema.Element) ArrayList(java.util.ArrayList) WrapperParameter(com.sun.xml.ws.model.WrapperParameter) ComplexType(org.glassfish.jaxb.runtime.v2.schemagen.xmlschema.ComplexType) ExplicitGroup(org.glassfish.jaxb.runtime.v2.schemagen.xmlschema.ExplicitGroup)

Example 5 with JavaMethodImpl

use of com.sun.xml.ws.model.JavaMethodImpl in project metro-jax-ws by eclipse-ee4j.

the class DatabindingImpl method deserializeRequest.

public JavaCallInfo deserializeRequest(Packet req) {
    com.sun.xml.ws.api.databinding.JavaCallInfo call = new com.sun.xml.ws.api.databinding.JavaCallInfo();
    try {
        JavaMethodImpl wsdlOp = resolveJavaMethod(req);
        TieHandler tie = wsdlOpMap.get(wsdlOp);
        call.setMethod(tie.getMethod());
        Object[] args = tie.readRequest(req.getMessage());
        call.setParameters(args);
    } catch (DispatchException e) {
        call.setException(e);
    }
    return call;
}
Also used : JavaMethodImpl(com.sun.xml.ws.model.JavaMethodImpl) DispatchException(com.sun.xml.ws.wsdl.DispatchException) JavaCallInfo(com.oracle.webservices.api.databinding.JavaCallInfo) TieHandler(com.sun.xml.ws.server.sei.TieHandler)

Aggregations

JavaMethodImpl (com.sun.xml.ws.model.JavaMethodImpl)8 WSDLOperationMapping (com.sun.xml.ws.api.model.WSDLOperationMapping)2 WSDLBoundOperation (com.sun.xml.ws.api.model.wsdl.WSDLBoundOperation)2 CheckedExceptionImpl (com.sun.xml.ws.model.CheckedExceptionImpl)2 Method (java.lang.reflect.Method)2 HashMap (java.util.HashMap)2 JavaCallInfo (com.oracle.webservices.api.databinding.JavaCallInfo)1 SOAPVersion (com.sun.xml.ws.api.SOAPVersion)1 WSBinding (com.sun.xml.ws.api.WSBinding)1 JavaMethod (com.sun.xml.ws.api.model.JavaMethod)1 ParameterBinding (com.sun.xml.ws.api.model.ParameterBinding)1 SOAPBinding (com.sun.xml.ws.api.model.soap.SOAPBinding)1 StubAsyncHandler (com.sun.xml.ws.client.sei.StubAsyncHandler)1 StubHandler (com.sun.xml.ws.client.sei.StubHandler)1 ParameterImpl (com.sun.xml.ws.model.ParameterImpl)1 WrapperParameter (com.sun.xml.ws.model.WrapperParameter)1 TieHandler (com.sun.xml.ws.server.sei.TieHandler)1 ActionBasedOperationSignature (com.sun.xml.ws.wsdl.ActionBasedOperationSignature)1 DispatchException (com.sun.xml.ws.wsdl.DispatchException)1 Binding (com.sun.xml.ws.wsdl.writer.document.Binding)1