Java Code Examples for javax.xml.ws.handler.soap.SOAPMessageContext#containsKey()

The following examples show how to use javax.xml.ws.handler.soap.SOAPMessageContext#containsKey() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SoapActionHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public boolean handleOutbound(SOAPMessageContext context) {
   try {
      boolean hasSoapAction = false;
      if (context.containsKey("javax.xml.ws.soap.http.soapaction.use")) {
         hasSoapAction = (Boolean)context.get("javax.xml.ws.soap.http.soapaction.use");
      }

      if (hasSoapAction) {
         String soapAction = (String)context.get("javax.xml.ws.soap.http.soapaction.uri");
         LOG.debug("Adding SOAPAction to mimeheader");
         SOAPMessage msg = context.getMessage();
         String[] headers = msg.getMimeHeaders().getHeader("SOAPAction");
         if (headers != null) {
            LOG.warn("Removing SOAPAction with values: " + ArrayUtils.toString(headers));
            msg.getMimeHeaders().removeHeader("SOAPAction");
         }

         msg.getMimeHeaders().addHeader("SOAPAction", soapAction);
         msg.saveChanges();
      }

      return true;
   } catch (SOAPException var6) {
      throw SOAPFaultFactory.newSOAPFaultException("WSSecurity problem: [SOAPACTION]" + var6.getMessage(), var6);
   }
}
 
Example 2
Source File: SoapActionHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public boolean handleOutbound(SOAPMessageContext context) {
   try {
      boolean hasSoapAction = false;
      if (context.containsKey("javax.xml.ws.soap.http.soapaction.use")) {
         hasSoapAction = (Boolean)context.get("javax.xml.ws.soap.http.soapaction.use");
      }

      if (hasSoapAction) {
         String soapAction = (String)context.get("javax.xml.ws.soap.http.soapaction.uri");
         LOG.debug("Adding SOAPAction to mimeheader");
         SOAPMessage msg = context.getMessage();
         String[] headers = msg.getMimeHeaders().getHeader("SOAPAction");
         if (headers != null) {
            LOG.warn("Removing SOAPAction with values: " + ArrayUtils.toString(headers));
            msg.getMimeHeaders().removeHeader("SOAPAction");
         }

         msg.getMimeHeaders().addHeader("SOAPAction", soapAction);
         msg.saveChanges();
      }

      return true;
   } catch (SOAPException var6) {
      throw SOAPFaultFactory.newSOAPFaultException("WSSecurity problem: [SOAPACTION]" + var6.getMessage(), var6);
   }
}
 
Example 3
Source File: SoapActionHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public boolean handleOutbound(SOAPMessageContext context) {
   try {
      boolean hasSoapAction = false;
      if (context.containsKey("javax.xml.ws.soap.http.soapaction.use")) {
         hasSoapAction = ((Boolean)context.get("javax.xml.ws.soap.http.soapaction.use"));
      }

      if (hasSoapAction) {
         String soapAction = (String)context.get("javax.xml.ws.soap.http.soapaction.uri");
         LOG.debug("Adding SOAPAction to mimeheader");
         SOAPMessage msg = context.getMessage();
         String[] headers = msg.getMimeHeaders().getHeader("SOAPAction");
         if (headers != null) {
            LOG.warn("Removing SOAPAction with values: " + ArrayUtils.toString(headers));
            msg.getMimeHeaders().removeHeader("SOAPAction");
         }

         msg.getMimeHeaders().addHeader("SOAPAction", soapAction);
         msg.saveChanges();
      }

      return true;
   } catch (SOAPException var6) {
      throw SOAPFaultFactory.newSOAPFaultException("WSSecurity problem: [SOAPACTION]" + var6.getMessage(), var6);
   }
}
 
Example 4
Source File: SoapActionHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public boolean handleOutbound(SOAPMessageContext context) {
   try {
      boolean hasSoapAction = false;
      if (context.containsKey("javax.xml.ws.soap.http.soapaction.use")) {
         hasSoapAction = ((Boolean)context.get("javax.xml.ws.soap.http.soapaction.use")).booleanValue();
      }

      if (hasSoapAction) {
         String soapAction = (String)context.get("javax.xml.ws.soap.http.soapaction.uri");
         LOG.debug("Adding SOAPAction to mimeheader");
         SOAPMessage msg = context.getMessage();
         String[] headers = msg.getMimeHeaders().getHeader("SOAPAction");
         if (headers != null) {
            LOG.warn("Removing SOAPAction with values: " + ArrayUtils.toString(headers));
            msg.getMimeHeaders().removeHeader("SOAPAction");
         }

         msg.getMimeHeaders().addHeader("SOAPAction", soapAction);
         msg.saveChanges();
      }

      return true;
   } catch (SOAPException var6) {
      throw SOAPFaultFactory.newSOAPFaultException("WSSecurity problem: [SOAPACTION]" + var6.getMessage(), var6);
   }
}
 
Example 5
Source File: SoapActionHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public boolean handleOutbound(SOAPMessageContext context) {
   try {
      boolean hasSoapAction = false;
      if (context.containsKey("javax.xml.ws.soap.http.soapaction.use")) {
         hasSoapAction = (Boolean) context.get("javax.xml.ws.soap.http.soapaction.use");
      }

      if (hasSoapAction) {
         String soapAction = (String)context.get("javax.xml.ws.soap.http.soapaction.uri");
         LOG.debug("Adding SOAPAction to mimeheader");
         SOAPMessage msg = context.getMessage();
         String[] headers = msg.getMimeHeaders().getHeader("SOAPAction");
         if (headers != null) {
            LOG.warn("Removing SOAPAction with values: " + ArrayUtils.toString(headers));
            msg.getMimeHeaders().removeHeader("SOAPAction");
         }

         msg.getMimeHeaders().addHeader("SOAPAction", soapAction);
         msg.saveChanges();
      }

      return true;
   } catch (SOAPException var6) {
      throw SOAPFaultFactory.newSOAPFaultException("WSSecurity problem: [SOAPACTION]" + var6.getMessage(), var6);
   }
}
 
Example 6
Source File: SchemaValidatorHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private boolean isXOPEnabled(SOAPMessageContext context) {
   boolean xopEnabled = false;
   if (context.containsKey("http://www.w3.org/2004/08/soap/features/http-optimization")) {
      xopEnabled = (Boolean)context.get("http://www.w3.org/2004/08/soap/features/http-optimization");
   }

   return xopEnabled;
}
 
Example 7
Source File: SchemaValidatorHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private boolean isXOPEnabled(SOAPMessageContext context) {
   boolean xopEnabled = false;
   if (context.containsKey("http://www.w3.org/2004/08/soap/features/http-optimization")) {
      xopEnabled = (Boolean)context.get("http://www.w3.org/2004/08/soap/features/http-optimization");
   }

   return xopEnabled;
}
 
Example 8
Source File: SchemaValidatorHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private boolean isXOPEnabled(SOAPMessageContext context) {
   boolean xopEnabled = false;
   if (context.containsKey("http://www.w3.org/2004/08/soap/features/http-optimization")) {
      xopEnabled = ((Boolean)context.get("http://www.w3.org/2004/08/soap/features/http-optimization"));
   }

   return xopEnabled;
}
 
Example 9
Source File: SchemaValidatorHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private boolean isXOPEnabled(SOAPMessageContext context) {
   boolean xopEnabled = false;
   if (context.containsKey("http://www.w3.org/2004/08/soap/features/http-optimization")) {
      xopEnabled = ((Boolean)context.get("http://www.w3.org/2004/08/soap/features/http-optimization")).booleanValue();
   }

   return xopEnabled;
}
 
Example 10
Source File: SchemaValidatorHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private boolean isXOPEnabled(SOAPMessageContext context) {
   boolean xopEnabled = false;
   if (context.containsKey("http://www.w3.org/2004/08/soap/features/http-optimization")) {
      xopEnabled = (Boolean) context.get("http://www.w3.org/2004/08/soap/features/http-optimization");
   }

   return xopEnabled;
}