AbstractBaseOpenSPCoop2SoapMessage.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */

  20. package org.openspcoop2.message.soap;

  21. import java.util.List;

  22. import javax.xml.soap.SOAPMessage;

  23. import org.openspcoop2.message.AbstractBaseOpenSPCoop2Message;
  24. import org.openspcoop2.message.OpenSPCoop2MessageFactory;
  25. import org.openspcoop2.message.OpenSPCoop2SoapMessage;
  26. import org.openspcoop2.message.context.MessageContext;
  27. import org.openspcoop2.message.exception.MessageException;
  28. import org.openspcoop2.message.exception.MessageNotSupportedException;
  29. import org.openspcoop2.message.soap.mtom.MTOMUtilities;
  30. import org.openspcoop2.message.soap.mtom.MtomXomPackageInfo;
  31. import org.openspcoop2.message.soap.mtom.MtomXomReference;

  32. /**
  33.  * AbstractBaseOpenSPCoop2SoapMessage_impl
  34.  *
  35.  * @author Andrea Poli (apoli@link.it)
  36.  * @author $Author$
  37.  * @version $Rev$, $Date$
  38.  */
  39. public abstract class AbstractBaseOpenSPCoop2SoapMessage extends AbstractBaseOpenSPCoop2Message implements OpenSPCoop2SoapMessage {

  40.     /* OpenSPCoop2SoapMessageCore */
  41.     public OpenSPCoop2SoapMessageCore soapCore;
  42.    

  43.     public AbstractBaseOpenSPCoop2SoapMessage(OpenSPCoop2MessageFactory messageFactory) {
  44.         super(messageFactory);
  45.         this.soapCore = new OpenSPCoop2SoapMessageCore();
  46.     }
  47.    
  48.    
  49.     /* Copy Resources to another instance */
  50.    
  51.     public void copyResourceFrom(OpenSPCoop2SoapMessageCore core) {
  52.         core.copyInstanceFieldValueTo(this.soapCore);
  53.     }
  54.    
  55.     @Override
  56.     public MessageContext serializeResourcesTo() throws MessageException{
  57.         MessageContext messageContext = super.serializeResourcesTo();
  58.         return this.soapCore.serializeResourcesTo(messageContext);
  59.     }
  60.    
  61.     @Override
  62.     public void readResourcesFrom(MessageContext messageContext) throws MessageException{
  63.         super.readResourcesFrom(messageContext);
  64.         this.soapCore.readResourcesFrom(messageContext);
  65.     }
  66.    
  67.    
  68.     /* Elementi SOAP */
  69.    
  70.     protected abstract SOAPMessage _getSOAPMessage() throws MessageException;
  71.    
  72.     @Override
  73.     public SOAPMessage getSOAPMessage() throws MessageException,MessageNotSupportedException{
  74.         return this.soapCore.getSOAPMessage(this._getSOAPMessage(), this.getMessageType());
  75.     }
  76.    

  77.     /* SOAPAction */
  78.    
  79.     @Override
  80.     public String getSoapAction(){
  81.         return this.soapCore.getSoapAction();
  82.     }
  83.    
  84.     @Override
  85.     public void setSoapAction(String soapAction){
  86.         this.soapCore.setSoapAction(soapAction);
  87.     }
  88.    
  89.    
  90.    
  91.     /* MTOM */
  92.    
  93.     @Override
  94.     public List<MtomXomReference> mtomUnpackaging() throws MessageException,MessageNotSupportedException{
  95.         return MTOMUtilities.unpackaging(this, false, true);
  96.     }
  97.     @Override
  98.     public List<MtomXomReference> mtomPackaging( List<MtomXomPackageInfo> packageInfos) throws MessageException,MessageNotSupportedException{
  99.         return MTOMUtilities.packaging(this, packageInfos, true);
  100.     }
  101.     @Override
  102.     public List<MtomXomReference> mtomVerify( List<MtomXomPackageInfo> packageInfos) throws MessageException,MessageNotSupportedException{
  103.         return MTOMUtilities.verify(this, packageInfos, true);
  104.     }
  105.     @Override
  106.     public List<MtomXomReference> mtomFastUnpackagingForXSDConformance() throws MessageException,MessageNotSupportedException{
  107.         return MTOMUtilities.unpackaging(this, true, true);
  108.     }
  109.     @Override
  110.     public void mtomRestoreAfterXSDConformance(List<MtomXomReference> references) throws MessageException,MessageNotSupportedException{
  111.         MTOMUtilities.restoreAfterFastUnpackaging(this, references, true);
  112.     }
  113.    
  114.    
  115.    
  116.    
  117.     /* WSSecurity */
  118.    
  119.     @Override
  120.     public boolean isThrowExceptionIfFoundMoreSecurityHeader() {
  121.         return this.soapCore.isThrowExceptionIfFoundMoreSecurityHeader();
  122.     }

  123.     @Override
  124.     public void setThrowExceptionIfFoundMoreSecurityHeader(boolean throwExceptionIfFoundMoreSecurityHeader) {
  125.         this.soapCore.setThrowExceptionIfFoundMoreSecurityHeader(throwExceptionIfFoundMoreSecurityHeader);
  126.     }
  127. }