Java Code Examples for javax.wsdl.Part#getTypeName()

The following examples show how to use javax.wsdl.Part#getTypeName() . 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: WsdlOpFaultList.java    From hop with Apache License 2.0 6 votes vote down vote up
/**
 * Create a WsdlOpFault from the Fault.
 *
 * @param fault Fault to process.
 * @return WsdlOpFault Result of processing.
 */
@SuppressWarnings( "unchecked" )
private WsdlOpFault getFault( Fault fault ) throws HopTransformException {
  Message m = fault.getMessage();

  // a fault should only have one message part.
  Map<?, Part> partMap = m.getParts();
  if ( partMap.size() != 1 ) {
    throw new IllegalArgumentException( "Invalid part count for fault!!" );
  }
  Part faultPart = partMap.values().iterator().next();
  boolean complexType = false;

  // type of fault is specified either in Part's type or element attribute.
  QName type = faultPart.getTypeName();
  if ( type == null ) {
    type = faultPart.getElementName();
    Element schemaElement = _wsdlTypes.findNamedElement( type );
    type = _wsdlTypes.getTypeQName( schemaElement.getAttribute( "type" ) );
    complexType = true;
  }
  return new WsdlOpFault( fault.getName(), type, complexType, _wsdlTypes );
}
 
Example 2
Source File: PublishMetadataRunnable.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
private static List<QName> getMessageParts(Message msg) {
    List<QName> result = new ArrayList<QName>();
    @SuppressWarnings("unchecked")
    Collection<Part> values = msg.getParts().values();
    if (values == null || values.isEmpty()) {
        return result;
    }
    Iterator<Part> iterator = values.iterator();
    while (iterator.hasNext()) {
        Part part = iterator.next();
        if (part.getElementName() != null) {
            result.add(part.getElementName());
        } else if (part.getTypeName() != null) {
            result.add(part.getTypeName());
        }
    }
    return result;
}
 
Example 3
Source File: WSDLToCorbaHelper.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected XmlSchemaType lookUpType(Part part) {
    XmlSchemaType schemaType = null;
    for (XmlSchema xmlSchema : xmlSchemaList.getXmlSchemas()) {
        if (part.getElementName() != null) {
            XmlSchemaElement schemaElement = xmlSchema.getElementByName(part.getElementName());
            if (schemaElement != null) {
                schemaType = schemaElement.getSchemaType();
            }
        } else {
            if (part.getTypeName() != null) {
                schemaType = xmlSchema.getTypeByName(part.getTypeName());
            }
        }
        if (schemaType != null) {
            return schemaType;
        }
    }

    return schemaType;
}
 
Example 4
Source File: WsdlOpFaultList.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Create a WsdlOpFault from the Fault.
 *
 * @param fault
 *          Fault to process.
 * @return WsdlOpFault Result of processing.
 */
@SuppressWarnings( "unchecked" )
private WsdlOpFault getFault( Fault fault ) throws KettleStepException {
  Message m = fault.getMessage();

  // a fault should only have one message part.
  Map<?, Part> partMap = m.getParts();
  if ( partMap.size() != 1 ) {
    throw new IllegalArgumentException( "Invalid part count for fault!!" );
  }
  Part faultPart = partMap.values().iterator().next();
  boolean complexType = false;

  // type of fault is specified either in Part's type or element attribute.
  QName type = faultPart.getTypeName();
  if ( type == null ) {
    type = faultPart.getElementName();
    Element schemaElement = _wsdlTypes.findNamedElement( type );
    type = _wsdlTypes.getTypeQName( schemaElement.getAttribute( "type" ) );
    complexType = true;
  }
  return new WsdlOpFault( fault.getName(), type, complexType, _wsdlTypes );
}
 
Example 5
Source File: OperationInfo.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
private static ParameterInfo getParameterFromMessage(Message msg) {
    ParameterInfo parameterRoot = new ParameterInfo();
    List<Part> msgParts = msg.getOrderedParts(null);
    if (msgParts.size() > 1) {
        parameterRoot.setName(ParameterInfo.MULTIPART);
    } else if (msgParts.size() == 1) {
        Part part = msgParts.iterator().next();
        if (part.getElementName() != null) {
            parameterRoot.setName(part.getElementName());
        } else if (part.getTypeName() != null) {
            parameterRoot.setName(part.getTypeName());
        }
    }
    return parameterRoot;
}
 
Example 6
Source File: WSDLParameter.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static XmlSchemaType getType(Part part, SchemaCollection xmlSchemaList) throws Exception {
    XmlSchemaType schemaType = null;

    for (XmlSchema xmlSchema : xmlSchemaList.getXmlSchemas()) {
        if (part.getTypeName() != null) {
            schemaType = findSchemaType(xmlSchema, part.getTypeName());
            if (schemaType != null) {
                return schemaType;
            }
        }
    }

    return schemaType;
}
 
Example 7
Source File: WSDL11SOAPOperationExtractor.java    From carbon-apimgt with Apache License 2.0 4 votes vote down vote up
/**
 * Gets swagger output parameter model for a given soap operation
 *
 * @param bindingOperation soap operation
 * @return list of swagger models for the parameters
 * @throws APIMgtWSDLException
 */
private List<ModelImpl> getSoapOutputParameterModel(BindingOperation bindingOperation) throws APIMgtWSDLException {
    List<ModelImpl> outputParameterModelList = new ArrayList<>();
    Operation operation = bindingOperation.getOperation();
    if (operation != null) {
        Output output = operation.getOutput();
        if (output != null) {
            Message message = output.getMessage();
            if (message != null) {
                Map map = message.getParts();

                for (Object obj : map.entrySet()) {
                    Map.Entry entry = (Map.Entry) obj;
                    Part part = (Part) entry.getValue();
                    if (part != null) {
                        if (part.getElementName() != null) {
                            outputParameterModelList.add(parameterModelMap.get(part.getElementName()
                                    .getLocalPart()));
                        } else {
                            if (part.getTypeName() != null && parameterModelMap
                                    .containsKey(part.getTypeName().getLocalPart())) {
                                outputParameterModelList
                                        .add(parameterModelMap.get(part.getTypeName().getLocalPart()));
                            } else {
                                ModelImpl model = new ModelImpl();
                                model.setType(ObjectProperty.TYPE);
                                model.setName(message.getQName().getLocalPart());
                                if (getPropertyFromDataType(part.getTypeName().getLocalPart()) instanceof RefProperty) {
                                    RefProperty property = (RefProperty) getPropertyFromDataType(part.getTypeName()
                                            .getLocalPart());
                                    property.set$ref(SOAPToRESTConstants.Swagger.DEFINITIONS_ROOT +
                                            part.getTypeName().getLocalPart());
                                    model.addProperty(part.getName(), property);
                                } else {
                                    model.addProperty(part.getName(),
                                            getPropertyFromDataType(part.getTypeName().getLocalPart()));
                                }
                                parameterModelMap.put(model.getName(), model);
                                outputParameterModelList.add(model);
                            }
                        }
                    }
                }
            }
        }
    }
    return outputParameterModelList;
}
 
Example 8
Source File: SoapBindingFactory.java    From cxf with Apache License 2.0 4 votes vote down vote up
private void buildMessage(MessageInfo minfo,
                          javax.wsdl.Message msg,
                          SchemaCollection schemas,
                          int nextId,
                          String partNameFilter) {
    for (Part part : cast(msg.getParts().values(), Part.class)) {

        if (StringUtils.isEmpty(partNameFilter)
            || part.getName().equals(partNameFilter)) {

            if (StringUtils.isEmpty(part.getName())) {
                throw new RuntimeException("Problem with WSDL: part element in message "
                                           + msg.getQName().getLocalPart()
                                           + " does not specify a name.");
            }
            QName pqname = new QName(minfo.getName().getNamespaceURI(), part.getName());
            MessagePartInfo pi = minfo.getMessagePart(pqname);
            if (pi != null
                && pi.getMessageInfo().getName().equals(msg.getQName())) {
                continue;
            }
            pi = minfo.addOutOfBandMessagePart(pqname);

            if (!minfo.getName().equals(msg.getQName())) {
                pi.setMessageContainer(new MessageInfo(minfo.getOperation(), null, msg.getQName()));
            }

            if (part.getTypeName() != null) {
                pi.setTypeQName(part.getTypeName());
                pi.setElement(false);
                pi.setXmlSchema(schemas.getTypeByQName(part.getTypeName()));
            } else {
                pi.setElementQName(part.getElementName());
                pi.setElement(true);
                pi.setXmlSchema(schemas.getElementByQName(part.getElementName()));
            }
            pi.setProperty(OUT_OF_BAND_HEADER, Boolean.TRUE);
            pi.setProperty(HEADER, Boolean.TRUE);
            pi.setIndex(nextId);
            nextId++;
        }
    }
}
 
Example 9
Source File: HeavyweightOperationInfoBuilder.java    From tomee with Apache License 2.0 4 votes vote down vote up
private QName getPartName(Part part) {
    return part.getElementName() == null ? part.getTypeName() : part.getElementName();
}