com.sun.xml.internal.ws.api.model.ParameterBinding Java Examples

The following examples show how to use com.sun.xml.internal.ws.api.model.ParameterBinding. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RuntimeWSDLParser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns true if body has explicit parts declaration
 */
private static boolean parseSOAPBodyBinding(XMLStreamReader reader, Map<String, ParameterBinding> parts) {
    String partsString = reader.getAttributeValue(null, "parts");
    if (partsString != null) {
        List<String> partsList = XmlUtil.parseTokenList(partsString);
        if (partsList.isEmpty()) {
            parts.put(" ", ParameterBinding.BODY);
        } else {
            for (String part : partsList) {
                parts.put(part, ParameterBinding.BODY);
            }
        }
        return true;
    }
    return false;
}
 
Example #2
Source File: WSDLBoundOperationImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Gets {@link ParameterBinding} for a given wsdl part in wsdl:output
 *
 * @param part Name of wsdl:part, must be non-null
 * @return null if the part is not found.
 */
public ParameterBinding getOutputBinding(String part){
    if(emptyOutputBody == null){
        if(outputParts.get(" ") != null)
            emptyOutputBody = true;
        else
            emptyOutputBody = false;
    }
    ParameterBinding block = outputParts.get(part);
    if(block == null){
        if(explicitOutputSOAPBodyParts || emptyOutputBody)
            return ParameterBinding.UNBOUND;
        return ParameterBinding.BODY;
    }

    return block;
}
 
Example #3
Source File: RuntimeWSDLParser.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns true if body has explicit parts declaration
 */
private static boolean parseSOAPBodyBinding(XMLStreamReader reader, Map<String, ParameterBinding> parts) {
    String partsString = reader.getAttributeValue(null, "parts");
    if (partsString != null) {
        List<String> partsList = XmlUtil.parseTokenList(partsString);
        if (partsList.isEmpty()) {
            parts.put(" ", ParameterBinding.BODY);
        } else {
            for (String part : partsList) {
                parts.put(part, ParameterBinding.BODY);
            }
        }
        return true;
    }
    return false;
}
 
Example #4
Source File: WSDLBoundOperationImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Gets {@link ParameterBinding} for a given wsdl part in wsdl:fault
 *
 * @param part Name of wsdl:part, must be non-null
 * @return null if the part is not found.
 */
public ParameterBinding getFaultBinding(String part){
    if(emptyFaultBody == null){
        if(faultParts.get(" ") != null)
            emptyFaultBody = true;
        else
            emptyFaultBody = false;
    }
    ParameterBinding block = faultParts.get(part);
    if(block == null){
        if(explicitFaultSOAPBodyParts || emptyFaultBody)
            return ParameterBinding.UNBOUND;
        return ParameterBinding.BODY;
    }

    return block;
}
 
Example #5
Source File: WSDLBoundOperationImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Gets {@link ParameterBinding} for a given wsdl part in wsdl:output
 *
 * @param part Name of wsdl:part, must be non-null
 * @return null if the part is not found.
 */
public ParameterBinding getOutputBinding(String part){
    if(emptyOutputBody == null){
        if(outputParts.get(" ") != null)
            emptyOutputBody = true;
        else
            emptyOutputBody = false;
    }
    ParameterBinding block = outputParts.get(part);
    if(block == null){
        if(explicitOutputSOAPBodyParts || emptyOutputBody)
            return ParameterBinding.UNBOUND;
        return ParameterBinding.BODY;
    }

    return block;
}
 
Example #6
Source File: RuntimeWSDLParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns true if body has explicit parts declaration
 */
private static boolean parseSOAPBodyBinding(XMLStreamReader reader, Map<String, ParameterBinding> parts) {
    String partsString = reader.getAttributeValue(null, "parts");
    if (partsString != null) {
        List<String> partsList = XmlUtil.parseTokenList(partsString);
        if (partsList.isEmpty()) {
            parts.put(" ", ParameterBinding.BODY);
        } else {
            for (String part : partsList) {
                parts.put(part, ParameterBinding.BODY);
            }
        }
        return true;
    }
    return false;
}
 
Example #7
Source File: WSDLBoundOperationImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Gets {@link ParameterBinding} for a given wsdl part in wsdl:input
 *
 * @param part Name of wsdl:part, must be non-null
 * @return null if the part is not found.
 */
public ParameterBinding getInputBinding(String part){
    if(emptyInputBody == null){
        if(inputParts.get(" ") != null)
            emptyInputBody = true;
        else
            emptyInputBody = false;
    }
    ParameterBinding block = inputParts.get(part);
    if(block == null){
        if(explicitInputSOAPBodyParts || emptyInputBody)
            return ParameterBinding.UNBOUND;
        return ParameterBinding.BODY;
    }

    return block;
}
 
Example #8
Source File: WSDLBoundOperationImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Gets {@link ParameterBinding} for a given wsdl part in wsdl:fault
 *
 * @param part Name of wsdl:part, must be non-null
 * @return null if the part is not found.
 */
public ParameterBinding getFaultBinding(String part){
    if(emptyFaultBody == null){
        if(faultParts.get(" ") != null)
            emptyFaultBody = true;
        else
            emptyFaultBody = false;
    }
    ParameterBinding block = faultParts.get(part);
    if(block == null){
        if(explicitFaultSOAPBodyParts || emptyFaultBody)
            return ParameterBinding.UNBOUND;
        return ParameterBinding.BODY;
    }

    return block;
}
 
Example #9
Source File: SOAPSEIModel.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
    protected void populateMaps() {
        int emptyBodyCount = 0;
        for(JavaMethodImpl jm : getJavaMethods()){
            put(jm.getMethod(), jm);
            boolean bodyFound = false;
            for(ParameterImpl p:jm.getRequestParameters()){
                ParameterBinding binding = p.getBinding();
                if(binding.isBody()){
                    put(p.getName(), jm);
                    bodyFound = true;
                }
            }
            if(!bodyFound){
                put(emptyBodyName, jm);
//                System.out.println("added empty body for: "+jm.getMethod().getName());
                emptyBodyCount++;
            }
        }
        if(emptyBodyCount > 1){
            //TODO throw exception
//            System.out.println("Error: Unqiue signature violation - more than 1 empty body!");
        }
    }
 
Example #10
Source File: RuntimeWSDLParser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns true if body has explicit parts declaration
 */
private static boolean parseSOAPBodyBinding(XMLStreamReader reader, Map<String, ParameterBinding> parts) {
    String partsString = reader.getAttributeValue(null, "parts");
    if (partsString != null) {
        List<String> partsList = XmlUtil.parseTokenList(partsString);
        if (partsList.isEmpty()) {
            parts.put(" ", ParameterBinding.BODY);
        } else {
            for (String part : partsList) {
                parts.put(part, ParameterBinding.BODY);
            }
        }
        return true;
    }
    return false;
}
 
Example #11
Source File: WSDLPartImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public WSDLPartImpl(XMLStreamReader xsr, String partName, int index, WSDLPartDescriptor descriptor) {
    super(xsr);
    this.name = partName;
    this.binding = ParameterBinding.UNBOUND;
    this.index = index;
    this.descriptor = descriptor;

}
 
Example #12
Source File: SOAPSEIModel.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param params
 * @param headers
 */
private void fillHeaders(Iterator<ParameterImpl> params, Set<QName> headers, Mode mode) {
    while (params.hasNext()) {
        ParameterImpl param = params.next();
        ParameterBinding binding = (mode == Mode.IN)?param.getInBinding():param.getOutBinding();
        QName name = param.getName();
        if (binding.isHeader() && !headers.contains(name)) {
            headers.add(name);
        }
    }
}
 
Example #13
Source File: WSDLBoundOperationImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 * @param name wsdl:operation name qualified value
 */
public WSDLBoundOperationImpl(XMLStreamReader xsr, EditableWSDLBoundPortType owner, QName name) {
    super(xsr);
    this.name = name;
    inputParts = new HashMap<String, ParameterBinding>();
    outputParts = new HashMap<String, ParameterBinding>();
    faultParts = new HashMap<String, ParameterBinding>();
    inputMimeTypes = new HashMap<String, String>();
    outputMimeTypes = new HashMap<String, String>();
    faultMimeTypes = new HashMap<String, String>();
    inParts = new HashMap<String, EditableWSDLPart>();
    outParts = new HashMap<String, EditableWSDLPart>();
    wsdlBoundFaults = new ArrayList<EditableWSDLBoundFault>();
    this.owner = owner;
}
 
Example #14
Source File: WSDLPartImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public WSDLPartImpl(XMLStreamReader xsr, String partName, int index, WSDLPartDescriptor descriptor) {
    super(xsr);
    this.name = partName;
    this.binding = ParameterBinding.UNBOUND;
    this.index = index;
    this.descriptor = descriptor;

}
 
Example #15
Source File: RuntimeWSDLParser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void parseMIMEPart(XMLStreamReader reader, EditableWSDLBoundOperation op, BindingMode mode) {
    boolean bodyFound = false;
    Map<String, ParameterBinding> parts = null;
    if (mode == BindingMode.INPUT) {
        parts = op.getInputParts();
    } else if (mode == BindingMode.OUTPUT) {
        parts = op.getOutputParts();
    } else if (mode == BindingMode.FAULT) {
        parts = op.getFaultParts();
    }
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if (SOAPConstants.QNAME_BODY.equals(name) && !bodyFound) {
            bodyFound = true;
            parseSOAPBodyBinding(reader, op, mode);
            XMLStreamReaderUtil.next(reader);
        } else if (SOAPConstants.QNAME_HEADER.equals(name)) {
            bodyFound = true;
            parseSOAPHeaderBinding(reader, parts);
            XMLStreamReaderUtil.next(reader);
        } else if (MIMEConstants.QNAME_CONTENT.equals(name)) {
            String part = reader.getAttributeValue(null, "part");
            String type = reader.getAttributeValue(null, "type");
            if ((part == null) || (type == null)) {
                XMLStreamReaderUtil.skipElement(reader);
                continue;
            }
            ParameterBinding sb = ParameterBinding.createAttachment(type);
            if (parts != null && sb != null && part != null)
                parts.put(part, sb);
            XMLStreamReaderUtil.next(reader);
        } else {
            XMLStreamReaderUtil.skipElement(reader);
        }
    }
}
 
Example #16
Source File: RuntimeModeler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private ParameterBinding getBinding(String operation, String part, boolean isHeader, Mode mode){
    if(binding == null){
        if(isHeader)
            return ParameterBinding.HEADER;
        else
            return ParameterBinding.BODY;
    }
    QName opName = new QName(binding.getBinding().getPortType().getName().getNamespaceURI(), operation);
    return binding.getBinding().getBinding(opName, part, mode);
}
 
Example #17
Source File: SOAPSEIModel.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param params
 * @param headers
 */
private void fillHeaders(Iterator<ParameterImpl> params, Set<QName> headers, Mode mode) {
    while (params.hasNext()) {
        ParameterImpl param = params.next();
        ParameterBinding binding = (mode == Mode.IN)?param.getInBinding():param.getOutBinding();
        QName name = param.getName();
        if (binding.isHeader() && !headers.contains(name)) {
            headers.add(name);
        }
    }
}
 
Example #18
Source File: SOAPSEIModel.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param params
 * @param headers
 */
private void fillHeaders(Iterator<ParameterImpl> params, Set<QName> headers, Mode mode) {
    while (params.hasNext()) {
        ParameterImpl param = params.next();
        ParameterBinding binding = (mode == Mode.IN)?param.getInBinding():param.getOutBinding();
        QName name = param.getName();
        if (binding.isHeader() && !headers.contains(name)) {
            headers.add(name);
        }
    }
}
 
Example #19
Source File: WSDLBoundPortTypeImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the {@link ParameterBinding} for a given operation, part name and the direction - IN/OUT
 *
 * @param operation wsdl:operation@name value. Must be non-null.
 * @param part      wsdl:part@name such as value of soap:header@part. Must be non-null.
 * @param mode      {@link Mode#IN} or {@link Mode#OUT}. Must be non-null.
 * @return null if the binding could not be resolved for the part.
 */
public ParameterBinding getBinding(QName operation, String part, Mode mode) {
    EditableWSDLBoundOperation op = get(operation);
    if (op == null) {
        //TODO throw exception
        return null;
    }
    if ((Mode.IN == mode) || (Mode.INOUT == mode))
        return op.getInputBinding(part);
    else
        return op.getOutputBinding(part);
}
 
Example #20
Source File: WSDLBoundPortTypeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the {@link ParameterBinding} for a given operation, part name and the direction - IN/OUT
 *
 * @param operation wsdl:operation@name value. Must be non-null.
 * @param part      wsdl:part@name such as value of soap:header@part. Must be non-null.
 * @param mode      {@link Mode#IN} or {@link Mode#OUT}. Must be non-null.
 * @return null if the binding could not be resolved for the part.
 */
public ParameterBinding getBinding(QName operation, String part, Mode mode) {
    EditableWSDLBoundOperation op = get(operation);
    if (op == null) {
        //TODO throw exception
        return null;
    }
    if ((Mode.IN == mode) || (Mode.INOUT == mode))
        return op.getInputBinding(part);
    else
        return op.getOutputBinding(part);
}
 
Example #21
Source File: RuntimeWSDLParser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static void parseSOAPHeaderBinding(XMLStreamReader reader, Map<String, ParameterBinding> parts) {
    String part = reader.getAttributeValue(null, "part");
    //if(part == null| part.equals("")||message == null || message.equals("")){
    if (part == null || part.equals("")) {
        return;
    }

    //lets not worry about message attribute for now, probably additional headers wont be there
    //String message = reader.getAttributeValue(null, "message");
    //QName msgName = ParserUtil.getQName(reader, message);
    parts.put(part, ParameterBinding.HEADER);
    goToEnd(reader);
}
 
Example #22
Source File: RuntimeModeler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private ParameterBinding getBinding(String operation, String part, boolean isHeader, Mode mode){
    if(binding == null){
        if(isHeader)
            return ParameterBinding.HEADER;
        else
            return ParameterBinding.BODY;
    }
    QName opName = new QName(binding.getBinding().getPortType().getName().getNamespaceURI(), operation);
    return binding.getBinding().getBinding(opName, part, mode);
}
 
Example #23
Source File: WSDLGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected boolean isAttachmentParameter(ParameterImpl parameter) {
    ParameterBinding paramBinding = parameter.getBinding();
    return paramBinding.isAttachment();
}
 
Example #24
Source File: ParameterImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return the Binding for this Parameter
 */
public ParameterBinding getBinding() {
    if(binding == null)
        return ParameterBinding.BODY;
    return binding;
}
 
Example #25
Source File: ParameterImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void setInBinding(ParameterBinding binding){
    this.binding = binding;
}
 
Example #26
Source File: WSDLPartImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void setBinding(ParameterBinding binding) {
    this.binding = binding;
}
 
Example #27
Source File: ParameterImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public ParameterBinding getOutBinding(){
    if(outBinding == null)
        return binding;
    return outBinding;
}
 
Example #28
Source File: WSDLGenerator.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected boolean isHeaderParameter(ParameterImpl parameter) {
    ParameterBinding paramBinding = parameter.getBinding();
    return paramBinding.isHeader();
}
 
Example #29
Source File: ParameterImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public ParameterBinding getInBinding(){
    return binding;
}
 
Example #30
Source File: ParameterImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public ParameterBinding getInBinding(){
    return binding;
}