use of com.helger.peppol.sml.ISMLInfo in project phoss-smp by phax.
the class PageSecureSMPSettings method showObject.
@Override
protected void showObject(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ISMPSettings aObject) {
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final HCNodeList aNodeList = aWPEC.getNodeList();
final String sDirectoryName = SMPWebAppConfiguration.getDirectoryName();
{
final BootstrapCard aCard = aNodeList.addAndReturnChild(new BootstrapCard());
aCard.createAndAddHeader().addChild("REST API");
final BootstrapCardBody aCardBody = aCard.createAndAddBody();
final BootstrapViewForm aTable = aCardBody.addAndReturnChild(new BootstrapViewForm());
aTable.setLeft(4);
aTable.addFormGroup(new BootstrapFormGroup().setLabel("REST writable API disabled?").setCtrl(EPhotonCoreText.getYesOrNo(aObject.isRESTWritableAPIDisabled(), aDisplayLocale)));
}
{
final BootstrapCard aCard = aNodeList.addAndReturnChild(new BootstrapCard());
aCard.createAndAddHeader().addChild("SMK/SML");
final BootstrapCardBody aCardBody = aCard.createAndAddBody();
final BootstrapViewForm aTable = aCardBody.addAndReturnChild(new BootstrapViewForm());
aTable.setLeft(4);
aTable.addFormGroup(new BootstrapFormGroup().setLabel("SML connection required?").setCtrl(EPhotonCoreText.getYesOrNo(aObject.isSMLRequired(), aDisplayLocale)));
aTable.addFormGroup(new BootstrapFormGroup().setLabel("SML connection enabled?").setCtrl(EPhotonCoreText.getYesOrNo(aObject.isSMLEnabled(), aDisplayLocale)));
final ISMLInfo aSMLInfo = aObject.getSMLInfo();
aTable.addFormGroup(new BootstrapFormGroup().setLabel("SML to be used").setCtrl(aSMLInfo == null ? em("none") : HCSMLSelect.getDisplayNameNode(aSMLInfo)));
}
{
final BootstrapCard aCard = aNodeList.addAndReturnChild(new BootstrapCard());
aCard.createAndAddHeader().addChild(sDirectoryName);
final BootstrapCardBody aCardBody = aCard.createAndAddBody();
final BootstrapViewForm aTable = aCardBody.addAndReturnChild(new BootstrapViewForm());
aTable.setLeft(4);
aTable.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " integration required?").setCtrl(EPhotonCoreText.getYesOrNo(aObject.isDirectoryIntegrationRequired(), aDisplayLocale)));
aTable.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " integration enabled?").setCtrl(EPhotonCoreText.getYesOrNo(aObject.isDirectoryIntegrationEnabled(), aDisplayLocale)));
aTable.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " integration automatic update?").setCtrl(EPhotonCoreText.getYesOrNo(aObject.isDirectoryIntegrationAutoUpdate(), aDisplayLocale)));
aTable.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " hostname").setCtrl(HCA.createLinkedWebsite(aObject.getDirectoryHostName())));
}
}
use of com.helger.peppol.sml.ISMLInfo in project peppol-commons by phax.
the class BDXRClientReadOnlyTest method testReadTOOP.
@Test
@Ignore("Because it may take long to execute")
@IgnoredNaptrTest
public void testReadTOOP() throws SMPDNSResolutionException, SMPClientException {
final IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme("9930:167064991");
final IDocumentTypeIdentifier aDocTypeID = SimpleIdentifierFactory.INSTANCE.createDocumentTypeIdentifier("toop-doctypeid-qns", "urn:eu:toop:ns:dataexchange-1p40::Response##urn:eu.toop.response.registeredorganization::1.40");
// TOOP SML
final ISMLInfo aSMLInfo = new SMLInfo("toop", "SMK", "toop.acc.edelivery.tech.ec.europa.eu.", "https://acc.edelivery.tech.ec.europa.eu/edelivery-sml", true);
// PEPPOL URL provider
final BDXRClientReadOnly aBDXRClient = new BDXRClientReadOnly(BDXLURLProvider.INSTANCE, aPI, aSMLInfo);
aBDXRClient.setVerifySignature(false);
assertEquals("http://smp.toop.egov.iwvi.uni-koblenz.de/", aBDXRClient.getSMPHostURI());
if (false) {
final SignedServiceMetadataType aMetadata = aBDXRClient.getServiceMetadata(aPI, aDocTypeID);
assertNotNull(aMetadata);
}
}
use of com.helger.peppol.sml.ISMLInfo in project peppol-commons by phax.
the class BDXRClientReadOnlyTest method testReadDE4A.
@Test
@Ignore("Because it may take long to execute")
@IgnoredNaptrTest
public void testReadDE4A() throws Exception {
final IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme("9999:at000000271");
final IDocumentTypeIdentifier aDocTypeID = SimpleIdentifierFactory.INSTANCE.createDocumentTypeIdentifier("urn:de4a-eu:CanonicalEvidenceType", "CompanyRegistration");
final KeyStore aTS = KeyStoreHelper.loadKeyStoreDirect(EKeyStoreType.JKS, "truststores/de4a-truststore-test-smp-pw-de4a.jks", "de4a");
assertNotNull(aTS);
// TOOP SML
final ISMLInfo aSMLInfo = new SMLInfo("dea4", "SMK", "de4a.acc.edelivery.tech.ec.europa.eu.", "https://acc.edelivery.tech.ec.europa.eu/edelivery-sml", true);
// BDXL URL provider
final BDXRClientReadOnly aBDXRClient = new BDXRClientReadOnly(BDXLURLProvider.INSTANCE, aPI, aSMLInfo);
// Custom truststore is needed atm
aBDXRClient.setTrustStore(aTS);
assertEquals("https://de4a-smp.egovlab.eu/", aBDXRClient.getSMPHostURI());
{
final SignedServiceMetadataType aMetadata = aBDXRClient.getServiceMetadata(aPI, aDocTypeID);
assertNotNull(aMetadata);
}
}
use of com.helger.peppol.sml.ISMLInfo in project peppol-commons by phax.
the class MainForArunFromBasware method main.
public static void main(final String[] args) throws Exception {
// START MODIFY BELOW
// Your SMP ID
final String SMP_ID = "TEST-SMP";
// Use SMK or SML?
final ISMLInfo aSMLInfo = ESML.DIGIT_TEST;
// Keystore path and password
final EKeyStoreType eKeyStoreType = EKeyStoreType.JKS;
final String sKeystorePath = "keystore/smp.pilot.jks";
final String sKeystorePassword = "peppol";
// Participant to be created
final String sServiceGroupID = "0088:5798000000001";
// Create (true) or delete (false) participant?
final boolean bCreate = false;
// Proxy server settings
final String sProxyHostname = null;
final int nProxyPort = 0;
WSHelper.setMetroDebugSystemProperties(true);
// Set proxy as system properties
if (nProxyPort > 0 && StringHelper.hasText(sProxyHostname)) {
SystemProperties.setPropertyValue("http.proxyHost", sProxyHostname);
SystemProperties.setPropertyValue("http.proxyPort", nProxyPort);
SystemProperties.setPropertyValue("https.proxyHost", sProxyHostname);
SystemProperties.setPropertyValue("https.proxyPort", nProxyPort);
}
final ManageParticipantIdentifierServiceCaller aParticipantClient = new ManageParticipantIdentifierServiceCaller(aSMLInfo);
if (aSMLInfo.isClientCertificateRequired()) {
// Main key storage
final KeyStore aKeyStore = KeyStoreHelper.loadKeyStoreDirect(eKeyStoreType, sKeystorePath, sKeystorePassword);
// Key manager
final KeyManagerFactory aKeyManagerFactory = KeyManagerFactory.getInstance("SunX509");
aKeyManagerFactory.init(aKeyStore, sKeystorePassword.toCharArray());
// Assign key manager and empty trust manager to SSL context
final SSLContext aSSLCtx = SSLContext.getInstance("TLS");
aSSLCtx.init(aKeyManagerFactory.getKeyManagers(), new TrustManager[] { new TrustManagerTrustAll(false) }, null);
aParticipantClient.setSSLSocketFactory(aSSLCtx.getSocketFactory());
}
// Main WS call
final IParticipantIdentifier aServiceGroupID = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme(sServiceGroupID);
if (bCreate) {
// Create
aParticipantClient.create(SMP_ID, aServiceGroupID);
LOGGER.info("Successfully created participant " + aServiceGroupID.getURIEncoded());
} else {
// Delete
aParticipantClient.delete(SMP_ID, aServiceGroupID);
LOGGER.info("Successfully deleted participant " + aServiceGroupID.getURIEncoded());
}
}
Aggregations