FileDocCategorySizeDatePackage
MetadataUtil.javaAPI DocExample5066Tue May 29 16:56:34 BST 2007com.sun.xml.ws.mex.client

MetadataUtil

public class MetadataUtil extends Object
Class for making mex Get requests (which are the same as ws-transfer Get requests). Currently only http requests are supported.

Fields Summary
private final HttpPoster
postClient
private static final Logger
logger
Constructors Summary
public MetadataUtil()

    
      
        postClient = new HttpPoster();
    
Methods Summary
java.io.InputStreamgetMetadata(java.lang.String address, com.sun.xml.ws.mex.client.MetadataClient.Protocol protocol)
Make a mex/wxf request to a server.

param
address The address to query for metadata.
return
The full response from the server.

        
        final String request = getMexWsdlRequest(address, protocol);
        if (logger.isLoggable(Level.FINE)) {
            logger.fine("Request message:\n" + request + "\n");
        }
        String contentType = "application/soap+xml"; // soap 1.2
        if (protocol == Protocol.SOAP_1_1) {
            contentType = "text/xml; charset=\"utf-8\"";
        }
        return postClient.post(request, address, contentType);
    
private java.lang.StringgetMexWsdlRequest(java.lang.String address, com.sun.xml.ws.mex.client.MetadataClient.Protocol protocol)

        
        // start with soap 1.2
        String soapPrefix = "s12";
        String soapNamespace = SOAP_1_2;
        if (protocol == Protocol.SOAP_1_1) {
            soapPrefix = "soap-env";
            soapNamespace = SOAP_1_1;
        }
        return "<" + soapPrefix + ":Envelope " +
            "xmlns:" + soapPrefix + "='" + soapNamespace + "' " +
            "xmlns:" + WSA_PREFIX + "='" + AddressingVersion.W3C.nsUri + "'>" +
            "<" + soapPrefix + ":Header>" +
            "<" + WSA_PREFIX + ":Action>" +
            GET_REQUEST +
            "</" + WSA_PREFIX + ":Action>" +
            "<" + WSA_PREFIX + ":To>" + address + "</" + WSA_PREFIX + ":To>" +
            "<" + WSA_PREFIX + ":ReplyTo><" + WSA_PREFIX + ":Address>" +
            WSA_ANON +
            "</" + WSA_PREFIX + ":Address></" + WSA_PREFIX + ":ReplyTo>" +
            "<" + WSA_PREFIX + ":MessageID>" +
            "uuid:778b135f-3fdf-44b2-b53e-ebaab7441e40" +
            "</" + WSA_PREFIX + ":MessageID>" +
            "</" + soapPrefix + ":Header>" +
            "<" + soapPrefix + ":Body/>" +
            "</" + soapPrefix + ":Envelope>";