Search in sources :

Example 1 with WebMessagePart

use of com.webcohesion.enunciate.modules.jaxws.model.WebMessagePart in project enunciate by stoicflame.

the class EnunciateJaxwsContext method add.

/**
 * Add an endpoint interface to the model.
 *
 * @param ei The endpoint interface to add to the model.
 */
public void add(EndpointInterface ei) {
    String namespace = ei.getTargetNamespace();
    String prefix = this.jaxbContext.addNamespace(namespace);
    WsdlInfo wsdlInfo = wsdls.get(namespace);
    if (wsdlInfo == null) {
        wsdlInfo = new WsdlInfo(jaxbContext);
        wsdlInfo.setId(prefix);
        wsdls.put(namespace, wsdlInfo);
        wsdlInfo.setTargetNamespace(namespace);
    }
    for (WebMethod webMethod : ei.getWebMethods()) {
        for (WebMessage webMessage : webMethod.getMessages()) {
            for (WebMessagePart messagePart : webMessage.getParts()) {
                if (messagePart.isImplicitSchemaElement()) {
                    ImplicitSchemaElement implicitElement = (ImplicitSchemaElement) messagePart;
                    String particleNamespace = messagePart.getParticleQName().getNamespaceURI();
                    SchemaInfo schemaInfo = this.jaxbContext.getSchemas().get(particleNamespace);
                    if (schemaInfo == null) {
                        schemaInfo = new SchemaInfo(this.jaxbContext);
                        schemaInfo.setId(this.jaxbContext.addNamespace(particleNamespace));
                        schemaInfo.setNamespace(particleNamespace);
                        this.jaxbContext.getSchemas().put(particleNamespace, schemaInfo);
                    }
                    schemaInfo.getImplicitSchemaElements().add(implicitElement);
                }
            }
        }
    }
    wsdlInfo.getEndpointInterfaces().add(ei);
    this.endpointInterfaces.add(ei);
    debug("Added %s as a JAX-WS endpoint interface.", ei.getQualifiedName());
    if (getContext().getProcessingEnvironment().findSourcePosition(ei) == null) {
        OneTimeLogMessage.SOURCE_FILES_NOT_FOUND.log(getContext());
        if (OneTimeLogMessage.SOURCE_FILES_NOT_FOUND.getLogged() <= 3) {
            info("Unable to find source file for %s.", ei.getQualifiedName());
        } else {
            debug("Unable to find source file for %s.", ei.getQualifiedName());
        }
    }
}
Also used : WebMethod(com.webcohesion.enunciate.modules.jaxws.model.WebMethod) ImplicitSchemaElement(com.webcohesion.enunciate.modules.jaxb.model.ImplicitSchemaElement) WebMessagePart(com.webcohesion.enunciate.modules.jaxws.model.WebMessagePart) WebMessage(com.webcohesion.enunciate.modules.jaxws.model.WebMessage) SchemaInfo(com.webcohesion.enunciate.modules.jaxb.model.SchemaInfo)

Aggregations

ImplicitSchemaElement (com.webcohesion.enunciate.modules.jaxb.model.ImplicitSchemaElement)1 SchemaInfo (com.webcohesion.enunciate.modules.jaxb.model.SchemaInfo)1 WebMessage (com.webcohesion.enunciate.modules.jaxws.model.WebMessage)1 WebMessagePart (com.webcohesion.enunciate.modules.jaxws.model.WebMessagePart)1 WebMethod (com.webcohesion.enunciate.modules.jaxws.model.WebMethod)1