Wednesday, September 2, 2015
localhost/127.0.0.1:7000 is in use by another process. Change listen_address:storage_port in cassandra.yaml to values that do not conflict with other services
If you ever get this error in your wso2 server, please check if there is any other wso2 server running on the same machine and check it's port offset in carbon.xml and change the other server's port offset accordingly.
Monday, January 12, 2015
Sending attachements with with WSO2 ESB via MTOM
Prerequisites:
WSO2 ESB 4.8.1
WSO2 ESB 4.8.1 service pack1 (This is yet to release)
SoapUI 4.5.1
Environment:
Ubuntu
Java Runtime
Steps:
Enable backend service
1. Apply the sp1 to ESB 4.8.1
2. Go to/samples/axis2Server/src/MTOMSwASampleService and run 'ant'. Once it is build successfully, go to /samples/axis2Server and start the server as follows:
/axis2server.sh
3.Now you will be able to access the wsdl file of MTOMSwASampleService via below url:
http://localhost:9000/services/MTOMSwASampleService?wsdl
Configure ESB
3.1 Save the wsdl file as MTOMSwASampleService.wsdl and copy it to/repository/samples/resources/proxy directory.
4. Start ESB and login via console.
5. Create three dynamic sequences and save them in config regitry as follows:
Go to Manage->Service Bus->Sequences and click on Add Sequence.
Click on Add Child->Core->Send and add a Send mediator.
Select Endpoint Type: Define Inline and click on Add button.
Create Address Endpoint.
Address: http://localhost:9000/services/MTOMSwASampleService
Show Advanced Options->Message Content
Optimize: MTOM
Hit 'Save & Close'.
Hit 'Update'.
Hit 'Save in Registry'.
Hit 'Save & Close'.
Click on Add Child->Core->Send and add a Send mediator.
Hit 'Update'.
Hit 'Save in Registry'.
Hit 'Save & Close'.
Hit 'Save in Registry'.
Hit 'Save & Close'.
6. Go to Manage->Service Bus->Source View and paste the config
P.S: Ignore the names as they are dump values
Hit Update.
Setup SoapUI
7. Start SoapUI.
Click on 'New SoapUI project' and paste below wsdl url.
http://localhost:8280/services/StockQuoteProxy?wsdl
8. Click on 'uploadFileUsingMTOM' request in soap11 binding.
10. Edit current url as follows:
http://localhost:8280/services/StockQuoteProxy.StockQuoteProxyHttpSoap12Endpoint
9. Attach a image via attachment window. Click yes for 'cache attachment in request'.
10. Modify the request as depicted in the image below and change the value of image name according to your image name:
11. Now you can send the request. You will receive the attachment as the response as follows:
References:
https://axis.apache.org/axis2/java/core/docs/mtom-guide.html
https://docs.wso2.com/pages/viewpage.action?pageId=33136025
WSO2 ESB 4.8.1
WSO2 ESB 4.8.1 service pack1 (This is yet to release)
SoapUI 4.5.1
Environment:
Ubuntu
Java Runtime
Steps:
Enable backend service
1. Apply the sp1 to ESB 4.8.1
2. Go to
/axis2server.sh
3.Now you will be able to access the wsdl file of MTOMSwASampleService via below url:
http://localhost:9000/services/MTOMSwASampleService?wsdl
Configure ESB
3.1 Save the wsdl file as MTOMSwASampleService.wsdl and copy it to
4. Start ESB and login via console.
5. Create three dynamic sequences and save them in config regitry as follows:
Go to Manage->Service Bus->Sequences and click on Add Sequence.
- InSeq
Click on Add Child->Core->Send and add a Send mediator.
Select Endpoint Type: Define Inline and click on Add button.
Create Address Endpoint.
Address: http://localhost:9000/services/MTOMSwASampleService
Show Advanced Options->Message Content
Optimize: MTOM
Hit 'Save & Close'.
Hit 'Update'.
Hit 'Save in Registry'.
Hit 'Save & Close'.
- OutSeq
Click on Add Child->Core->Send and add a Send mediator.
Hit 'Update'.
Hit 'Save in Registry'.
Hit 'Save & Close'.
- ErrorSeq
Hit 'Save in Registry'.
Hit 'Save & Close'.
6. Go to Manage->Service Bus->Source View and paste the config
P.S: Ignore the names as they are dump values
Hit Update.
Setup SoapUI
7. Start SoapUI.
Click on 'New SoapUI project' and paste below wsdl url.
http://localhost:8280/services/StockQuoteProxy?wsdl
8. Click on 'uploadFileUsingMTOM' request in soap11 binding.
10. Edit current url as follows:
http://localhost:8280/services/StockQuoteProxy.StockQuoteProxyHttpSoap12Endpoint
9. Attach a image via attachment window. Click yes for 'cache attachment in request'.
10. Modify the request as depicted in the image below and change the value of image name according to your image name:
11. Now you can send the request. You will receive the attachment as the response as follows:
References:
https://axis.apache.org/axis2/java/core/docs/mtom-guide.html
https://docs.wso2.com/pages/viewpage.action?pageId=33136025
Wednesday, January 7, 2015
WSO2 Identity Server as a Federation Hub
Requirement:
Setup identity federation with two WSO2 IS instance with SAML2 Web SSO, one acts as a Federation hub (primary idp) and the other acts as the IDP (secondary idp).
These are fronted by nginx to hide the original characteristics and the existence of the Identity Servers.
Prerequisits:
1. WSO2 IS 5.0.0 - two servers
2. Web Server to host Service Provide(s). e.g: Tomcat 7.0.x
Note: In this sample SAML request signing will be done only between primary idp and secondary idp as we already have self signed certificate, public/private key pairs available in WSO2 IS by default (Location:<carbon_home>/repository/resources).
If you want to create your own self signed certificate, refer this blog post.
Steps:
1. Configure nginx and modify /etc/nginx/sites-enabled/default file. You can refer the this blog post.
I have provided the configured file.
2. Use the following link to checkout and configure Service provider (travelocity application)
https://docs.wso2.com/display/IS460/Configuring+SAML2+SSO
(Refere the 'Configuring the web app' section only)
I have provided the configured travelocity.properties file.
3. Change the following configs in Primary IDP.
<carbon_home>/repository/conf/tomcat/catalina-server.xml add proxy port pointing load balancers port(i.e 443).
<carbon_home>/repository/conf/carbon.xml change the hostname to identity-dev1.is.com
4.Login to the Primary IDP console.
5. Register a identity provider
5.1 Expand Federated Authenticators and configure SAML2 Web SSO Configuration.
6. Register a service provider
6.2 Expand Local & Outbound Authentication Configuration and choose Authentication Type as Federated Authentication and select the identity provider created in step 5
Save the configurations.
7. Change the following configs in Secondary IDP.
<carbon_home>/repository/conf/tomcat/catalina-server.xml add proxy port pointing load balancers port(i.e 443).
<carbon_home>/repository/conf/carbon.xml change the hostname to identity-dev2.is.com and offset to 1
8. Login to Secondary IDP console
9. Register a service provider
Now all the configurations are done.
10. You can access travelocity application with below url:
htttp://localhost:8080/travelocity.com
Note: If you are using firefox install SSO tracer plugin to view decrypted SAML requests easily.
Setup identity federation with two WSO2 IS instance with SAML2 Web SSO, one acts as a Federation hub (primary idp) and the other acts as the IDP (secondary idp).
These are fronted by nginx to hide the original characteristics and the existence of the Identity Servers.
Prerequisits:
1. WSO2 IS 5.0.0 - two servers
2. Web Server to host Service Provide(s). e.g: Tomcat 7.0.x
Note: In this sample SAML request signing will be done only between primary idp and secondary idp as we already have self signed certificate, public/private key pairs available in WSO2 IS by default (Location:<carbon_home>
If you want to create your own self signed certificate, refer this blog post.
Steps:
1. Configure nginx and modify /etc/nginx/sites-enabled/default file. You can refer the this blog post.
I have provided the configured file.
2. Use the following link to checkout and configure Service provider (travelocity application)
https://docs.wso2.com/display/IS460/Configuring+SAML2+SSO
(Refere the 'Configuring the web app' section only)
I have provided the configured travelocity.properties file.
3. Change the following configs in Primary IDP.
<carbon_home>
4.Login to the Primary IDP console.
5. Register a identity provider
- Identity Provider Name: Any meaningful name
- Identity Provider Public Certificate: Export the public certificate in pem format and upload it.
- Alias will be auto generated as follows:
5.1 Expand Federated Authenticators and configure SAML2 Web SSO Configuration.
- Tick Enable SAML2 Web SSO
- Identity Provider Entity Id: Any meaningful name
- Service Provider Entity Id: Any meaningful name (This value is required when registering service provider in Secondary IDP)
- Set the SSO URL to https://identity-dev2.is.com/samlsso/
- Tick Enable Authentication Request Signing
- Tick Enable Logout
- Tick Enable Logout Request Signing
- SAML2 Web SSO User ID Location: Tick User ID found in 'Name Identifier'
6. Register a service provider
- Service Provider Name: Any meaningful name
- Issuer: travelocity.com (same value provided in travelocity.properties file for SAML.IssuerID)
- Assertion Consumer URL: http://localhost:8080/travelocity.com/samlsso-home.jsp (same value provided in travelocity.properties file for SAML.ConsumerUrl)
- Tick Use fully qualified username in the NameID
- Tick Enable Single Logout
- Tick Enable Attribute Profile
6.2 Expand Local & Outbound Authentication Configuration and choose Authentication Type as Federated Authentication and select the identity provider created in step 5
Save the configurations.
7. Change the following configs in Secondary IDP.
<carbon_home>
8. Login to Secondary IDP console
9. Register a service provider
- Service Provider Name: Any meaningful name
- Issuer: same value provided in 5.1 for Service Provider Entity Id
- Assertion Consumer URL: Any garbage value as signing SAML with CA certificate will skip this acs URL validation
- Tick Use fully qualified username in the NameID
- Tick Enable Signature Validation in Authentication Requests and Logout Requests
- Tick Enable Single Logout
- Tick Enable Attribute Profile
Now all the configurations are done.
10. You can access travelocity application with below url:
htttp://localhost:8080/travelocity.com
Note: If you are using firefox install SSO tracer plugin to view decrypted SAML requests easily.
Friday, December 26, 2014
Write a Simple BPEL Project with WSO2 Developer Studio and Deploy it in WSO2 BPS
Prerequisites:
- A simple up and running Webservice (Refer this post to if you want to learn how to write a simple Axis2 Webservice with Eclipse)
- WSO2 BPS
- WSO2 developer studio plug-in installed Eclipse
- Apache Tomcat 7.0.47
- Apache ODE war distribution
- JDK 1.7/1.6
Create New Server Runtime Environment for Apache ODE
1. Copy the ode.war to apache-tomcat-7.0.47/webapps directory and start the server. when you see the ode directory created under apache-tomcat-7.0.47/webapps directory, stop the server.
2. Configure the server runtime as follows:
Create BPEL Project
1. Create a new BPEL project as follows:
2. In the next dialog, provide a project name and select the target runtime as Apache ODE. Click Finish.
3. Write click on the project and create a "New BPEL process file" (Same as step 1). Fill the dialog accordingly and make sure you select the Template to 'Synchronous BPEL Process' and click finish.
4. Copy the Hello.wsdl file inside bpelContent folder in Eclipse project.
Sample Hello.wsdl is attached.
5. Open the .bpel file design view. You should be able to see the Palette in the workspace with all the gadgets required to create the BPEL workflow.
6. Drag and drop two Assign actions and an Invoke action as follows:
7. Click on Invoke and rename it to 'invokeHelloService'
8. In the Properties Dialog, click on 'Details' tab.
9. Select 'Create Global Partner link' from Partner Link drop down. A popup will Open.
Provide a 'Partner Link Name' (any meaningful name is sufficient) and click Ok. Choose 'HelloPortType' as depicted below and click Ok.
Provide a 'Partner Link Type Name' (any meaningful name is sufficient) and click Next. Give a 'Role Name' and click Finish.
10. Under the Properties dialog there is a 'Quick Pick section'.
Select 'greetingInSinhala' from that and double click on it.
You will noticed that the Input/Output variables are generated as follows. Save the changes made.
11. Now it is time to pass the input parameters to the Hello service. In order to do that we have to click on 'Assign' action. In Properties dialog click on 'Details' tab.
12. Click on New and do as depicted below and hit Save. You will be prompted for Initializer dialog. Click yes.
Here you will assign the input for the Hello Webservice from BPEL input payload.
13. Likewise in 'Assign1' action do the same as follows and hit Save.You will be prompted for Initializer dialog. Click yes.
Here you will assign the output received from Hello Webservice to BPEL output payload.
14. Write click on the project and create new 'Apache ODE Deployment Descriptor'. Do the configuration as follows:
15. Create a ZIP archive as follows:
Now the BPEL is ready.
Deply BPEL Project in WSO2 BPS
1. Start the WSO2 BPS and access the carbon console (https://1localhost:9443/carbon/). Login as admin user with admin/admin credentials.
2. Under 'Manage' section click on 'Processes' -> 'Add'. Upload the Zip.
3. Now you can see the uploaded BPEL under 'Processes' -> 'List'.
4. Click on the 'Process ID'. You will see a dialog simillar to below:
5. Use try it and you will get a response as follows:
That is it. Happy Orchestration with BPEL :)
How to convert a simple Java class to a Webservice with Axis2 [Deploying POJOs]
It has never been this easy to convert your class into a Webservice in few steps with Apache Axis2.
Apache Axis2 is a SOAP processing engine and it is hand in hand with WSO2 SOA middleware platform.
Prerequsists:
JDK 1.7/1.6
How to create Axis2 service
1. Create a new Axis2 service project in Eclipse
2. Tick 'Create new Axis2 Service ' and click Next
3. Provide Project Name, package name and Class name and click Finish.
As you can see the project structure will contain the services.xml file which contains the details of the exposed service.
4. Now you can add methods to the Class as follows:
package com.world.hello;
public class Hello{
public String greetInSinhala(String name){
return "Ayubowan "+ name;
}
public String greetInEnglish(String name){
return "Hello "+ name;
}
} 4. Now you can add methods to the Class as follows:
5. Now create the service archive file (*.aar extension) by right click on the project and select 'Export Project as Deployable Archive'.
How to deploy *.aar file in Axis2 enabled Tomcat
1. Copy the axis2 war file to apache-tomcat-7.0.47/webapps directory and start the server.
You will see the axis2 directory under Tomcat webapps directory once the server is started.
2.Copy the HelloWorld.aar file to apache-tomcat-7.0.47/webapps/axis2/WEB-INF/services directory
3. Access below url and you should be able to see the deployed service and the available methods.
http://localhost:8080/axis2/services/listServices
That is the end of the story :)
Monday, December 22, 2014
SSO session timeouts when the applications are idle for 15 minutes [WSO2 IS 5.0.0]
In IS 5.0.0 there is a session cache which gets cleared every 15 minutes and it is not configurable at the moment.
But there is a workaround.
You have to enable remember me while sign-in to the system. Then even if the cache expires in 15 minutes, the session cookie will be retrieved from session data persistence. But this will keep your login active even if you close the browser and reopen it.
You can get rid of that by setting the "RememberMePeriod" under "SessionDataPersist" to -1 in identity.xml.
So every time you close the browser, you will have to login to the application again.
But there is a workaround.
You have to enable remember me while sign-in to the system. Then even if the cache expires in 15 minutes, the session cookie will be retrieved from session data persistence. But this will keep your login active even if you close the browser and reopen it.
You can get rid of that by setting the "RememberMePeriod" under "SessionDataPersist" to -1 in identity.xml.
So every time you close the browser, you will have to login to the application again.
Tuesday, December 2, 2014
Downgrade Subversion 1.8 to 1.7 in Ubuntu 14.04
I ran into the below problem when I try to update my existing codebase after upgrading the operating system from ubuntu 12.04 to 14.04.
The working copy at '/home/punnadi/wso2/source/platform/turing'
is too old (format 29) to work with client version '1.8.8 (r1568071)' (expects format 31). You need to upgrade the working copy first.
The reason behind this error os Ubuntu 14.04 comes with subversion 1.8.x by default. So I had to downgrade the subversion version to 1.7.x in order to overcome this issue.
I did it with the help of following post (Check the Wauzl's answer).
http://askubuntu.com/questions/453717/i-need-downgrade-from-subversion-1-8-to-subversion-1-7
The working copy at '/home/punnadi/wso2/source/platform/turing'
is too old (format 29) to work with client version '1.8.8 (r1568071)' (expects format 31). You need to upgrade the working copy first.
The reason behind this error os Ubuntu 14.04 comes with subversion 1.8.x by default. So I had to downgrade the subversion version to 1.7.x in order to overcome this issue.
I did it with the help of following post (Check the Wauzl's answer).
http://askubuntu.com/questions/453717/i-need-downgrade-from-subversion-1-8-to-subversion-1-7
Subscribe to:
Posts (Atom)















