Package com.sun.xml.ws.api.message

Examples of com.sun.xml.ws.api.message.Packet


            }
        } catch (Exception e) {
            // temporary - need to send back SOAP fault message
        }

  Packet pipeResponse = next.process(request);
      
        //Make the response packet available in the MessageContext
        ((SOAPMessageContextImpl)ctxt).setPacket(pipeResponse);
       
       
View Full Code Here


        if (isHttpBinding) {
            return next.process(request);
        }
       
        Packet response = null;

        try {

            response = processRequest(request);
View Full Code Here

    private Packet processRequest(Packet request) throws Exception {

        AuthStatus status = AuthStatus.SUCCESS;
 
  PacketMessageInfo info= new PacketMapMessageInfo(request,new Packet());

  // XXX at this time, we expect the server subject to be null

  Subject serverSubject = (Subject)
      request.invocationProperties.get(PipeConstants.SERVER_SUBJECT);

  //could change the request packet
        ServerAuthContext sAC =
      helper.getServerAuthContext(info,serverSubject);

  Subject clientSubject = getClientSubject(request);

  final Packet validatedRequest;
 
  try {

      if (sAC != null) {
   
    // client subject must not be null
    // and when return status is SUCCESS, module
    // must have called handler.handle(CallerPrincipalCallback)

    status = sAC.validateRequest(info,clientSubject,serverSubject);

      }
  } catch(Exception e) {

      _logger.log(Level.SEVERE,"ws.error_validate_request", e);

      WebServiceException wse = new WebServiceException
    (localStrings.getLocalString
     ("enterprise.webservice.cantValidateRequest",
      "Cannot validate request for {0}",
      new Object[] { helper.getModelName() }),e);

      //set status for audit
      status = AuthStatus.SEND_FAILURE;

      // if unable to determine if two-way will return empty response
      return helper.getFaultResponse
    (info.getRequestPacket(),info.getResponsePacket(),wse);

  } finally {

      validatedRequest = info.getRequestPacket();
      helper.auditInvocation(validatedRequest,status);
  }

  Packet response = null;

  if (status == AuthStatus.SUCCESS) {

      boolean authorized = false;

      try {

    helper.authorize(validatedRequest);

    authorized = true;

      } catch (Exception e) {
    // not authorized, construct fault and proceded
    response = helper.getFaultResponse
        (validatedRequest,info.getResponsePacket(),e);
      }
     
      if (authorized) {

    // only do doAdPriv if SecurityManager is in effect
    if (System.getSecurityManager() == null) {
        try {
      // proceed to invoke the endpoint
      response = next.process(validatedRequest);
        } catch (Exception e) {
      if (e instanceof AuthException){
          _logger.log(Level.SEVERE,"ws.error_next_pipe", e);
      }
      response = helper.getFaultResponse
          (validatedRequest,info.getResponsePacket(),e);
        }
    } else {
        try {
      response = (Packet)Subject.doAsPrivileged
          (clientSubject,new PrivilegedExceptionAction() {
        public Object run() throws Exception {
            // proceed to invoke the endpoint
            return next.process(validatedRequest);
        }
          }, null);
        } catch (PrivilegedActionException pae) {
            Throwable cause = pae.getCause();
      if (cause instanceof AuthException){
          _logger.log(Level.SEVERE,"ws.error_next_pipe", cause);
      }
      response = helper.getFaultResponse
          (validatedRequest,info.getResponsePacket(),cause);
        }
    }
      }
     
      //pipes are not supposed to return a null response packet
      if (response == null) {

    WebServiceException wse = new WebServiceException
        (localStrings.getLocalString
         ("enterprise.webservice.nullResponsePacket",
          "Invocation of Service {0} returned null response packet",
          new Object[] { helper.getModelName() }));

    response = helper.getFaultResponse
        (validatedRequest,info.getResponsePacket(),wse);

    _logger.log(Level.SEVERE,"",wse);

      }

      // secure response, including if it is a fault
      if (sAC != null && response.getMessage() != null) {
    info.setResponsePacket(response);
    response = processResponse(info, sAC, serverSubject);
      }

  } else {
View Full Code Here

          
    public void preDestroy() {
        //Give the AuthContext a chance to cleanup
        //create a dummy request packet
        try {
            Packet request = new Packet();
            PacketMessageInfo info = new PacketMapMessageInfo(request, new Packet());
            Subject subj = getClientSubject(request);
            ClientAuthContext cAC = helper.getClientAuthContext(info, subj);
             if (cAC != null && WSIT_CLIENT_AUTH_CONTEXT.equals(cAC.getClass().getName())) {
                cAC.cleanSubject(info, subj);
            }
View Full Code Here

   if(isHttpBinding) {
       return next.process(request);
   }
        */

  PacketMessageInfo info= new PacketMapMessageInfo(request,new Packet());
       
        info.getMap().put(javax.xml.ws.Endpoint.WSDL_SERVICE,
            helper.getProperty(PipeConstants.WSDL_SERVICE));

        AuthStatus status = AuthStatus.SEND_SUCCESS;

  Subject clientSubject = getClientSubject(request);

  ClientAuthContext cAC = null;

  try {

      cAC = helper.getClientAuthContext(info,clientSubject);

      if (cAC != null) {

    // proceed to process message sescurity
    status = cAC.secureRequest(info, clientSubject);
      }

  } catch(Exception e) {

      _logger.log(Level.SEVERE,"ws.error_secure_request", e);
     
      throw new WebServiceException
    (localStrings.getLocalString
     ("enterprise.webservice.cantSecureRequst",
      "Cannot secure request for {0}",
      new Object[] { helper.getModelName() }),e);
  }

  Packet response = null;

  if (status == AuthStatus.FAILURE) {
      if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"ws.status_secure_request", status);
      }
View Full Code Here

    private Packet processSecureRequest(PacketMessageInfo info,
  ClientAuthContext cAC, Subject clientSubject)
  throws WebServiceException {
       
  // send the request
  Packet response = next.process(info.getRequestPacket());
 
  // check for response
  Message m = response.getMessage();

  if (m != null) {

      if (cAC != null) {
   
View Full Code Here

    }
     
    public JAXBElement startSecureConversation(Packet packet)
            throws WSSecureConversationException {

  PacketMessageInfo info = new PacketMapMessageInfo(packet,new Packet());
  JAXBElement token = null;

  try {

      // gets the subject from the packet (puts one there if not found)
View Full Code Here

            if (GFServerConfigProvider.SOAP.equals(layer)) {
                // make this more efficient by operating on packet
                String rvalue = null;
                if (messageInfo instanceof PacketMessageInfo) {
                    PacketMessageInfo pmi = (PacketMessageInfo) messageInfo;
                    Packet p = (Packet) pmi.getRequestPacket();
                    if (p != null) {
                        Message m = p.getMessage();
                        if (m != null) {
                            WSDLPort port =
                                (WSDLPort) messageInfo.getMap().get("WSDL_MODEL");
                            if (port != null) {
                                WSDLBoundOperation w = m.getOperation(port);
View Full Code Here

                    new NMRClientConnection(wsdlLocation, service, endpointName, operation, isOneWay);

            con.initialize();
            con.sendRequest(request);

            Packet reply = null;
            if(System.getSecurityManager() == null) {
                reply = con.receiveResponse(request);
            } else {
                final NMRClientConnection fcon = con;
                final Packet frequest = request;

                reply = (Packetjava.security.AccessController.doPrivileged
                (new java.security.PrivilegedAction() {
                public java.lang.Object run() {
                    return fcon.receiveResponse(frequest);
View Full Code Here

    }
   
    final class WSToolkit extends Adapter.Toolkit implements TransportBackChannel {
       
        public void handle() {
            Packet packet = con.receiveRequest();
            try {
                packet = head.process(packet,con,this);
            } catch(Exception e) {
                logger.log(Level.SEVERE,"Exception in invoking the service:"
                        + e.getMessage());
View Full Code Here

TOP

Related Classes of com.sun.xml.ws.api.message.Packet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.