org.glassfish.webservices
Class WsUtil

java.lang.Object
  extended by org.glassfish.webservices.WsUtil

public class WsUtil
extends java.lang.Object

Web service related utilities.

Author:
Kenneth Saks

Field Summary
static java.lang.String CLIENT_TRANSPORT_LOG_PROPERTY
           
static java.lang.String ENDPOINT_ADDRESS_PARAM_NAME
           
static java.lang.String SCHEMA_IMPORT_LOCATION_PARAM_NAME
           
 java.lang.String SCHEMA_IMPORT_NAMESPACE_PARAM_NAME
           
static java.lang.String SCHEMA_INCLUDE_LOCATION_PARAM_NAME
           
static java.lang.String WSDL_IMPORT_LOCATION_PARAM_NAME
           
 java.lang.String WSDL_IMPORT_NAMESPACE_PARAM_NAME
           
static java.lang.String WSDL_INCLUDE_LOCATION_PARAM_NAME
           
 
Constructor Summary
WsUtil()
           
 
Method Summary
 void configureHandlerChain(ServiceReferenceDescriptor serviceRef, javax.xml.rpc.Service service, java.util.Iterator ports, java.lang.ClassLoader loader)
           
 void configureJAXWSClientHandlers(javax.xml.ws.Service svcClass, ServiceReferenceDescriptor desc)
           
 void configureJAXWSServiceHandlers(WebServiceEndpoint ep, java.lang.String bindingId, com.sun.xml.ws.api.WSBinding bindingObj)
           
 javax.xml.rpc.Service createConfiguredService(ServiceReferenceDescriptor desc)
           
 javax.xml.rpc.handler.HandlerInfo createHandlerInfo(WebServiceHandler handler, java.lang.ClassLoader loader)
           
 void doPostConstruct(java.lang.Class impl, java.lang.Object implObj)
           
 void doPreDestroy(WebServiceEndpoint ep, java.lang.ClassLoader loader)
           
 void generateFinalWsdl(java.net.URL wsdlFileUrl, WebService webService, WebServerInfo wsi, java.io.File finalWsdlFile)
          Transform the deployed WSDL document for a given webservice by replacing the ENDPOINT ADDRESS for each port with the actual endpoint address on which it will be listening.
 void generateFinalWsdl(java.net.URL wsdlFileUrl, WebService webService, WebServerInfo wsi, java.io.OutputStream outputStream)
           
 java.util.Collection getAllPorts(com.sun.xml.rpc.spi.model.Model model)
           
static java.util.logging.Logger getDefaultLogger()
           
static LocalStringManagerImpl getDefaultStringManager()
           
 java.lang.reflect.Method getInvMethod(com.sun.xml.rpc.spi.runtime.Tie webServiceTie, javax.xml.rpc.handler.MessageContext context)
           
 boolean getMtom(WebServiceEndpoint ep)
           
 com.sun.xml.rpc.spi.model.Port getPortFromModel(com.sun.xml.rpc.spi.model.Model model, javax.xml.namespace.QName portName)
          Find a Port object within the JAXRPC Model.
 java.util.Collection getSEIsFromGeneratedService(java.lang.Class generatedServiceInterface)
           
 com.sun.xml.rpc.spi.model.Service getServiceForPort(com.sun.xml.rpc.spi.model.Model model, javax.xml.namespace.QName thePortName)
          Find a Service in which a particular port is defined.
static javax.xml.soap.SOAPMessage getSOAPFault(java.lang.String protocol, java.lang.String faultString)
           
 WebServerInfo getWebServerInfoForDAS()
           
 java.lang.String getWsdlDir(BundleDescriptor bundle)
           
 java.util.Collection getWsdlsAndSchemas(java.io.File pkgedWsdl)
           
 void getWsdlsAndSchemas(java.io.File wsdl, java.util.ArrayList<com.sun.xml.ws.api.server.SDDocumentSource> cumulative)
           
 java.util.Collection getWsdlsAndSchemas(java.net.URL pkgedWsdl)
          This implementation is similar to #getWsdlsAndSchemas(File pkgedWsdl, except that this works on URL which makes it easy when the wsdl is loaded from the archive.
 boolean handleGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, WebServiceEndpoint endpoint)
          Serve up the FINAL wsdl associated with this web service.
 boolean isJAXWSbasedService(WebService ws)
           
 boolean isWsdlContent(java.lang.String uri, BundleDescriptor bundle)
          All wsdl files and wsdl imported files live under a well-known wsdl directory.
 boolean portsEqual(com.sun.xml.rpc.spi.model.Port port, javax.xml.namespace.QName candidatePortName)
          Logic for matching a port qname with a Port object from the JAXRPC-RI Model.
 java.net.URL privilegedGetServiceRefWsdl(ServiceReferenceDescriptor desc)
          Accessing wsdl URL might involve file system access, so wrap operation in a doPrivileged block.
static void raiseException(javax.servlet.http.HttpServletResponse resp, java.lang.String binding, java.lang.String faultString)
           
 void setClientTransportLog(ServiceReferenceDescriptor serviceRef, javax.xml.rpc.Stub stub, java.lang.String transportLogUrlStr)
          Set up a stub for request/response SOAP message logging.
 void throwSOAPFaultException(java.lang.String faultString, javax.xml.rpc.handler.MessageContext msgContext)
          Convenience method for throwing a SOAP fault exception.
 void throwSOAPFaultException(java.lang.String faultString, javax.xml.soap.SOAPMessage soapMessage)
           
 void updateServletEndpointRuntime(WebServiceEndpoint endpoint)
           
 void validateEjbEndpoint(WebServiceEndpoint ejbEndpoint)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLIENT_TRANSPORT_LOG_PROPERTY

public static final java.lang.String CLIENT_TRANSPORT_LOG_PROPERTY
See Also:
Constant Field Values

ENDPOINT_ADDRESS_PARAM_NAME

public static final java.lang.String ENDPOINT_ADDRESS_PARAM_NAME
See Also:
Constant Field Values

WSDL_IMPORT_NAMESPACE_PARAM_NAME

public final java.lang.String WSDL_IMPORT_NAMESPACE_PARAM_NAME
See Also:
Constant Field Values

WSDL_IMPORT_LOCATION_PARAM_NAME

public static final java.lang.String WSDL_IMPORT_LOCATION_PARAM_NAME
See Also:
Constant Field Values

WSDL_INCLUDE_LOCATION_PARAM_NAME

public static final java.lang.String WSDL_INCLUDE_LOCATION_PARAM_NAME
See Also:
Constant Field Values

SCHEMA_IMPORT_NAMESPACE_PARAM_NAME

public final java.lang.String SCHEMA_IMPORT_NAMESPACE_PARAM_NAME
See Also:
Constant Field Values

SCHEMA_IMPORT_LOCATION_PARAM_NAME

public static final java.lang.String SCHEMA_IMPORT_LOCATION_PARAM_NAME
See Also:
Constant Field Values

SCHEMA_INCLUDE_LOCATION_PARAM_NAME

public static final java.lang.String SCHEMA_INCLUDE_LOCATION_PARAM_NAME
See Also:
Constant Field Values
Constructor Detail

WsUtil

public WsUtil()
Method Detail

handleGet

public boolean handleGet(javax.servlet.http.HttpServletRequest request,
                         javax.servlet.http.HttpServletResponse response,
                         WebServiceEndpoint endpoint)
                  throws java.io.IOException
Serve up the FINAL wsdl associated with this web service.

Returns:
true for success, false for failure
Throws:
java.io.IOException

isWsdlContent

public boolean isWsdlContent(java.lang.String uri,
                             BundleDescriptor bundle)
All wsdl files and wsdl imported files live under a well-known wsdl directory.

Parameters:
uri - module uri

getWsdlDir

public java.lang.String getWsdlDir(BundleDescriptor bundle)
Returns:
module-specific dedicated wsdl directory

setClientTransportLog

public void setClientTransportLog(ServiceReferenceDescriptor serviceRef,
                                  javax.xml.rpc.Stub stub,
                                  java.lang.String transportLogUrlStr)
Set up a stub for request/response SOAP message logging.


generateFinalWsdl

public void generateFinalWsdl(java.net.URL wsdlFileUrl,
                              WebService webService,
                              WebServerInfo wsi,
                              java.io.File finalWsdlFile)
                       throws java.lang.Exception
Transform the deployed WSDL document for a given webservice by replacing the ENDPOINT ADDRESS for each port with the actual endpoint address on which it will be listening.

Throws:
java.lang.Exception

generateFinalWsdl

public void generateFinalWsdl(java.net.URL wsdlFileUrl,
                              WebService webService,
                              WebServerInfo wsi,
                              java.io.OutputStream outputStream)
                       throws java.lang.Exception
Throws:
java.lang.Exception

createHandlerInfo

public javax.xml.rpc.handler.HandlerInfo createHandlerInfo(WebServiceHandler handler,
                                                           java.lang.ClassLoader loader)
                                                    throws java.lang.Exception
Throws:
java.lang.Exception

privilegedGetServiceRefWsdl

public java.net.URL privilegedGetServiceRefWsdl(ServiceReferenceDescriptor desc)
                                         throws java.lang.Exception
Accessing wsdl URL might involve file system access, so wrap operation in a doPrivileged block.

Throws:
java.lang.Exception

isJAXWSbasedService

public boolean isJAXWSbasedService(WebService ws)

createConfiguredService

public javax.xml.rpc.Service createConfiguredService(ServiceReferenceDescriptor desc)
                                              throws java.lang.Exception
Throws:
java.lang.Exception

configureHandlerChain

public void configureHandlerChain(ServiceReferenceDescriptor serviceRef,
                                  javax.xml.rpc.Service service,
                                  java.util.Iterator ports,
                                  java.lang.ClassLoader loader)
                           throws java.lang.Exception
Throws:
java.lang.Exception

getSEIsFromGeneratedService

public java.util.Collection getSEIsFromGeneratedService(java.lang.Class generatedServiceInterface)
                                                 throws java.lang.Exception
Returns:
Set of service endpoint interface class names supported by a generated service interface.
Throws:
java.lang.Exception

getPortFromModel

public com.sun.xml.rpc.spi.model.Port getPortFromModel(com.sun.xml.rpc.spi.model.Model model,
                                                       javax.xml.namespace.QName portName)
Find a Port object within the JAXRPC Model.


getServiceForPort

public com.sun.xml.rpc.spi.model.Service getServiceForPort(com.sun.xml.rpc.spi.model.Model model,
                                                           javax.xml.namespace.QName thePortName)
Find a Service in which a particular port is defined. Assumes port QName is unique within a WSDL.


portsEqual

public boolean portsEqual(com.sun.xml.rpc.spi.model.Port port,
                          javax.xml.namespace.QName candidatePortName)
Logic for matching a port qname with a Port object from the JAXRPC-RI Model.


getAllPorts

public java.util.Collection getAllPorts(com.sun.xml.rpc.spi.model.Model model)

getInvMethod

public java.lang.reflect.Method getInvMethod(com.sun.xml.rpc.spi.runtime.Tie webServiceTie,
                                             javax.xml.rpc.handler.MessageContext context)
                                      throws java.lang.Exception
Returns:
a method object representing the target of a web service invocation
Throws:
java.lang.Exception

throwSOAPFaultException

public void throwSOAPFaultException(java.lang.String faultString,
                                    javax.xml.rpc.handler.MessageContext msgContext)
Convenience method for throwing a SOAP fault exception.


throwSOAPFaultException

public void throwSOAPFaultException(java.lang.String faultString,
                                    javax.xml.soap.SOAPMessage soapMessage)
                             throws javax.xml.rpc.soap.SOAPFaultException
Throws:
javax.xml.rpc.soap.SOAPFaultException

raiseException

public static void raiseException(javax.servlet.http.HttpServletResponse resp,
                                  java.lang.String binding,
                                  java.lang.String faultString)

getSOAPFault

public static javax.xml.soap.SOAPMessage getSOAPFault(java.lang.String protocol,
                                                      java.lang.String faultString)

getWebServerInfoForDAS

public WebServerInfo getWebServerInfoForDAS()

getDefaultLogger

public static java.util.logging.Logger getDefaultLogger()
Returns:
the default Logger implementation for this package

getDefaultStringManager

public static LocalStringManagerImpl getDefaultStringManager()

validateEjbEndpoint

public void validateEjbEndpoint(WebServiceEndpoint ejbEndpoint)

updateServletEndpointRuntime

public void updateServletEndpointRuntime(WebServiceEndpoint endpoint)

getWsdlsAndSchemas

public java.util.Collection getWsdlsAndSchemas(java.io.File pkgedWsdl)
                                        throws java.lang.Exception
Throws:
java.lang.Exception

getWsdlsAndSchemas

public java.util.Collection getWsdlsAndSchemas(java.net.URL pkgedWsdl)
                                        throws java.lang.Exception
This implementation is similar to #getWsdlsAndSchemas(File pkgedWsdl, except that this works on URL which makes it easy when the wsdl is loaded from the archive.

Parameters:
pkgedWsdl - URL
Returns:
Throws:
java.lang.Exception

getWsdlsAndSchemas

public void getWsdlsAndSchemas(java.io.File wsdl,
                               java.util.ArrayList<com.sun.xml.ws.api.server.SDDocumentSource> cumulative)
                        throws java.lang.Exception
Throws:
java.lang.Exception

doPostConstruct

public void doPostConstruct(java.lang.Class impl,
                            java.lang.Object implObj)

doPreDestroy

public void doPreDestroy(WebServiceEndpoint ep,
                         java.lang.ClassLoader loader)

configureJAXWSServiceHandlers

public void configureJAXWSServiceHandlers(WebServiceEndpoint ep,
                                          java.lang.String bindingId,
                                          com.sun.xml.ws.api.WSBinding bindingObj)

configureJAXWSClientHandlers

public void configureJAXWSClientHandlers(javax.xml.ws.Service svcClass,
                                         ServiceReferenceDescriptor desc)

getMtom

public boolean getMtom(WebServiceEndpoint ep)


Copyright © 2012 GlassFish Community. All Rights Reserved.