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

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


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


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

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

            Subject locClientSubject = getClientSubject(request);
View Full Code Here

     
    @Override
    public JAXBElement startSecureConversation(Packet packet)
            throws WSSecureConversationException {

  PacketMessageInfo locInfo = 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

     */
    @Override
    public void preDestroy() {
  helper.disable();
         try {
            Packet request = new Packet();
            PacketMessageInfo info = new PacketMapMessageInfo(request, new Packet());
            Subject subj = new Subject();
            ServerAuthContext sAC = helper.getServerAuthContext(info, subj);
            if (sAC != null && WSIT_SERVER_AUTH_CONTEXT.equals(sAC.getClass().getName())) {
                sAC.cleanSubject(info, subj);
            }
View Full Code Here

    public Packet process(Packet request) {
        if (isHttpBinding) {
            return next.process(request);
        }
       
        Packet response;
        try {
            response = processRequest(request);
        } catch(Exception e) {
            if (_logger.isLoggable(Level.FINE)) {
                _logger.log(Level.FINE, "Failure in security pipe process", e);
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) {
                        _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() {
                                @Override
        public Object run() throws Exception {
            // proceed to invoke the endpoint
            return next.process(validatedRequest);
        }
          }, null);
        } catch (PrivilegedActionException pae) {
            Throwable cause = pae.getCause();
      _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

            if (isHttpBinding) {
                return doInvoke(super.next, request);
            }

            AuthStatus status = AuthStatus.SUCCESS;
            info = new PacketMapMessageInfo(request, new Packet());
            // XXX at this time, we expect the server subject to be null
            serverSubject = (Subject) request.invocationProperties.get(PipeConstants.SERVER_SUBJECT);

            //could change the request packet
            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
                Packet ret = helper.getFaultResponse(info.getRequestPacket(), info.getResponsePacket(), wse);
                return doReturnWith(ret);

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

            Packet response = null;
            if (status == AuthStatus.SUCCESS) {
                boolean authorized = false;
                try {
                    helper.authorize(validatedRequest);
                    authorized = true;
View Full Code Here

        try{
            //could be oneway
            if((response == null) || (response.getMessage() == null)){
                return doReturnWith(response);
            }
            Packet resp = response;
      // secure response, including if it is a fault
      if (sAC != null && response.getMessage() != null) {
    info.setResponsePacket(response);
    resp = processResponse(info, sAC, serverSubject);
      }
View Full Code Here

    final class HttpToolkit extends Adapter.Toolkit {
        public void handle(WSHTTPConnection con) throws IOException {
            try {
                boolean invoke = false;
                Packet packet;
                try {
                    packet = decodePacket(con, codec);
                    invoke = true;
                } catch(Exception e) {
                    packet = new Packet();
                    if (e instanceof ExceptionHasMessage) {
                        LOGGER.log(Level.SEVERE, e.getMessage(), e);
                        packet.setMessage(((ExceptionHasMessage)e).getFaultMessage());
                    } else if (e instanceof UnsupportedMediaException) {
                        LOGGER.log(Level.SEVERE, e.getMessage(), e);
                        con.setStatus(WSHTTPConnection.UNSUPPORTED_MEDIA);
                    } else {
                        LOGGER.log(Level.SEVERE, e.getMessage(), e);
View Full Code Here

     *         UnsupportedMediaException to indicate to send 415 error code
     */
    private Packet decodePacket(@NotNull WSHTTPConnection con, @NotNull Codec codec) throws IOException {
        String ct = con.getRequestHeader("Content-Type");
        InputStream in = con.getInput();
        Packet packet = new Packet();
        packet.soapAction = fixQuotesAroundSoapAction(con.getRequestHeader("SOAPAction"));
        packet.wasTransportSecure = con.isSecure();
        packet.acceptableMimeTypes = con.getRequestHeader("Accept");
        packet.addSatellite(con);
        addSatellites(packet);
        packet.isAdapterDeliversNonAnonymousResponse = true;
        packet.component = this;
        packet.transportBackChannel = new Oneway(con);
        packet.webServiceContextDelegate = con.getWebServiceContextDelegate();
        packet.setState(Packet.State.ServerRequest);
        if (dump || LOGGER.isLoggable(Level.FINER)) {
            ByteArrayBuffer buf = new ByteArrayBuffer();
            buf.write(in);
            in.close();
            dump(buf, "HTTP request", con.getRequestHeaders());
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.