FileDocCategorySizeDatePackage
WSDLRetriever.javaAPI DocExample6491Wed Jul 11 22:23:52 BST 2007com.sun.xml.ws.mex.server

WSDLRetriever

public class WSDLRetriever extends Object
This class is used to add the endpoint's metadata to the mex MetadataResponse element.
author
WS Development Team

Fields Summary
private final com.sun.xml.ws.api.server.WSEndpoint
endpoint
private static final Logger
logger
private static final com.sun.xml.ws.api.server.DocumentAddressResolver
dar
Constructors Summary
public WSDLRetriever(com.sun.xml.ws.api.server.WSEndpoint endpoint)

    
       
        this.endpoint = endpoint;
    
Methods Summary
voidaddDocuments(javax.xml.stream.XMLStreamWriter writer, com.sun.xml.ws.api.message.Packet request, java.lang.String address)

        
        final ServiceDefinition sDef = endpoint.getServiceDefinition();
        if (sDef == null) {
            return;
        }
        final Iterator<SDDocument> docs = sDef.iterator();
        while (docs.hasNext()) {
            writeDoc(writer, docs.next(), address);
        }
    
private voidwriteDoc(javax.xml.stream.XMLStreamWriter writer, com.sun.xml.ws.api.server.SDDocument doc, java.lang.String add)

        
        try {
            writer.writeStartElement(MEX_PREFIX,
                "MetadataSection", MEX_NAMESPACE);
            if (doc.isWSDL()) {
                writer.writeAttribute("Dialect", WSDL_DIALECT);
                writer.writeAttribute("Identifier",
                    ((SDDocument.WSDL) doc).getTargetNamespace());
            } else if(doc.isSchema()) {
                writer.writeAttribute("Dialect", SCHEMA_DIALECT);
                writer.writeAttribute("Identifier",
                    ((SDDocument.Schema) doc).getTargetNamespace());
            }
            doc.writeTo(new PortAddressResolverImpl(add), dar, writer);
            writer.writeEndElement();
        } catch (IOException ioe) {
            // this should be very rare
            String exceptionMessage =
                MessagesMessages.MEX_0015_IOEXCEPTION_WHILE_WRITING_RESPONSE(add);
            logger.log(Level.SEVERE, exceptionMessage, ioe);
            throw new WebServiceException(exceptionMessage, ioe);
        }