|
|
This tutorial is a step by step guide on how to sign a SOAP message with Apache Rampart using policy based configuration. We will also look at how to deploy the Apache Rampart module in Axis2. Although we have already covered deploying Rampart in Axis2, in part one of this tutorial, it is repeated here again for completeness sake only. Those who have already deployed Rampart can skip this section. We will then go and look at how a Axis2 Web service and a client can be secured with Rampart. As Axis2/Rampart has been proven to be highly interoperable, either the Web service or the client can still be written in some other Web service stack (including .NET / C / PHP) other than Axis2/Java.
See Web Services Security with Apache Rampart – Part 1 (Transport Level Security) for part I of this tutorial.
| <Project/lan> | version |
| Apache Rampart | 1.3 |
| Apache Axis2 | 1.3 |
In this tutorial we will look at a scenario where SOAP messages will be signed. Signing SOAP messages ensures authentication, integrity and non-repudiation. As you could observe from the diagram given below a service and a client trusts each other, and have each other’s certificates in their key stores.

We will use the Axis2 WAR deployed in Apache Tomcat server for this tutorial, as it is one of the most common use cases.
If you have read part one of this tutorial and have successfully deployed Rampart in Axis2, then you can skip this section and jump directly to the section titled “Securing the Service”.
Apache Rampart 1.3 binary distribution can be downloaded from here. Rampart distribution contains two module files, rampart-1.3 and rahas-1.3.mar . These module files should be copied to the modules directory of the Axis2 engine that can be found in TOMCAT_HOME/webapps/axis2/WEB-INF/modules, where TOMCAT_HOME is the home directory of the Apache Tomcat server in which Axis2 war is deployed. All the dependancy jars needed for Apache Rampart can be found under the libs directory of the Rampart distribution. These need to be copied to the lib directory of the Axis2 engine, which can found in TOMCAT_HOME/webapps/axis2/WEB-INF/lib.
You can check whether Apache Rampart is successfully deployed by logging in to Axis2 as the admin and using the System Components/available modules option in admin Web console . Both "rampart" and "rahas" should be listed under available modules, if you deploying of rampart and rahas modules has been successfull.
We will use the same simple service we used in part one of this tutorial for in this section as well. It has a single operation called "add" that adds two integers and returns the sum of them. We will be using the code first approach for this tutorial for simplicity. Service implementation class is given below.
package tutorial.rampart.service;
/**
* Secure Service implementation class
*/
public class SecureService {
public int add(int a, int b) {
return a+b;
}
}
Service descriptor for the above mentioned service is given below. You can find more information on how to write an Axis2 Web service in the tutorial titled "Hello world with Apache Axis2".
<service>
<module ref="rampart"/>
<parameter name="ServiceClass" locked="false">tutorial.rampart.service.SecureService</parameter>
<operation name="add">
<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</operation>
</service>
To sign messages back and forth, both the client and the service need to posses public-private key pairs. In this tutorial we will be using X509 certificates for both the client and the service. How to create key pairs and import them to key stores is out of the scope of this tutorial and you can find that information in another tutorial titled “Setting Up Keystores for a Client and a Service”. The service.jks which we use as the key store of the service, can be downloaded with the source code of this tutorial. You can use the keytool shipped with Java if you want inspect the keystore and see what keys it contains.
$ keytool -list -v -keystore path/to/service.jks -storepass servicePW
Keystore type: jks
Keystore provider: SUN
Your keystore contains 2 entries
Alias name: service
Creation date: Mar 21, 2008
Entry type: keyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=service, OU=Secuirty Team, O=WSO2, L=colombo, ST=Western, C=LK, EMAILADDRESS=service@wso2.com
Issuer: CN=service, OU=Secuirty Team, O=WSO2, L=colombo, ST=Western, C=LK, EMAILADDRESS=service@wso2.com
Serial number: 47e3b6c0
Valid from: Fri Mar 21 18:53:12 LKT 2008 until: Tue Mar 15 18:53:12 LKT 2033
Certificate fingerprints:
MD5: C4:B9:2D:70:22:E9:08:6B:07:3B:2C:1E:5B:87:ED:09
SHA1: 4F:C9:0C:42:01:B7:BE:AC:0D:4F:AC:00:A2:E7:CC:CA:07:40:8E:BB
*******************************************
*******************************************
Alias name: client
Creation date: Mar 21, 2008
Entry type: trustedCertEntry
Owner: CN=client, OU=Secuirty Team, O=WSO2, L=colombo, ST=Western, C=LK, EMAILADDRESS=client@wso2.com
Issuer: CN=client, OU=Secuirty Team, O=WSO2, L=colombo, ST=Western, C=LK, EMAILADDRESS=client@wso2.com
Serial number: 47e3b631
Valid from: Fri Mar 21 18:50:49 LKT 2008 until: Tue Mar 15 18:50:49 LKT 2033
Certificate fingerprints:
MD5: DE:66:EB:95:18:2E:44:97:05:CE:DF:FC:83:E9:53:C3
SHA1: CE:E5:F0:BB:2F:46:A9:F0:45:60:4C:16:1B:33:FC:B5:09:0B:8C:13
*******************************************
*******************************************
As you can see, service.jks contains it’s public-private key and the public key of client as trusted certificates. Service needs it’s private key to sign the messages which is pretty obvious but why does it need the certificate of the client? It is because it needs the client’s public key to verify the signature of the client.
In part one of this tutorial, we used a password callback for the service to authenticate the username tokens. You might be wondering why we need to write a password callback class for this scenario as we are not using username tokens. The use of password callback class here is different to its use in the previous tutorial. As you already know, we need the private key of the service to sign SOAP messages. Each private key has a password associated with it. In order to retrieve the private key, we need to provide the password of the relevant key and this password callback class is used for that purpose. The password callback class used in this tutorial is given below. Even though passwords are hard coded in this example, they can also be retrieved from a database, a LDAP server or any other storage by writing the relevant password retrieval logic in the password callback class.
package tutorial.rampart.service;
import org.apache.ws.security.WSPasswordCallback;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import java.io.IOException;
public class PWCBHandler implements CallbackHandler {
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
// To use the private key to sign messages, we need to provide
// the private key password
WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
if(pwcb.getIdentifer().equals("service") ) {
pwcb.setPassword("servicePW");
return;
}
}
}
}
We will be using the policy based configuration approach of Apache Rampart for this tutorial. So, we should construct a suitable security policy using WS-Security policy language to define the requirements of the Web service. The security policy used in this tutorial is given below.
<wsp:Policy wsu:Id="SigOnly" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:InitiatorToken>
<wsp:Policy>
<sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
<wsp:Policy>
<sp:WssX509V3Token10/>
</wsp:Policy>
</sp:X509Token>
</wsp:Policy>
</sp:InitiatorToken>
<sp:RecipientToken>
<wsp:Policy>
<sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
<wsp:Policy>
<sp:WssX509V3Token10/>
</wsp:Policy>
</sp:X509Token>
</wsp:Policy>
</sp:RecipientToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:TripleDesRsa15/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Strict/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
<sp:OnlySignEntireHeadersAndBody/>
</wsp:Policy>
</sp:AsymmetricBinding>
<sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<sp:Body/>
</sp:SignedParts>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
As you can see, the above security policy contains two main security assertions: an asymmetric binding assertion and a signed parts assertion. Asymmetric binding defines what keys to be used and a few additional properties such as which algorithms to be used in cryptographic operations, layout of the security header, etc. Signed parts assertion defines what parts of the message should be signed. In this tutorial we will be signing the SOAP body of the message.
More information on WS-Security Policy language and how we can construct security policies to suit our security requirements can be found in the article titled ”Understanding WS – Security Policy Language”.
Rampart uses a custom assertion called RampartConfig assertion to provide Rampart specific configuration details to Rampart Engine. RampartConfig for this tutorial is given below.
<ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
<ramp:user>service</ramp:user>
<ramp:passwordCallbackClass>tutorial.rampart.service.PWCBHandler</ramp:passwordCallbackClass>
<ramp:signatureCrypto>
<ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
<ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
<ramp:property name="org.apache.ws.security.crypto.merlin.file">path/to/service.jks</ramp:property>
<ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">servicePW</ramp:property>
</ramp:crypto>
</ramp:signatureCrypto>
</ramp:RampartConfig>
<ramp:user/> provides the alias of the key that should be used to sign the messages. As we have already seen in the listing of service.jks, private key alias of the service is “service”. <ramp:passwordCallbackClass> provides the password callback class which is used to retrieve the private key password. <ramp:signatureCrypto> carries information on the key store used to retrieve keys to create and verify signatures. These information include crypto provider, key store type, key store file and the key store password. (Note that this is the password of the key store and not the password of the private key).
Now, we will look at how we can engage Rampart to the Web service and apply the security policy. This is done completly using the service descriptor. We don't have to modify the source of the Web service to secure it. First, we engage the Rampart module to the Web service adding <module ref="rampart"/> element to the service descriptor. Then, we apply security by adding the policy to the service descriptor. Modified service descriptor after engaging Rampart and applying the policy is given below. Elements within the policy element are not shown for brevity.
<service>
<module ref="rampart"/>
<parameter name="ServiceClass" locked="false">tutorial.rampart.service.SecureService</parameter>
<operation name="add">
<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</operation>
<wsp:Policy wsu:Id="UTOverTransport" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> </sp:AsymmetricBinding>
<sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"></sp:SignedParts>
<ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy"> </ramp:RampartConfig>
<wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
</service>
Now we need to deploy this service in the Axis2 server. Create a service archive named SecureService.aar and drop it in to the services directory that can be found in TOMCAT_HOME/webapps/axis2/WEB-INF/services, where TOMCAT_HOME is the home of Apache Tomcat server.
When a security policy is applied to a Web service, the WSDL will be annotated with that particular security policy so the client can secure the SOAP messages according to the policy defined in the WSDL. Code generators that generate Stubs to access the Web service can make use of these security polices defined in the WSDL. The policy annotated WSDL of the Web service we use for this tutorial can be found here.
Java2WSDL tool provided by Axis2 can be used to generate Stubs which can then be used to call Web services. Given below is the command we use in this tutorial to generate the Stub. -uri option is used to provide the URL of the WSDL, -p option is used to specify a custom package name for the generated code, -o option to specify a directory path for the generated code and -uw option to switch on un-wrapping.
[Linux] $ sh WSDL2Java.sh -uri http://localhost:8080/axis2/services/SecureService?wsdl -p tutorial.rampart.client -uw -o /project/path/ [Windows] $ WSDL2Java.bat -uri http://localhost:8080/axis2/services/SecureService?wsdl -p tutorial.rampart.client -uw -o /project/to/path/
Now, we will write a client for the Web service using the Stub generated. Source code of the client is given below:
package tutorial.rampart.client;
public class SecureServiceCGClient {
public static void main(String[] args) throws Exception {
SecureServiceStub stub = new SecureServiceStub(null,"http://localhost:8080/axis2/services/SecureService");
int a = 3;
int b = 4;
int result = stub.add(a, b);
System.out.println(a + " + " + b + " = " + result);
}
}
As mentioned in "Securing the service", to sign the messages back and forth, the client also need to posses public-private key pair. In this tutorial we will be using X509 certificates for both client and the service. The client.jks which we use as the key store of the client, can downloaded with the source code of this tutorial. You can use the keytool which is shipped with Java if you want inspect the keystore and see what keys it contains.
$ keytool -v -list -keystore client.jks -storepass clientPW
Keystore type: jks
Keystore provider: SUN
Your keystore contains 2 entries
Alias name: service
Creation date: Mar 21, 2008
Entry type: trustedCertEntry
Owner: CN=service, OU=Secuirty Team, O=WSO2, L=colombo, ST=Western, C=LK, EMAILADDRESS=service@wso2.com
Issuer: CN=service, OU=Secuirty Team, O=WSO2, L=colombo, ST=Western, C=LK, EMAILADDRESS=service@wso2.com
Serial number: 47e3b6c0
Valid from: Fri Mar 21 18:53:12 LKT 2008 until: Tue Mar 15 18:53:12 LKT 2033
Certificate fingerprints:
MD5: C4:B9:2D:70:22:E9:08:6B:07:3B:2C:1E:5B:87:ED:09
SHA1: 4F:C9:0C:42:01:B7:BE:AC:0D:4F:AC:00:A2:E7:CC:CA:07:40:8E:BB
*******************************************
*******************************************
Alias name: client
Creation date: Mar 21, 2008
Entry type: keyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=client, OU=Secuirty Team, O=WSO2, L=colombo, ST=Western, C=LK, EMAILADDRESS=client@wso2.com
Issuer: CN=client, OU=Secuirty Team, O=WSO2, L=colombo, ST=Western, C=LK, EMAILADDRESS=client@wso2.com
Serial number: 47e3b631
Valid from: Fri Mar 21 18:50:49 LKT 2008 until: Tue Mar 15 18:50:49 LKT 2033
Certificate fingerprints:
MD5: DE:66:EB:95:18:2E:44:97:05:CE:DF:FC:83:E9:53:C3
SHA1: CE:E5:F0:BB:2F:46:A9:F0:45:60:4C:16:1B:33:FC:B5:09:0B:8C:13
*******************************************
*******************************************
As you can see, this key store contains the client's public-private key pair as a keyEntry and the service's public key as trusted certificate. Client's private key will be used to sign messages sent to the client and service's public key will be used to verify the validity of the signature in messages coming from the service.
This is similar to the password callback class we wrote for the service. Purpose of this password callback class is to provide the password for the client’s private key.
package tutorial.rampart.client;
import org.apache.ws.security.WSPasswordCallback;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import java.io.IOException;
public class PWCBHandler implements CallbackHandler {
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
// To use the private key to sign messages, we need to provide
// the private key password
WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
if(pwcb.getIdentifer().equals("client") ) {
pwcb.setPassword("clientPW");
return;
}
}
}
}
To secure SOAP requests made by the client, we need to engage the Rampart module to the client. For this, we need to create a client repository and rampart.mar should be deployed in the modules directory. We need to ensure that all dependency jar files of the Apache Rampart module is in the classpath of the client. Then the following code can be used to engage Rampart to the client:
// Rampart module should be in the repository
ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("path/to/client/repo", null);
SecureServiceStub stub = new SecureServiceStub(ctx,"https://localhost:8080/axis2/services/SecureService");
ServiceClient sc = stub._getServiceClient();
sc.engageModule("rampart");
Axis2 code generator makes use of security policies specified in the WSDL, when generating a stub for a Web service. We need to provide some Rampart specific configuration information such as which key to be used for the signature and which key store to be used. In this tutorial, we provide these information using a programmatically created RampartConfig assertion.
RampartConfig rampartConfig = new RampartConfig();
rampartConfig.setUser("client");
rampartConfig.setPwCbClass("tutorial.rampart.client.PWCBHandler");
CryptoConfig sigCrypto = new CryptoConfig();
sigCrypto.setProvider("org.apache.ws.security.components.crypto.Merlin");
Properties props = new Properties();
props.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "JKS");
props.setProperty("org.apache.ws.security.crypto.merlin.file","keys/client.jks");
props.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "clientPW");
sigCrypto.setProp(props);
rampartConfig.setSigCryptoConfig(sigCrypto);
Policy policy = new Policy();
policy.addAssertion(rampartConfig);
And we can add this policy to the service client using the following code.
Policy rampartConfig = getRampartConfig(); sc.getAxisService().getPolicyInclude().addPolicyElement(PolicyInclude.AXIS_SERVICE_POLICY, rampartConfig);
Now, everything is set and you can run the client and consume the Web service.
<soapenv:Envelope>
<soapenv:Body>
<ns1:add xmlns:ns1="http://service.rampart.tutorial">
<ns1:a>4</ns1:a>
<ns1:b>6</ns1:b>
</ns1:add>
</soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="true">
<wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-13121387">
<wsu:Created>2008-03-27T15:29:37.454Z</wsu:Created>
<wsu:Expires>2008-03-27T15:34:37.454Z</wsu:Expires>
</wsu:Timestamp>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="Signature-29744585">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<ds:Reference URI="#Id-14293164">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<ds:DigestValue>KELVaFQ7RnfPIUMAU9q4D/5rGOU=</ds:DigestValue>
</ds:Reference>
<ds:Reference URI="#Timestamp-13121387">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<ds:DigestValue>7t9QUVXRJ0yTS+84OSfsH7pAguM=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue> ...ZL1FMFxsUvwBU2ZYYbNxGu/uJceG1i4uSPd6+BSiqYWal ...</ds:SignatureValue>
<ds:KeyInfo Id="KeyId-24374386">
<wsse:SecurityTokenReference xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="STRId-8406772">
<wsse:KeyIdentifier EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier">
ins6410Q1skpvizn19AUk7dC6rI=
</wsse:KeyIdentifier>
</wsse:SecurityTokenReference>
</ds:KeyInfo>
</ds:Signature>
</wsse:Security>
</soapenv:Header>
<soapenv:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Id-14293164">
<ns1:add xmlns:ns1="http://service.rampart.tutorial">
<ns1:a>3</ns1:a>
<ns1:b>4</ns1:b>
</ns1:add>
</soapenv:Body>
</soapenv:Envelope>
In this tutorial, we looked at deploying Apache Rampart module and applying message-level security to a Web service. We also looked at consuming a secure Web service. Even though in this example, we only looked at a simple sign only scenario, we can sign and encrypt SOAP headers and also other parts of a message, just by changing the security policy by adding necessary protection assertions.
1. Web Services Security with Apache Rampart – Part 1 (Transport Level Security)
2. Setting Up Keystores for a Client and a Service
3. Understanding the WS Security Policy Language
Download source code for this tutorial
Nandana Mihindukulasooriya, Software Engineer, WSO2 Inc. nandana AT wso2 DOT com
multiple client authentication and services authorisation
http://www.atcoachoutletsonli
web development
I am getting followning errors
Can you help, please !!!
Encrypt org.apache.ws.security.crypto.merlin.keystore.password
One way signature checking possible in rampart
WS security
Getting error in executing this sample
Error invoking axis2 web service with WSSecurity
Hello.
I have followed this example and it works fine. However, i need to create a web service in axis2 using SymmetricBinding, Sign and Encryption using keys and keystores. This web service should be consumed from a .Net Client. When run the client i get this error:
ERROR An error was discovered processing the header (WSSecurityEngine: DataReference - referenced data not found) org.apache.axis2.AxisFault: An error was discovered processing the header (WSSecurityEngine: DataReference - referenced data not found) at org.apache.rampart.handler.RampartReceiver.setFaultCodeAndThrowAxisFault(RampartReceiver.java:166) at org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:95)
My services.xml is:
<?xml version="1.0"?>
<!-- This file was auto-generated from WSDL -->
<!-- by the Apache Axis2 version: 1.4.1 Built on : Aug 13, 2008 (05:03:35 LKT) -->
<serviceGroup>
<service name="PDIDas">
<module ref="rahas" />
<module ref="rampart" />
<messageReceivers>
<messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="co.gov.gobiernoenlinea.www.wsentidad.PDIDasMessageReceiverInOut"/>
</messageReceivers>
<parameter name="ServiceClass">co.gov.gobiernoenlinea.www.wsentidad.PDIDasSkeleton</parameter>
<parameter name="useOriginalwsdl">false</parameter>
<parameter name="modifyUserWSDLPortAddress">true</parameter>
<parameter name="enableMTOM" locked="false">true</parameter>
<operation name="VerificarFuncionamiento" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://www.gobiernoenlinea.gov.co/wsentidad">
<actionMapping>http://www.gobiernoenlinea.gov.co/wsentidad:verificarFuncionamientoIn</actionMapping>
<outputActionMapping>http://www.gobiernoenlinea.gov.co/wsentidad/WsEntidad/VerificarFuncionamientoResponse</outputActionMapping>
</operation>
<operation name="Tarifar" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://www.gobiernoenlinea.gov.co/wsentidad">
<actionMapping>http://www.gobiernoenlinea.gov.co/wsentidad:tarifarIn</actionMapping>
<outputActionMapping>http://www.gobiernoenlinea.gov.co/wsentidad/WsEntidad/TarifarResponse</outputActionMapping>
</operation>
<operation name="ConsultarResultado" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://www.gobiernoenlinea.gov.co/wsentidad">
<actionMapping>http://www.gobiernoenlinea.gov.co/wsentidad:consultarResultadoIn</actionMapping>
<outputActionMapping>http://www.gobiernoenlinea.gov.co/wsentidad/WsEntidad/ConsultarResultadoResponse</outputActionMapping>
</operation>
<operation name="Ejecutar" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://www.gobiernoenlinea.gov.co/wsentidad">
<actionMapping>http://www.gobiernoenlinea.gov.co/wsentidad:ejecutarIn</actionMapping>
<outputActionMapping>http://www.gobiernoenlinea.gov.co/wsentidad/WsEntidad/EjecutarResponse</outputActionMapping>
</operation>
<operation name="Consultar" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://www.gobiernoenlinea.gov.co/wsentidad">
<actionMapping>http://www.gobiernoenlinea.gov.co/wsentidad:consultarIn</actionMapping>
<outputActionMapping>http://www.gobiernoenlinea.gov.co/wsentidad/WsEntidad/ConsultarResponse</outputActionMapping>
</operation>
<wsp:Policy
wsu:Id="WsEntidadPolicy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:ProtectionToken>
<wsp:Policy>
<sp:SecureConversationToken
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:BootstrapPolicy>
<wsp:Policy>
<sp:SymmetricBinding>
<wsp:Policy>
<sp:ProtectionToken>
<wsp:Policy>
<sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
<wsp:Policy>
<sp:WssX509V3Token10 />
</wsp:Policy>
</sp:X509Token>
</wsp:Policy>
</sp:ProtectionToken>
<sp:Layout>
<wsp:Policy>
<sp:Lax />
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
<sp:OnlySignEntireHeadersAndBody />
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic256 />
</wsp:Policy>
</sp:AlgorithmSuite>
</wsp:Policy>
</sp:SymmetricBinding>
<sp:EndorsingSupportingTokens>
<wsp:Policy>
<sp:X509Token
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssX509V3Token10 />
</wsp:Policy>
</sp:X509Token>
</wsp:Policy>
</sp:EndorsingSupportingTokens>
<sp:Wss11>
<wsp:Policy>
<sp:MustSupportRefKeyIdentifier />
<sp:MustSupportRefIssuerSerial />
<sp:MustSupportRefThumbprint />
<sp:MustSupportRefEncryptedKey />
<sp:RequireSignatureConfirmation />
</wsp:Policy>
</sp:Wss11>
<sp:EncryptedParts>
<sp:Body/>
</sp:EncryptedParts>
<sp:SignedParts>
<sp:Body/>
<sp:Header Name="Action" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/>
<sp:Header Name="RelatesTo" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/>
<sp:Header Name="To" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/>
</sp:SignedParts>
</wsp:Policy>
</sp:BootstrapPolicy>
</wsp:Policy>
</sp:SecureConversationToken>
</wsp:Policy>
</sp:ProtectionToken>
<sp:Layout>
<wsp:Policy>
<sp:Strict />
</wsp:Policy>
</sp:Layout>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic256 />
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:IncludeTimestamp />
<sp:OnlySignEntireHeadersAndBody />
</wsp:Policy>
</sp:SymmetricBinding>
<sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:MustSupportRefKeyIdentifier />
<sp:MustSupportRefIssuerSerial />
<sp:MustSupportRefThumbprint />
<sp:MustSupportRefEncryptedKey />
</wsp:Policy>
</sp:Wss11>
<sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:RequireClientEntropy />
<sp:RequireServerEntropy />
<sp:MustSupportIssuedTokens />
</wsp:Policy>
</sp:Trust10>
<ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
<ramp:user>pdi</ramp:user>
<ramp:encryptionUser>www.tramitador.gov.co</ramp:encryptionUser>
<ramp:passwordCallbackClass>co.gov.gobiernoenlinea.www.wsentidad.PWCBHandler</ramp:passwordCallbackClass>
<ramp:encryptionCrypto>
<ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
<ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
<ramp:property name="org.apache.ws.security.crypto.merlin.file">keystore.jks</ramp:property>
<ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">adminjboss</ramp:property>
</ramp:crypto>
</ramp:encryptionCrypto>
<ramp:signatureCrypto>
<ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
<ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
<ramp:property name="org.apache.ws.security.crypto.merlin.file">keystore.jks</ramp:property>
<ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">adminjboss</ramp:property>
</ramp:crypto>
</ramp:signatureCrypto>
</ramp:RampartConfig>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
</service>
</serviceGroup>
I think that keystores and keys are fine, and passwordCallBackClass too.
The SOAP message is:
<soap:Envelope xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<wsa:Action wsu:Id="Id-d948f029-35b3-49d3-bc57-7855f36b9711">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT</wsa:Action>
<wsa:MessageID wsu:Id="Id-a29bf130-bf13-40d5-b3eb-ccbdbea0e989">urn:uuid:67edb487-6608-4663-9ec8-b09a8c2953ad</wsa:MessageID>
<wsa:ReplyTo wsu:Id="Id-9d70df75-17c9-4d3c-8a52-3ad190abb682">
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
</wsa:ReplyTo>
<wsa:To wsu:Id="Id-000ae597-6af4-427f-947e-63f76660f9d2">http://192.168.0.177/axis2/services/PDIDas</wsa:To>
<wsse:Security soap:mustUnderstand="1">
<wsu:Timestamp wsu:Id="Timestamp-fbce16b7-da8c-423f-a4a2-83053d581427">
<wsu:Created>2010-01-07T16:34:31Z</wsu:Created>
<wsu:Expires>2010-01-07T16:39:31Z</wsu:Expires>
</wsu:Timestamp>
<wsse:BinarySecurityToken ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="SecurityToken-87419da6-e037-49ef-b32c-39b245ca102f">
<xop:Include href="cid:1.633984608716794146@example.org" />
</wsse:BinarySecurityToken>
<xenc:EncryptedKey Id="SecurityToken-1007a64b-ac44-4a1d-b51f-070f3389e757" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p">
<ds:DigestMethod xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
</xenc:EncryptionMethod>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<wsse:SecurityTokenReference>
<wsse:KeyIdentifier ValueType="http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#ThumbprintSHA1" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">Ry+t5evVGgJXSnljahbUQKZkJv0=</wsse:KeyIdentifier>
</wsse:SecurityTokenReference>
</KeyInfo>
<xenc:CipherData>
<xenc:CipherValue>eW9Sd28ycGqx3koG2wE02yHRUAyT3tuNSYdltRUBcNPD2OXuY1ZrqLnlEbv4lHLObgYvtPvdpMMxI4ReyqCKRzGfoIcxkrx9zlneegl18wQSv/AEbxLqFNiMPNix30ujKu/geDv6WB4N6MtzDckeTpPCl5OhjNXHx7+w7PQ1Tbs=</xenc:CipherValue>
</xenc:CipherData>
<xenc:ReferenceList>
<xenc:DataReference URI="#Enc-0dba6476-4323-4285-ac02-12a30aa03ce3" />
</xenc:ReferenceList>
</xenc:EncryptedKey>
<Signature Id="Sig-371103f2-7cad-4c76-88e9-eb128279c9f3" xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" />
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#hmac-sha1" />
<Reference URI="#Id-d948f029-35b3-49d3-bc57-7855f36b9711">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>mQTnEkBe+KEz4CheppKKx2tn7OQ=</DigestValue>
</Reference>
<Reference URI="#Id-a29bf130-bf13-40d5-b3eb-ccbdbea0e989">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>9q6HeJJDPkyzb99tWJsbjbqc8IQ=</DigestValue>
</Reference>
<Reference URI="#Id-9d70df75-17c9-4d3c-8a52-3ad190abb682">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>HDEt95B0e6NLC0yb5VggvRHuIis=</DigestValue>
</Reference>
<Reference URI="#Id-000ae597-6af4-427f-947e-63f76660f9d2">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>VYVCsBhiEQg+CJ9Ftdz/tle21Tw=</DigestValue>
</Reference>
<Reference URI="#Timestamp-fbce16b7-da8c-423f-a4a2-83053d581427">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>mA+EEi1vxrvlQujV/duOX9/smo0=</DigestValue>
</Reference>
<Reference URI="#Id-ea090ef4-0050-42f5-949f-e70ff2a8e017">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>XyNjh/NfBQtfvuQE3AmEaV6T5GU=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>V5PgwMaKwsosA72JyZOQwK+Wr98=</SignatureValue>
<KeyInfo>
<wsse:SecurityTokenReference>
<wsse:Reference URI="#SecurityToken-1007a64b-ac44-4a1d-b51f-070f3389e757" ValueType="http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKey" />
</wsse:SecurityTokenReference>
</KeyInfo>
</Signature>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" />
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<Reference URI="#Sig-371103f2-7cad-4c76-88e9-eb128279c9f3">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>V9e3jC6dYIWbZQMltjhfNZic5TA=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>Lqagdidn8+ZjcqvcLIWY9q7UyOEtWytfquMvkmOo7FgjG/h/ZcyjeOc/1yaKeM4TJ9nO633vweLv92z9VVd0NSkEhomj7LC6dihRobL+cK3Dg79p7ZTVMdyOrio9pTINfphFs9i2IMcipKt2hLkUs2dS9dvgkxTJsB6TXIVp7oc=</SignatureValue>
<KeyInfo>
<wsse:SecurityTokenReference>
<wsse:Reference URI="#SecurityToken-87419da6-e037-49ef-b32c-39b245ca102f" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" />
</wsse:SecurityTokenReference>
</KeyInfo>
</Signature>
</wsse:Security>
</soap:Header>
<soap:Body wsu:Id="Id-ea090ef4-0050-42f5-949f-e70ff2a8e017">
<xenc:EncryptedData Id="Enc-0dba6476-4323-4285-ac02-12a30aa03ce3" Type="http://www.w3.org/2001/04/xmlenc#Content" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc" />
<xenc:CipherData>
<xenc:CipherValue>K87I9W++OBBqgzCLi2gxXdbn6kQMjL2TcP4K5IA8BVKVTRSC5kL2XBVCSr9CR2ShgLFYMmhNQ/7vF3FkV59KkzKa+MJmOk9cHxlcgtOHwudB7ZexNbkqCHmwJkzxysV9ADMjcBEPrKMHSbb/J3EimXkX9paRFteC5Mm65DktgdxBZxC7Gi8rAbw998MhNA3jESnNhNJCR8yxduGaykkP1iaa8IZo+fb4P+LpGQIpn9kUEyM4faA8pfTaxbvDNDx/jRQL55IZOZb7279PZbiYGGKix0BYZLbX/nH2PehEDjltf4WLzRFfr8K204ja9bTy6+yFNP2gLt2Cs40armXVa15o2CCAYOV6L+9R/+c2r2faJd6ltU+GmJcRAYhMONtig2zGuhULK1DW3D3Hmd16UxY1pOU3NDCtX6hfo6JC0AECzMo8E85aN/KPMJ3DQ5/9oxZfyr1pqhzWT7g32X4SPbBnLapGN7H7brgp6R446cLi1mYn90jUf/BMHwqUlsLr+o0u68mS4dj7OVTWyRc910XAJ+fzxc6pZOsB+rNHoTZowACvaZWlX1LRPm3BikLLDKvmshrtJSwsn2KoJgYvJFypj4FuwoKymBxTtZ65KSufRl4HcCcW+Km/0LnalXwamwl+Q3KpfTfnSFcL6Q4SbWCXhQf02ELjX4QMbkrXSx6VoKrA3c4loVAq0wOs8AEAHWLlbHoPDjafEAp7ZkXoctLW+YhHFYt/YDSIQErgLZ+5VbJADaTod+66v1Ec9PdpzcZo0qYp0IlWGNzS8pW03mexNCHDeZygH3Rv9BdkTyM=</xenc:CipherValue>
</xenc:CipherData>
</xenc:EncryptedData>
</soap:Body>
</soap:Envelope>
I don't know what is the problem. The client in .Net cannot be modified, it work fine, and i have applied thousand changes in service without get results.
Thanks for your help.
Error when datatype in service operation changes
Problems with rampart and axis2 with specific wsdl
Signature with Data encryption
Response not signed
Response not signed
Another error
[ERROR] SOAP header missing
Did you overcome this issue
How does rampart recognize what usage to set?
Exception in thread "main" java.lang.NoClassDefFoundError: org/a
missing xalan jar
Missing the namespace inside BinarySecurityToken tag
client policy file
Hi Pete,
problems with axis 1.4.1 and rampart 1.4
WSS10 / WSS11 Assertion
assertion does not seem to help
Jira incident
changes for 1.4?
Re: changes for 1.4?
org.apache.axis2.AxisFault: Remote host closed connection during
org.apache.axis2.AxisFault: Remote host closed connection during