예제 #1
0
  private void fillSOAPAction(Packet packet, boolean isAddressingEnabled) {
    final boolean p = packet.packetTakesPriorityOverRequestContext;
    final String localSoapAction = p ? packet.soapAction : soapAction;
    final Boolean localSoapActionUse =
        p
            ? (Boolean) packet.invocationProperties.get(BindingProvider.SOAPACTION_USE_PROPERTY)
            : soapActionUse;

    // JAX-WS-596: Check the semantics of SOAPACTION_USE_PROPERTY before using the
    // SOAPACTION_URI_PROPERTY for
    // SoapAction as specified in the javadoc of BindingProvider. The spec seems to be little
    // contradicting with
    //  javadoc and says that the use property effects the sending of SOAPAction property.
    // Since the user has the capability to set the value as "" if needed, implement the javadoc
    // behavior.
    if ((localSoapActionUse != null && localSoapActionUse)
        || (localSoapActionUse == null && isAddressingEnabled)) {
      if (localSoapAction != null) {
        packet.soapAction = localSoapAction;
      }
    }

    if ((!isAddressingEnabled && (localSoapActionUse == null || !localSoapActionUse))
        && localSoapAction != null) {
      LOGGER.warning(
          "BindingProvider.SOAPACTION_URI_PROPERTY is set in the RequestContext but is ineffective,"
              + " Either set BindingProvider.SOAPACTION_USE_PROPERTY to true or enable AddressingFeature");
    }
  }
 public Message toSAAJ(Packet p, Boolean inbound) throws SOAPException {
   SAAJMessage message = SAAJFactory.read(p);
   if (message instanceof MessageWritable)
     ((MessageWritable) message).setMTOMConfiguration(p.getMtomFeature());
   if (inbound != null) transportHeaders(p, inbound, message.readAsSOAPMessage());
   return message;
 }
 @Override
 public NextAction processResponse(Packet response) {
   if (isNoValidation()
       || !feature.isOutbound()
       || response.getMessage() == null
       || !response.getMessage().hasPayload()
       || response.getMessage().isFault()) {
     return super.processResponse(response);
   }
   try {
     doProcess(response);
   } catch (SAXException se) {
     // TODO: Should we convert this to fault Message ??
     throw new WebServiceException(se);
   }
   return super.processResponse(response);
 }
예제 #4
0
  /**
   * Fill a {@link Packet} with values of this {@link RequestContext}.
   *
   * @param packet to be filled with context values
   * @param isAddressingEnabled flag if addressing enabled (to provide warning if necessary)
   */
  @SuppressWarnings("unchecked")
  public void fill(Packet packet, boolean isAddressingEnabled) {

    // handling as many properties as possible (all in propMap.keySet())
    // to avoid slow Packet.put()
    if (endpointAddress != null) {
      packet.endpointAddress = endpointAddress;
    }
    packet.contentNegotiation = contentNegotiation;
    fillSOAPAction(packet, isAddressingEnabled);
    mergeRequestHeaders(packet);

    Set<String> handlerScopeNames = new HashSet<String>();

    copySatelliteInto(packet);

    // extending properties ...
    for (String key : asMapLocal().keySet()) {

      // if it is not standard property it defaults to Scope.HANDLER
      if (!supportsLocal(key)) {
        handlerScopeNames.add(key);
      }

      // to avoid slow Packet.put(), handle as small number of props as possible
      // => only properties not from RequestContext object
      if (!propMap.containsKey(key)) {
        Object value = asMapLocal().get(key);
        if (packet.supports(key)) {
          // very slow operation - try to avoid it!
          packet.put(key, value);
        } else {
          packet.invocationProperties.put(key, value);
        }
      }
    }

    if (!handlerScopeNames.isEmpty()) {
      packet.getHandlerScopePropertyNames(false).addAll(handlerScopeNames);
    }
  }
 @Override
 public NextAction processRequest(Packet request) {
   if (isNoValidation()
       || !feature.isInbound()
       || !request.getMessage().hasPayload()
       || request.getMessage().isFault()) {
     return super.processRequest(request);
   }
   try {
     doProcess(request);
   } catch (SAXException se) {
     LOGGER.log(Level.WARNING, "Client Request doesn't pass Service's Schema Validation", se);
     // Client request is invalid. So sending specific fault code
     // Also converting this to fault message so that handlers may get
     // to see the message.
     SOAPVersion soapVersion = binding.getSOAPVersion();
     Message faultMsg =
         SOAPFaultBuilder.createSOAPFaultMessage(
             soapVersion, null, se, soapVersion.faultCodeClient);
     return doReturnWith(request.createServerResponse(faultMsg, wsdlPort, seiModel, binding));
   }
   return super.processRequest(request);
 }