Example usage for javax.xml.ws.handler MessageContext WSDL_SERVICE

List of usage examples for javax.xml.ws.handler MessageContext WSDL_SERVICE

Introduction

In this page you can find the example usage for javax.xml.ws.handler MessageContext WSDL_SERVICE.

Prototype

String WSDL_SERVICE

To view the source code for javax.xml.ws.handler MessageContext WSDL_SERVICE.

Click Source Link

Document

Standard property: name of WSDL service.

Usage

From source file:org.apache.axis2.jaxws.context.WebServiceContextImpl.java

public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) {

    // Note that the MessageContext might not be set up yet, or it
    // may have been released because the lifetime of the WebServiceContext is completed.
    if (log.isDebugEnabled()) {
        if (soapMessageContext == null) {
            log.debug("The MessageContext is not available");
        }/*from  ww  w . ja va2 s . co  m*/
    }

    EndpointReference jaxwsEPR = null;
    String addressingNamespace = EndpointReferenceUtils.getAddressingNamespace(clazz);

    if (soapMessageContext != null) {
        QName service = (QName) soapMessageContext.get(MessageContext.WSDL_SERVICE);
        QName endpoint = (QName) soapMessageContext.get(MessageContext.WSDL_PORT);

        org.apache.axis2.addressing.EndpointReference axis2EPR = EndpointReferenceUtils
                .createAxis2EndpointReference(null, service, endpoint, null, addressingNamespace);

        try {
            EndpointReferenceUtils.addReferenceParameters(axis2EPR, referenceParameters);
            jaxwsEPR = EndpointReferenceUtils.convertFromAxis2(axis2EPR, addressingNamespace);
        } catch (Exception e) {
            throw ExceptionFactory.makeWebServiceException(
                    Messages.getMessage("endpointRefConstructionFailure3", e.toString()));
        }
    } else {
        throw new IllegalStateException(Messages.getMessage("webServiceContextErr1"));
    }

    return clazz.cast(jaxwsEPR);
}

From source file:org.apache.juddi.xlt.util.LoggingHandler.java

private String getOperationName(SOAPMessageContext context) {
    // service is optional :-(
    QName service = (QName) context.get(MessageContext.WSDL_SERVICE);
    if (service == null) {
        service = new QName("<unknown>");
    }//from  ww w  . ja v  a 2s .  c  om

    // operation is optional :-(
    QName operation = (QName) context.get(MessageContext.WSDL_OPERATION);
    if (operation == null) {
        // operation = new QName("<unknown>");

        try {
            operation = new QName(context.getMessage().getSOAPBody().getFirstChild().getLocalName());
        } catch (SOAPException ex) {
            throw new RuntimeException("", ex);
        }
    }

    return service.getLocalPart() + "." + operation.getLocalPart();
}