Bpel 12c - Call webservices with basic authentication - soa

I'm using Oracle BPEL 12c to develop a process.
I need to call a external service with basic authentication. I need to pass the credentials received on my exposed service endpoint to the external service.
When i call, i receive this:
<remoteFault xmlns="http://schemas.oracle.com/bpel/extension">
-<part name="summary">
<summary>
oracle.fabric.common.FabricException: oracle.fabric.common.FabricException: Error in getting XML input stream:XXXXXX?WSDL: Server Authentication Required: Error in getting XML input stream: XXXX?WSDL: Server Authentication Required
</summary>
</part>
-<part name="detail">
<detail>Server Authentication Required</detail>
</part>
</remoteFault>
I tried to define on the composite, also the oracle.webservices.auth.password and oracle.webservices.auth.username password for the external service.
Also the javax.xml.ws.security.auth.username and javax.xml.ws.security.auth.password properties without sucess.
Any sugestion?
Kind regards,
Ricardo

I suppose your composite snippet should look like this:
<reference name="Service1" ui:wsdlLocation="test1.wsdl">
<interface.wsdl interface="http://tempuri.org/#wsdl.interface(IService1)"/>
<binding.ws port="http://tempuri.org/#wsdl.endpoint(Service1/BasicHttpBinding_IService1)" location="test1.wsdl" soapVersion="1.1">
<property name="weblogic.wsee.wsat.transaction.flowOption" type="xs:string" many="false">WSDLDriven</property>
<property name="oracle.webservices.auth.username" type="xs:string" many="false">test</property>
<property name="oracle.webservices.auth.password" type="xs:string" many="false">password</property>
<property name="oracle.webservices.preemptiveBasicAuth" type="xs:string" many="false">true</property>
</binding.ws>
</reference>
And also good practice to use variables when defining user and password instead of explicitly username and password
<property name="oracle.webservices.auth.username" type="xs:string" many="false">{$username}</property>
<property name="oracle.webservices.auth.password" type="xs:string" many="false">{$password}</property>
and then override them in generated cfg_plan.xml while deploying composite application
<reference name="Service1">
<!--Add search and replace rules for the binding properties-->
<binding type="ws">
<attribute name="port">
<replace>{your_port}</replace>
</attribute>
<attribute name="location">
<replace>{your_location}</replace>
</attribute>
<property name="weblogic.wsee.wsat.transaction.flowOption">
<replace>WSDLDriven</replace>
</property>
<property name="oracle.webservices.auth.username">
<replace>test</replace>
</property>
<property name="oracle.webservices.auth.password">
<replace>password</replace>
</property>
<property name="oracle.webservices.preemptiveBasicAuth">
<replace>true</replace>
</property>
</binding>
</reference>

Related

integration between bmc remedy and serviceNow using wso2

we would like to integrate incident module between BMC Remedy and ServiceNow ITSM applications using ESB-WSO2, need assistance on this to achieve this integration.
Use case: Service now has to create incident then WSO2 will consume the request and process then processed request will be send to Remedy. This is nothing but a e-bonding or you can call it as ticket replication.
Any help would be much appreciated
Here is a sample API for you. Supposing that you have already installed ServiceNow connector.
You can call it from Postman using GET or browser, http://{yourWso2EiServer}:8280/serviceNow/test
After testing you can change method to POST and try to send different messages using POSTMAN. Then you will have to evaluate properties from a message, using like"expression"="json-eval($.tablename)" instead of "value"= in you Property mediators and your message must be an application/json and contain this field, like
{"tablename":"incident"....
<api xmlns="http://ws.apache.org/ns/synapse" name="ServiceNowApi" context="/serviceNow" version-type="context">
<resource methods="GET" uri-template="/test" outSequence="" faultSequence="">
<inSequence>
<property name="tablename" value="incident" description="here you can set your request variables with constants for test or read it from request using json-evalng "/>
<property name="sysparmDisplayValue" value="true"/>
<property name="sysparmFields" value="short_description,number,sys_id"/>
<property name="sysparmView" value="short_description,number,sys_id"/>
<property name="number" value="12345678"/>
<property name="shortDescription" value="Testing integration using ServiceNow connector"/>
<property name="active" value="true"/>
<property name="approval" value="owner"/>
<property name="category" value="inquery"/>
<property name="contactType" value="phone"/>
<servicenow.init>
<serviceNowInstanceURL>dev85868.service-now.com</serviceNowInstanceURL>
<username>rest_test</username>
<password>12345678</password>
</servicenow.init>
<servicenow.postRecord>
<tableName>{$ctx:tableName}</tableName>
<sysparmDisplayValue>{$ctx:sysparmDisplayValue}</sysparmDisplayValue>
<sysparmFields>{$ctx:sysparmFields}</sysparmFields>
<sysparmView>{$ctx:sysparmView}</sysparmView>
<sysparmExcludeReferenceLink>{$ctx:sysparmExcludeReferenceLink}</sysparmExcludeReferenceLink>
<sysparmInputDisplayValue>{$ctx:sysparmInputDisplayValue}</sysparmInputDisplayValue>
<number>{$ctx:number}</number>
<shortDescription>{$ctx:shortDescription}</shortDescription>
<active>{$ctx:active}</active>
<approval>{$ctx:approval}</approval>
<category>{$ctx:category}</category>
<contactType>{$ctx:contactType}</contactType>
<apiColumns>{$ctx:apiColumns}</apiColumns>
</servicenow.postRecord>
</respond>
</inSequence>
</inSequence>
</resource>
</api>

Modify Alfresco Thumbnail Resolution

I'm using Alfresco Community v5.2.0 to store some files (pdf, jpg/png essentially).
I'm creating a web app to retrieve this files.
I'm trying to create a grid of files from a specific folder in my application.
But when i'm retrieving the list of a specific folders with their thumbnails, the resolution of the thumbnail is very low (100x75).
How to configure Alfresco to generate a larger thumbnail ?
I tried to override the settings in :
C:\alfresco-community\tomcat\webapps\alfresco\cmisfs\stylesheets\
thumbnails.xsl
But this didn't work..
I'm using Alfresco on my computer (windows), with REST API call.
Where can i configure this resolution ?
Thanks in advance,
Julien
Lyon, FR.
Ok I found a way to ovveride the thumbnail definition :
I created a file
thumbnail-service-context.xml
in
[AlfrescoRootFolder]\tomcat\shared\classes\alfresco\extension\
In this file I wrote :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- Slingshot Document Library image thumbnail options -->
<!-- Note that this will auto-register with parent="baseThumbnailDefinition" in the future -->
<bean id="thumbnailDefinitionDoclib" class="org.alfresco.repo.thumbnail.ThumbnailDefinition">
<property name="name" value="doclib" />
<property name="mimetype" value="image/png"/>
<property name="transformationOptions">
<bean parent="defaultImageTransformationOptions">
<property name="resizeOptions">
<bean parent="defaultImageResizeOptions">
<property name="width" value="900"/>
<property name="height" value="900"/>
<property name="allowEnlargement" value="false" />
</bean>
</property>
</bean>
</property>
<property name="placeHolderResourcePath" value="alfresco/thumbnail/thumbnail_placeholder_doclib.png" />
<property name="mimeAwarePlaceHolderResourcePath" value="alfresco/thumbnail/thumbnail_placeholder_doclib{0}.png" />
<property name="runAs" value="System"/>
<property name="failureHandlingOptions" ref="standardFailureOptions"/>
</bean>
</beans>
And now I can retrieve a thumbnail by calling :
/alfresco/api/-default-/public/alfresco/versions/1/nodes/{idDocAlfresco}/renditions/doclib/content

wso2 am 2.0 ApiKeyValidator Authentication Errors

We've recently upgraded our fully functional WSO2 AM 1.10 to 2.0. The installation process gave no errors and seems to be complete. We can use the Publisher just fine. However, when we go to the Store, and go to a tab that lists all of the user's Applications, it fails, and the page is empty. The log shows:
WARN - CarbonAuthenticationUtil Failed Administrator login attempt 'MyUser[-1234]' at [2017-01-10 09:47:09,380-0500]
WARN - AuthenticationHandler Illegal access attempt at [2017-01-10 09:47:09,0380] from IP address IP-ADDRESS while trying to authenticate access to service APIKeyMgtSubscriberService
ERROR - AMDefaultKeyManagerImpl Can not retrieve OAuth application for the given consumer key : BigLongStringOfStuff org.apache.axis2.AxisFault: Access Denied. Authentication failed - Invalid credentials provided.
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:445)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.wso2.carbon.apimgt.keymgt.stub.subscriber.APIKeyMgtSubscriberServiceStub.retrieveOAuthApplication(APIKeyMgtSubscriberServiceStub.java:1683)
at org.wso2.carbon.apimgt.keymgt.client.SubscriberKeyMgtClient.getOAuthApplication(SubscriberKeyMgtClient.java:89)
at org.wso2.carbon.apimgt.impl.AMDefaultKeyManagerImpl.retrieveApplication(AMDefaultKeyManagerImpl.java:234)
at org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO.getClientOfApplication(ApiMgtDAO.java:2389)
at org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO.getOAuthApplications(ApiMgtDAO.java:2353)
at org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO.getApplications(ApiMgtDAO.java:4649)
at org.wso2.carbon.apimgt.impl.APIConsumerImpl.getApplications(APIConsumerImpl.java:3136)
at org.wso2.carbon.apimgt.impl.UserAwareAPIConsumer.getApplications(UserAwareAPIConsumer.java:36)
at org.wso2.carbon.apimgt.hostobjects.APIStoreHostObject.jsFunction_getApplications(APIStoreHostObject.java:3225)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
We are using a Read Only LDAP store, the configuration is here:
<UserManager>
<Realm>
<Configuration>
<AddAdmin>False</AddAdmin>
<AdminRole>AdminGroup</AdminRole>
<AdminUser>
<UserName>MyUser</UserName>
<Password>MyPW</Password>
</AdminUser>
<EveryOneRoleName>everyone</EveryOneRoleName> <!-- By default users in this role sees the registry root -->
<Property name="dataSource">jdbc/WSO2CarbonDB</Property>
</Configuration>
<UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager">
<Property name="TenantManager">org.wso2.carbon.user.core.tenant.CommonHybridLDAPTenantManager</Property>
<Property name="ReadOnly">true</Property>
<Property name="Disabled">false</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="ConnectionURL">ldap://MyServer:389</Property>
<Property name="ConnectionName">CN=MyUser,OU=1,OU=2,DC=a,DC=b,DC=c</Property>
<Property name="ConnectionPassword">MyPW</Property>
<Property name="UserSearchBase">DC=a,DC=b,DC=c</Property>
<Property name="UserNameListFilter">(objectClass=user)(|(memberOf=CN=MyGroup-Subscriber,OU=1,OU=2,DC=a,DC=b,DC=c)(sAMAccountName=MyUser))</Property>
<Property name="UserNameSearchFilter">(|(&(objectClass=person)(sAMAccountName=?)(memberOf=CN=MyGroup-Subscriber,OU=1,OU=2,DC=a,DC=b,DC=c))(sAMAccountName=MyUser))</Property>
<Property name="UserNameAttribute">sAMAccountName</Property>
<Property name="DisplayNameAttribute">displayName</Property>
<Property name="ReadGroups">true</Property>
<Property name="GroupSearchBase">OU=Groups,OU=1,OU=2,DC=a,DC=b,DC=c</Property>
<Property name="GroupNameListFilter">(&(objectClass=group)(cn=MyGroup*))</Property>
<Property name="GroupNameSearchFilter">(&(objectClass=group)(cn=MyGroup?))</Property>
<Property name="GroupNameAttribute">cn</Property>
<Property name="MembershipAttribute">member</Property>
<Property name="MemberOfAttribute">memberOf</Property>
<Property name="MultipleAttributeSeparator">,</Property>
<Property name="PasswordHashMethod">PLAIN_TEXT</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="ReplaceEscapeCharactersAtUserLogin">true</Property>
<Property name="MaxRoleNameListLength">100</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="SCIMEnabled">false</Property>
</UserStoreManager>
<AuthorizationManager
class="org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager">
<Property name="AdminRoleManagementPermissions">/permission</Property>
<Property name="AuthorizationCacheEnabled">true</Property>
</AuthorizationManager>
</Realm>
</UserManager>
In the Api-Manager.xml configuration for the ApiKeyValidator Key We have:
<APIKeyValidator>
<!-- Server URL of the API key manager -->
<ServerURL>https://MyURL:${mgt.transport.https.port}${carbon.context}services/</ServerURL>
<!-- Admin username for API key manager.
<Username>MyUser</Username>
<!-- Admin password for API key manager. -->
<Password>MyPW</Password>
<KeyValidatorClientType>ThriftClient</KeyValidatorClientType>
<ThriftClientConnectionTimeOut>10000</ThriftClientConnectionTimeOut>
<EnableThriftServer>true</EnableThriftServer>
<ThriftServerHost>localhost</ThriftServerHost>
<KeyValidationHandlerClassName>org.wso2.carbon.apimgt.keymgt.handlers.DefaultKeyValidationHandler</KeyValidationHandlerClassName>
This error did not occur in 1.10 with the same config file entries. Is there any idea as to why this happens?
So I figured out why this occurred - This will happen if the incorrect provider is listed in the user-mgt.xml file. If you see my file above, I am trying to use ReadOnly LDAP, but I have the RDBMS provider listed instead.
Changed this line and boom, everythign is functional again.

Issue loading application context running Junit4 and Spring

I am playing with writing integration tests for our project. This is the first time I am writing tests so please pardon me if this is a simple question.
I have different modules like core, site, admin etc.,
I want to keep our unit tests separate from our integration tests. So in the core of the project, I created a folder src/it/java and a package in it - com.test.integration. This package has the test that I am trying to run.
The test application context and required test properties files are in src/it/java directly. I added src/it/java to my build path. In my application context I have the following
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="url" value="jdbc:mysql://${mysql.host}/${mysql.db_blc}?autoReconnect=true&useUnicode=true&characterEncoding=UTF8"/>
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="username" value="${mysql.user}" />
<property name="password" value="${mysql.pass}" />
<property name="testWhileIdle" value="true"/>
<property name="testOnBorrow" value="true"/>
<property name="testOnReturn" value="false"/>
<property name="validationQuery" value="SELECT 1"/>
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
<constructor-arg ref="dataSource" />
</bean>
Now in my sample test
#RunWith(BlockJUnit4ClassRunner.class)
#ContextConfiguration("/applicationContext-test.xml")
public class SampleTest {
#Resource(name="jdbcTemplate")
private NamedParameterJdbcTemplate jdbcTemplate;
}
The jdbcTemplate bean is null and I can't seem to figure out why.
Any input is appreciated. We are using Spring 3.0.5 and JUnit4
Thanks
Mehul
try using SpringJunit4ClassRunner
I would suggest changing the context configuration to this
#ContextConfiguration("classpath:/applicationContext-test.xml")

Configure an External LDAP User Store with WSO2 Identity Server

My Current configuration is
#
<UserManager>
<Realm>
<Configuration>
<AdminRole>admin</AdminRole>
<AdminUser>
<UserName>admin</UserName>
<Password>XXXXXX</Password>
</AdminUser>
<EveryOneRoleName>everyone</EveryOneRoleName> <!-- By default users in thsi role sees the registry root -->
<!-- <ReadOnly>false</ReadOnly> -->
<MaxUserNameListLength>500</MaxUserNameListLength>
<Property name="url">jdbc:h2:repository/database/WSO2CARBON_DB</Property>
<Property name="userName">wso2carbon</Property>
<Property name="password">wso2carbon</Property>
<Property name="driverName">org.h2.Driver</Property>
<Property name="maxActive">50</Property>
<Property name="maxWait">60000</Property>
<Property name="minIdle">5</Property>
</Configuration>
<UserStoreManager
class="org.wso2.carbon.user.core.ldap.LDAPUserStoreManager">
<Property name="ConnectionURL">ldap://localhost:389</Property>
<Property name="ConnectionName">cn=admin,dc=ysd,dc=com</Property>
<Property name="ConnectionPassword">admin32</Property>
<Property name="UserSearchBase">ou=People,dc=ysd,dc=com</Property>
<Property name="UserNameListFilter">(objectClass=person)</Property>
<Property name="UserNameAttribute">uid</Property>
<Property name="ReadLDAPGroups">false</Property>
<Property name="GroupSearchBase">ou=People,dc=ysd,dc=com</Property>
<Property name="GroupSearchFilter">(objectClass=groupOfNames)</Property>
<Property name="GroupNameAttribute">cn</Property>
<Property name="MembershipAttribute">member</Property>
</UserStoreManager>
<AuthorizationManager
class="org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager">
</AuthorizationManager>
</Realm>
</UserManager>`
#
Iam geeting following error while starting server.
*ERROR {org.wso2.carbon.user.core.common.DefaultRealm} - Cannot create org.wso2.carbon.user.core.ldap.LDAPUserStoreManager . Error is : null
java.lang.reflect.InvocationTargetException*
..............
............
............
Caused by: org.wso2.carbon.user.core.UserStoreException: LDAPUserStoreManager is unable to operate in Read-Write mode. This is invalid configuration. It can only operate in ReadOnly mode
at org.wso2.carbon.user.core.ldap.LDAPUserStoreManager.(LDAPUserStoreManager.java:97)
... 25 more
What is your exact requirement ? Do you want the Identity Server to do Read-Write operation on the external LDAP or do you want to do only the Read operations ?
You get this exception because you are trying to use the read only ldap user store for both read-write operations. Set the parameter <ReadOnly>false</ReadOnly>to true, then this error would go away.
But if your requirement is to use IS for both read write operations use the ApacheDSUserStoreManager. You can use the LDAPUserStoreManager for that.

Resources