// Path: client-transport/src/main/java/com/nortal/jroad/client/service/configuration/XRoadServiceConfiguration.java
// public interface XRoadServiceConfiguration extends Serializable {
//   /**
//    * Returns an URL of institutions security server, typically in form of
//    * <code>http://minu_turvaserver/cgi-bin/consumer_proxy</code>.
//    */
//   String getSecurityServer();
// 
//   /**
//    * Returns name/prefix of the X-Tee database where the service-to-be-invoked resides.
//    */
//   String getDatabase();
// 
//   /**
//    * Returns name/prefix of the X-Tee database, which is actually specified in the WSDL of the service.
//    */
//   String getWsdlDatabase();
// 
//   /** Returns identifier of the person/entity who will be invoking the service */
//   String getIdCode();
// 
//   /** Returns name of file (or document) related to the service invokation. */
//   String getFile();
// 
//   /** Returns the service-to-be-invoked version. */
//   String getVersion();
// 
//   /** Returns the name of the (service's) <code>method</code> that will be called. */
//   String getMethod();
// 
//   /**
//    * Returns database xroad protocol version - by default v4
//    */
//   XRoadProtocolVersion getProtocolVersion();
// 
//   String getClientXRoadInstance();
// 
//   String getClientMemberClass();
// 
//   String getClientMemberCode();
// 
//   String getClientSubsystemCode();
// 
//   String getServiceXRoadInstance();
// 
//   String getServiceMemberClass();
// 
//   String getServiceMemberCode();
// 
//   String getServiceSubsystemCode();
// 
//   XroadObjectType getClientObjectType();
// 
//   XroadObjectType getServiceObjectType();
// }
// 
// Path: common/src/main/java/com/nortal/jroad/enums/XRoadProtocolVersion.java
// public enum XRoadProtocolVersion {
// 
//   V2_0("2.0", "xtee", "http://x-tee.riik.ee/xsd/xtee.xsd"),
//   V3_0("3.0", "xrd", "http://x-rd.net/xsd/xroad.xsd"),
//   V3_1("3.1", "xrd", "http://x-road.ee/xsd/x-road.xsd"),
//   V4_0("4.0", "xrd", "http://x-road.eu/xsd/xroad.xsd");
// 
//   private final String code;
//   private final String namespacePrefix;
//   private final String namespaceUri;
// 
//   private XRoadProtocolVersion(String code, String namespacePrefix, String namespaceUri) {
//     this.code = code;
//     this.namespaceUri = namespaceUri;
//     this.namespacePrefix = namespacePrefix;
//   }
// 
//   public String getCode() {
//     return code;
//   }
// 
//   public String getNamespacePrefix() {
//     return namespacePrefix;
//   }
// 
//   public String getNamespaceUri() {
//     return namespaceUri;
//   }
// 
//   public static XRoadProtocolVersion getValueByVersionCode(String code) {
//     for (XRoadProtocolVersion version : XRoadProtocolVersion.values()) {
//       if (version.getCode().equals(code)) {
//         return version;
//       }
//     }
//     return null;
//   }
// 
//   public static XRoadProtocolVersion getValueByNamespaceURI(String uri) {
//     for (XRoadProtocolVersion version : XRoadProtocolVersion.values()) {
//       if (version.getNamespaceUri().startsWith(uri)) {
//         return version;
//       }
//     }
//     return null;
//   }
// 
// }


import com.nortal.jroad.client.enums.XroadObjectType;
import com.nortal.jroad.client.service.configuration.XRoadServiceConfiguration;
import com.nortal.jroad.enums.XRoadProtocolVersion;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
import org.apache.commons.lang.StringUtils;
package com.nortal.jroad.client.service.callback;


/**
 * @author Aleksei Bogdanov (aleksei.bogdanov@nortal.com)
 * @author Lauri Lättemäe (lauri.lattemae@nortal.com) - protocol 4.0
 */
public class XRoadProtocolNamespaceStrategyV4 extends MessageCallbackNamespaceStrategy {

  private XRoadProtocolVersion protocol = XRoadProtocolVersion.V4_0;

  @Override
  public void addNamespaces(SOAPEnvelope env) throws SOAPException {
    env.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema");
    env.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
    env.addNamespaceDeclaration(protocol.getNamespacePrefix(), protocol.getNamespaceUri());
    env.addNamespaceDeclaration("id", "http://x-road.eu/xsd/identifiers");
  }

  @Override
// Path: client-transport/src/main/java/com/nortal/jroad/client/service/configuration/XRoadServiceConfiguration.java
// public interface XRoadServiceConfiguration extends Serializable {
//   /**
//    * Returns an URL of institutions security server, typically in form of
//    * <code>http://minu_turvaserver/cgi-bin/consumer_proxy</code>.
//    */
//   String getSecurityServer();
// 
//   /**
//    * Returns name/prefix of the X-Tee database where the service-to-be-invoked resides.
//    */
//   String getDatabase();
// 
//   /**
//    * Returns name/prefix of the X-Tee database, which is actually specified in the WSDL of the service.
//    */
//   String getWsdlDatabase();
// 
//   /** Returns identifier of the person/entity who will be invoking the service */
//   String getIdCode();
// 
//   /** Returns name of file (or document) related to the service invokation. */
//   String getFile();
// 
//   /** Returns the service-to-be-invoked version. */
//   String getVersion();
// 
//   /** Returns the name of the (service's) <code>method</code> that will be called. */
//   String getMethod();
// 
//   /**
//    * Returns database xroad protocol version - by default v4
//    */
//   XRoadProtocolVersion getProtocolVersion();
// 
//   String getClientXRoadInstance();
// 
//   String getClientMemberClass();
// 
//   String getClientMemberCode();
// 
//   String getClientSubsystemCode();
// 
//   String getServiceXRoadInstance();
// 
//   String getServiceMemberClass();
// 
//   String getServiceMemberCode();
// 
//   String getServiceSubsystemCode();
// 
//   XroadObjectType getClientObjectType();
// 
//   XroadObjectType getServiceObjectType();
// }
// 
// Path: common/src/main/java/com/nortal/jroad/enums/XRoadProtocolVersion.java
// public enum XRoadProtocolVersion {
// 
//   V2_0("2.0", "xtee", "http://x-tee.riik.ee/xsd/xtee.xsd"),
//   V3_0("3.0", "xrd", "http://x-rd.net/xsd/xroad.xsd"),
//   V3_1("3.1", "xrd", "http://x-road.ee/xsd/x-road.xsd"),
//   V4_0("4.0", "xrd", "http://x-road.eu/xsd/xroad.xsd");
// 
//   private final String code;
//   private final String namespacePrefix;
//   private final String namespaceUri;
// 
//   private XRoadProtocolVersion(String code, String namespacePrefix, String namespaceUri) {
//     this.code = code;
//     this.namespaceUri = namespaceUri;
//     this.namespacePrefix = namespacePrefix;
//   }
// 
//   public String getCode() {
//     return code;
//   }
// 
//   public String getNamespacePrefix() {
//     return namespacePrefix;
//   }
// 
//   public String getNamespaceUri() {
//     return namespaceUri;
//   }
// 
//   public static XRoadProtocolVersion getValueByVersionCode(String code) {
//     for (XRoadProtocolVersion version : XRoadProtocolVersion.values()) {
//       if (version.getCode().equals(code)) {
//         return version;
//       }
//     }
//     return null;
//   }
// 
//   public static XRoadProtocolVersion getValueByNamespaceURI(String uri) {
//     for (XRoadProtocolVersion version : XRoadProtocolVersion.values()) {
//       if (version.getNamespaceUri().startsWith(uri)) {
//         return version;
//       }
//     }
//     return null;
//   }
// 
// }


// Path: client-transport/src/main/java/com/nortal/jroad/client/service/callback/XRoadProtocolNamespaceStrategyV4.java
import com.nortal.jroad.client.enums.XroadObjectType;
import com.nortal.jroad.client.service.configuration.XRoadServiceConfiguration;
import com.nortal.jroad.enums.XRoadProtocolVersion;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
import org.apache.commons.lang.StringUtils;

package com.nortal.jroad.client.service.callback;


/**
 * @author Aleksei Bogdanov (aleksei.bogdanov@nortal.com)
 * @author Lauri Lättemäe (lauri.lattemae@nortal.com) - protocol 4.0
 */
public class XRoadProtocolNamespaceStrategyV4 extends MessageCallbackNamespaceStrategy {

  private XRoadProtocolVersion protocol = XRoadProtocolVersion.V4_0;

  @Override
  public void addNamespaces(SOAPEnvelope env) throws SOAPException {
    env.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema");
    env.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
    env.addNamespaceDeclaration(protocol.getNamespacePrefix(), protocol.getNamespaceUri());
    env.addNamespaceDeclaration("id", "http://x-road.eu/xsd/identifiers");
  }

  @Override
  public void addXTeeHeaderElements(SOAPEnvelope env, XRoadServiceConfiguration conf) throws SOAPException {