Search in sources :

Example 6 with XmlSchemaAll

use of org.apache.ws.commons.schema.XmlSchemaAll in project wso2-axis2-transports by wso2.

the class XMPPSender method getParameterListForOperation.

/**
 * Retrieves list of parameter names & their type for a given operation
 * @param operation
 */
private static String getParameterListForOperation(AxisOperation operation) {
    // Logic copied from BuilderUtil.buildsoapMessage(...)
    StringBuffer paramList = new StringBuffer();
    AxisMessage axisMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
    XmlSchemaElement xmlSchemaElement = axisMessage.getSchemaElement();
    if (xmlSchemaElement != null) {
        XmlSchemaType schemaType = xmlSchemaElement.getSchemaType();
        if (schemaType instanceof XmlSchemaComplexType) {
            XmlSchemaComplexType complexType = ((XmlSchemaComplexType) schemaType);
            XmlSchemaParticle particle = complexType.getParticle();
            if (particle instanceof XmlSchemaSequence || particle instanceof XmlSchemaAll) {
                XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) particle;
                Iterator iterator = xmlSchemaGroupBase.getItems().getIterator();
                while (iterator.hasNext()) {
                    XmlSchemaElement innerElement = (XmlSchemaElement) iterator.next();
                    QName qName = innerElement.getQName();
                    if (qName == null && innerElement.getSchemaTypeName().equals(org.apache.ws.commons.schema.constants.Constants.XSD_ANYTYPE)) {
                        break;
                    }
                    long minOccurs = innerElement.getMinOccurs();
                    boolean nillable = innerElement.isNillable();
                    String name = qName != null ? qName.getLocalPart() : innerElement.getName();
                    String type = innerElement.getSchemaTypeName().toString();
                    paramList.append("," + type + " " + name);
                }
            }
        }
    }
    // remove first ","
    String list = paramList.toString();
    return list.replaceFirst(",", "");
}
Also used : XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) QName(javax.xml.namespace.QName) XmlSchemaParticle(org.apache.ws.commons.schema.XmlSchemaParticle) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType) XmlSchemaGroupBase(org.apache.ws.commons.schema.XmlSchemaGroupBase) XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) XmlSchemaAll(org.apache.ws.commons.schema.XmlSchemaAll) Iterator(java.util.Iterator) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) AxisMessage(org.apache.axis2.description.AxisMessage)

Aggregations

XmlSchemaAll (org.apache.ws.commons.schema.XmlSchemaAll)6 XmlSchemaSequence (org.apache.ws.commons.schema.XmlSchemaSequence)5 XmlSchemaChoice (org.apache.ws.commons.schema.XmlSchemaChoice)4 XmlSchemaParticle (org.apache.ws.commons.schema.XmlSchemaParticle)4 QName (javax.xml.namespace.QName)2 MemberType (org.apache.cxf.binding.corba.wsdl.MemberType)2 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)2 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)2 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 AxisMessage (org.apache.axis2.description.AxisMessage)1 CorbaType (org.apache.cxf.binding.corba.wsdl.CorbaType)1 Struct (org.apache.cxf.binding.corba.wsdl.Struct)1 XmlSchemaComplexContentExtension (org.apache.ws.commons.schema.XmlSchemaComplexContentExtension)1 XmlSchemaComplexContentRestriction (org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction)1 XmlSchemaContent (org.apache.ws.commons.schema.XmlSchemaContent)1 XmlSchemaGroupBase (org.apache.ws.commons.schema.XmlSchemaGroupBase)1 XmlSchemaSimpleContentExtension (org.apache.ws.commons.schema.XmlSchemaSimpleContentExtension)1 XmlSchemaSimpleContentRestriction (org.apache.ws.commons.schema.XmlSchemaSimpleContentRestriction)1 XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)1