WSO2 Identity Server 5.0.0 with Postgres registry database - wso2

I tried WSO2 - Identity Server 5.0.0 using postgresql-9.1 as a registry database and had the following troubles :
First i got some troubles setting up the registry database :
in the file ${CARBON_HOME}/dbscripts/identity/postgresql.sql at line 199 i had to replace :
ID INTEGER INTEGER NEXTVAL('IDN_ASSOCIATED_ID_SEQ'),
by
ID INTEGER DEFAULT NEXTVAL('IDN_ASSOCIATED_ID_SEQ'),
in the file ${CARBON_HOME}/dbscripts/identity/application-mgt/postgresql.sql i had to replace every occurence of :
ID INTEGER NEXTVAL
by
ID INTEGER DEFAULT NEXTVAL
and at line 249 i had to replace :
PROPERTY_BLOB_VALUE BLOB,
by
PROPERTY_BLOB_VALUE BYTEA,
I could then create the registry database but i had some other troubles
The size of some column :
In my config the users are identified by their email (so the user identifier may be long) and this caused an exception when trying to add a Service provider. For example in the REG_LOG table i had to increase the size of the reg_user_id column. I'm not sure it was necessary but i also changed the size of some columns for tables REG_CLUSTER_LOCK, REG_RESOURCE, REG_RESOURCE_HISTORY, REG_COMMENT, REG_RATING and REG_TAG
When i tried to add a service provider i got the following exception :
Caused by: org.postgresql.util.PSQLException: ERREUR: column « ID » doesn't exists Position : 125
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:560)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:410)
at org.wso2.carbon.identity.application.mgt.dao.impl.ApplicationDAOImpl.createApplication(ApplicationDAOImpl.java:129)
... 50 more
It looks like postgresql is case sensitive. The column exists but in lower case...
When i tried to add a IdP provider i got the following exception :
Caused by: java.sql.SQLFeatureNotSupportedException: function org.postgresql.jdbc4.Jdbc4PreparedStatement.setBinaryStream(int, InputStream) not yet implemented.
at org.postgresql.Driver.notImplemented(Driver.java:727)
at org.postgresql.jdbc4.AbstractJdbc4Statement.setBinaryStream(AbstractJdbc4Statement.java:134)
at org.wso2.carbon.idp.mgt.dao.IdPManagementDAO.addIdP(IdPManagementDAO.java:1236)
... 122 more
i'm using postgresql-9.3-1102.jdbc41.jar driver.
It looks like this function is not supported yet. Could it be possible to use the setBinaryStream(int, InputStream, int) function instead (the last parameter is the length of the input stream in bytes)

This is a know issue in Identity Server 5.0.0. You can find a public jira for this from here. Could you please try to use the script files in the jira.

Related

How to specify the database in an ArangoDb AQL query?

If have multiple databases defined on a particular ArangoDB server, how do I specify the database I'd like an AQL query to run against?
Running the query through the REST endpoint that includes the db name (substituted into [DBNAME] below) ie:
/_db/[DBNAME]/_api/cursor
doesn't seem to work. The error message says 'unknown path /_db/[DBNAME]/_api/cursor'
Is this something I have to specify in the query itself?
Also: The query I'm trying to run is:
FOR col in COLLECTIONS() RETURN col.name
Fwiw, I haven't found a way to set the "current" database through the REST API. Also, I'm accessing the REST API from C++ using fuerte.
Tom Regner deserves primary credit here for prompting the enquiry that produced this answer. I am posting my findings here as an answer to help others who might run into this.
I don't know if this is a fuerte bug, shortcoming or just an api caveat that wasn't clear to me... BUT...
In order for the '/_db/[DBNAME/' prefix in an endpoint (eg full endpoint '/_db/[DBNAME/_api/cursor') to be registered and used in the header of a ::arangodb::fuerte::Request, it is NOT sufficient (as of arangodb 3.5.3 and the fuerte version available at the time of this answer) to simply call:
std::unique_ptr<fuerte::Request> request;
const char *endpoint = "/_db/[DBNAME/_api/cursor";
request = fuerte::createRequest(fuerte::RestVerb::Post,endpoint);
// and adding any arguments to the request using a VPackBuilder...
// in this case the query (omitted)
To have the database name included as part of such a request, you must additionally call the following:
request->header.parseArangoPath(endpoint);
Failure to do so seems to result in an error about an 'unknown path'.
Note 1: Simply setting the database member variable, ie
request->header.database = "[DBNAME]";
does not work.
Note 2: that operations without the leading '/_db/[DBNAME]/' prefix, seem to work fine using the 'current' database. (which at least for me, seems to be stuck at '_system' since as far as I can tell, there doesn't seem to be an endpoint to change this via the HTTP REST Api.)
The docs aren't very helpful right now, so just incase someone is looking for a more complete example, then please consider the following code.
EventLoopService eventLoopService;
// adjust the connection for your environment!
std::shared_ptr<Connection> conn = ConnectionBuilder().endpoint("http://localhost:8529")
.authenticationType(AuthenticationType::Basic)
.user(?) // enter a user with access
.password(?) // enter the password
.connect(eventLoopService);
// create the request
std::unique_ptr<Request> request = createRequest(RestVerb::Post, ContentType::VPack);
// enter the database name (ensure the user has access)
request->header.database = ?;
// API endpoint to submit AQL queries
request->header.path = "/_api/cursor";
// Create a payload to be submitted to the API endpoint
VPackBuilder builder;
builder.openObject();
// here is your query
builder.add("query", VPackValue("for col in collections() return col.name"));
builder.close();
// add the payload to the request
request->addVPack(builder.slice());
// send the request (blocking)
std::unique_ptr<Response> response = conn->sendRequest(std::move(request));
// check the response code - it should be 201
unsigned int statusCode = response->statusCode();
// slice has the response data
VPackSlice slice = response->slices().front();
std::cout << slice.get("result").toJson() << std::endl;

WSO2 Enterprise Integrator registry value returned in base64

My dev conf : Win2010, WSO2 EI 6.4.0, linux for data store.
I defined a registry entry, named "sourcefileURI" for storing source filepath. The media type I chose is "text/plain" and I store a path like : "/home/wso2/data/in"
When accessing this registry value from a inbound endpoint vfs config, I'm using the following code :
<parameter key="conf:/repository/transports/vfs/telco1/sourcefileURI" name="transport.vfs.FileURI"/>
This is working - almost - fine. I mean the value is returned but in base64.
I was expecting, since I chose media = "text/plain", to have the normal string returned.
The string is well returne - in plain text and not encoded - when I swap media to nothing/void. But this is not something I want to last in my project.
Can you please tell me what I'm doing wrong / don't understand here ?
Many thanks for your help.
1).Check the message builder and formatter you are using in conf/axis2.xml.Try to change the message builder and formatter for text/plain.
2) Otherwise simple solution is to use the xpath function base64Decode(string encodedValue).
3) Otherwise Use script mediator to decode the string or use class mediator.
4) Otherwise use the following link https://ajanthane.blogspot.com/2017/05/accessing-modifying-payload-in.html, in which explains how to create a custom synapse handlers.

Wso2 LDAP: error code 65 - no structural object class provided

So i am using Wso2 and when i try to create i get this error
[LDAP: error code 65 - no structural object class provided]
I also got some other mapping errors before that but after mapping correctly the Wso2 attributes to LDAP attributes they went away but now i am stuck on this error. From searching around i found that this error means that the operation that i am trying to do is violating the object class rules for the entry.
How can i get more about what the violation is about so that i can do something about it ?
You can try enabling debug logs for user.core component. In <product_home>/repository/conf/log4j.properties file, uncomment the following entry and restart the server. Then add a user again and check the wso2carbon.log file.
#log4j.logger.org.wso2.carbon.user.core=DEBUG

wso2am-2.0.1-SNAPSHOT modify subscription tier save error

I run wso2 apim 2.0.1 snapshot on windows, and when i modify subscription tier and save, it report below exception, and although the bill plan changed , but the API still display FREE label.
[2016-08-12 15:30:02,504] ERROR - EventProcessorAdminService Error while deleting the execution plan file
org.wso2.carbon.event.processor.core.exception.ExecutionPlanConfigurationException: Error while deleting the execution plan file
at org.wso2.carbon.event.processor.core.internal.util.EventProcessorConfigurationFilesystemInvoker.delete(EventProcessorConfigurationFilesystemInvoker.java:124)
......
Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 2: /D:/emman/PROJECT/AA/apimgmt/wso2am-2.0.1-SNAPSHOT/repository/deployment/server/\executionplans
at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at java.nio.file.Paths.get(Paths.java:84)
at org.wso2.carbon.event.processor.core.internal.util.EventProcessorUtil.validateFilePath(EventProcessorUtil.java:387)
at org.wso2.carbon.event.processor.core.internal.util.EventProcessorConfigurationFilesystemInvoker.delete(EventProcessorConfigurationFilesystemInvoker.j
ava:109)
... 65 more
[2016-08-12 15:30:02,539] ERROR - ThrottlePolicyDeploymentManager Error while deploying policy to global policy server.Error while deleting the execution plan file
[2016-08-12 15:30:02,541] INFO - subscription-policy-edit:jag SubscriptionPolicy [policyName=Gold, description=Allows 5000 requests per minute, defaultQuotaPolicy=QuotaPolicy [type=requestCount, limit=RequestCountLimit [requestCount=5000,
toString()=Limit [timeUnit=min, unitTime=1]]]rateLimitCount=-1, tenantId=-1234,ratelimitTimeUnit=NA]
As per your logs, error happens due to invalid file path below.
/D:/emman/PROJECT/AA/apimgmt/wso2am-2.0.1-SNAPSHOT/repository/deployment/server/\executionplans
I had a look at code. It reads the first part of this path from <RepositoryLocation> tag of carbon.xml file. By default, it should look like this.
<RepositoryLocation>${carbon.home}/repository/deployment/server</RepositoryLocation>
Please verify if you have the same in carbon.xml. If you are getting this error with the same config, please change it to the absolute path like below and try again.
D:\emman\PROJECT\AA\apimgmt\wso2am-2.0.1-SNAPSHOT\repository\deployment\server
To make your path more linux-like I used this trick.
Share your carbon home folder. Change carbon.xml setting RepositoryLocation in //machinenaam/share.

SOAP:1.027 SRT: Serialization / Deserialization failed in ABAP Proxy

I have to create a consumer proxy in SAP, the proxy generation is OK (or no errors were reported), but when i tried yo consume the proxy (SE80), i have the next error:
SOAP:1.027 SRT: Serialization / Deserialization failed
System expected a value for the type g.
If i continue, i have the response, but when i tried to call the customer service in a report, i have the error and i can't continue.
In a report, when i tried yo consume the proxy using this code, i have the same error, and i don't have response:
CREATE OBJECT proxy
EXPORTING
logical_port_name = 'LOGICAL_01'.
CALL METHOD proxy->proccess_check_status_invoice
EXPORTING
process_check_status_invoice = input
IMPORTING
process_check_status_invoice_r = output.
Whow can i solve this error?
Thanks,
Please use srt_util and verify the execution error with a trace of that proxy. The error log will specify which field and values are not allowed during the transformation.
SOAP:1.027 SRT: Serialization / Deserialization failed errors are due to incompatible data types, in my experience, most of the times are dates since ABAP datum and the standard differ and must be transformed.
Type g is usually the constant for the TYPEKIND of STRING. My guess is you are binding values that are CHARs instead of the STRING datatype.