Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build failures in SOAP examples #5826

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import ballerina/soap;
import ballerina/soap.soap12;

public function main() returns error? {
crypto:KeyStore keyStore = {
path: "/path/to/keyStore.p12",
password: "keyStorePassword"
};
crypto:KeyStore decryptionKeyStore = {
path: "/path/to/keyStore.p12",
password: "keyStorePassword"
};

soap12:Client soapClient = check new ("http://soap-endpoint.com?wsdl",
{
inboundSecurity: {
username: "user",
password: "password",
passwordType: soap:TEXT
signatureKeystore: keyStore,
decryptKeystore: decryptionKeyStore
}
}
);

xml body = xml `<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body></soap:Body>
</soap:Envelope>`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
import ballerina/crypto;
import ballerina/soap;
import ballerina/soap.soap12;

public function main() returns error? {
crypto:PrivateKey verificationKey = check crypto:decodeRsaPrivateKeyFromKeyFile(
"../resource/path/to/private.key"
);
crypto:PublicKey decryptionKey = check crypto:decodeRsaPublicKeyFromCertFile(
"../resource/path/to/public.crt"
);
crypto:KeyStore keyStore = {
path: "/path/to/keyStore.p12",
password: "keyStorePassword"
};
crypto:KeyStore decryptionKeyStore = {
path: "/path/to/decryptionKeyStore.p12",
password: "keyStorePassword"
};

soap12:Client soapClient = check new ("http://soap-endpoint.com?wsdl",
{
outboundSecurity: {
verificationKey: verificationKey,
signatureAlgorithm: soap:RSA_SHA256,
decryptionKey: decryptionKey,
decryptionAlgorithm: soap:RSA_ECB
signatureConfig: {
keystore: keyStore,
privateKeyAlias: "private-key-alias",
privateKeyPassword: "private-key-password"
},
encryptionConfig: {
keystore: decryptionKeyStore,
publicKeyAlias: "public-key-alias"
}
}
}
);

xml body = xml `<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body></soap:Body>
</soap:Envelope>`;
Expand Down
Loading