Any help in resolving this invokeDataControl Method will be greatly appreciated. Please find the link below for a complete reference of the problem. I was basically trying to execute an Oracle/Java MAF example to understand the concept and present it to user for a critical go/no-go situation.
Environment:
1) Jdeveloper 12.1.3.0.0
2) MAF 2.0.1
3) Example tried: DSI037 in https://java.net/projects/smuenchadf/pages/ADFMobile
OR "http://deepakcs.blogspot.com/2013/06/offline-data-synchronization-for-adf.html"
4) MAC OS 10.9
5) WebLogic 12C
6) Error Message
[SEVERE - oracle.adfmf.framework - HttpServiceConnection - log] Connection Error: 500
[SEVERE - oracle.adfmf.framework - HttpTransport - parseResponse] Response [Error: {0}]: {1}
[SEVERE - oracle.adfmf.framework - SoapTransportLayer - invokeSoapRequest] Encountered exception while invoking SOAP request
EndPoint: http://XXX.XXX.XXX.XXX:80/EJBSyncWebServiceApp/SessionFacadeBeanService
SOAPAction: "http://service.soap.dsid.com/persistDepartments"
Exception: HTTP Status Code 500 Internal Server Error: The server encountered an unexpected condition which prevented it from fulfilling the request.
7) More Details:
The following code was executed. The method and all others are working fine in HTTP analyzer or when individually executed (binding "persistDepartments" with a button) but not when wrapper in AdfmfJavaUtilities.invokeDataControlMethod
public void syncDataFromOfflineToOnline() {
Trace.log(Utility.FrameworkLogger, Level.FINE, this.getClass(), "syncDataFromOfflineToOnline",
"Executing syncDataFromOfflineToOnline Method");
try {
Connection conn = DBConnectionFactory.getConnection();
conn.setAutoCommit(false);
PreparedStatement pStmt =
conn.prepareStatement("SELECT DEPARTMENT_ID, DEPARTMENT_NAME, LOCATION_NAME, STATUS from DEPARTMENTS WHERE STATUS IN (?, ?, ?)");
pStmt.setString(1, STATUS_NEWLY_CREATED);
pStmt.setString(2, STATUS_MODIFIED);
pStmt.setString(3, STATUS_DELETED);
ResultSet rs = pStmt.executeQuery();
while (rs.next()) {
List namesList = new ArrayList(1);
List paramsList = new ArrayList(1);
List typesList = new ArrayList(1);
Departments dept = new Departments();
dept.setDepartmentId(rs.getInt("DEPARTMENT_ID"));
dept.setDepartmentName(rs.getString("DEPARTMENT_NAME"));
dept.setLocationName(rs.getString("LOCATION_NAME"));
dept.setStatus(STATUS_NOT_CHANGED);
if (rs.getString("STATUS").equals(STATUS_NEWLY_CREATED)) {
System.out.println("I got a STATUS_NEWLY_CREATED");
GenericType gtDept =
GenericTypeBeanSerializationHelper.toGenericType("MYWS.Types.persistDepartments.arg0",
dept);
namesList.add("arg0");
paramsList.add(gtDept);
typesList.add(Object.class);
AdfmfJavaUtilities.invokeDataControlMethod("MYWS", null, "persistDepartments", namesList,
paramsList, typesList);
//Once the data sync with online, change the status for the row as STATUS_NOT_CHANGED
PreparedStatement pStmt1 =
conn.prepareStatement("UPDATE DEPARTMENTS SET STATUS=? WHERE DEPARTMENT_ID=?");
pStmt1.setString(1, STATUS_NOT_CHANGED);
pStmt1.setInt(2, rs.getInt("DEPARTMENT_ID"));
pStmt1.execute();
conn.commit();
<<< more codes >>>
I faced this problem.
Change the typesList.add(Object.class) to typesList.add(GenericType.class)
Related
I have written the code using camel-sql which is working fine. Now I have to write test cases for the same. I have used in-memory database H2. I have initialized the database and assigned the datasource to sqlComponent.
// Setup code
#Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry jndi = super.createRegistry();
// this is the database we create with some initial data for our unit test
database = new EmbeddedDatabaseBuilder()
.setType(EmbeddedDatabaseType.H2).addScript("createTableAndInsert.sql").build();
jndi.bind("myDataSource", database);
return jndi;
}
// Testcase code
#SuppressWarnings("unchecked")
#Test
public void testRoute() throws Exception {
Exchange receivedExchange = template.send("direct:myRoute", ExchangePattern.InOut ,exchange -> {
exchange.getIn().setHeader("ID", new Integer(1));
});
camelContext.start();
MyClass updatedEntity = (MyClass)jdbcTemplate.queryForObject("select * from MY_TABLE where id=?", new Long[] { 1l } ,
new RouteTest.CustomerRowMapper() );
// Here I can get the updatedEntity from jdbcTemplate
assertNotNull(receivedExchange);
assertNotNull(updatedEntity);
}
// Main code
from("direct:myRoute")
.routeId("pollDbRoute")
.transacted()
.to("sql:select * from MY_TABLE msg where msg.id = :#"+ID+"?dataSource=#myDataSource&outputType=SelectOne&outputClass=com.entity.MyClass")
.log(LoggingLevel.INFO,"Polled message from DB");
The problem is, as soon as the test case starts, it is saying
No bean could be found in the registry for: myDataSource of type: javax.sql.DataSource
I looked into camel-SQL component test cases and doing the same thing but the code is not able to find dataSource. Please help. Thanks in advance.
After spending a lot of time on this issue, I identified that H2 database was using JDBCUtils to fetch records and It was throwing ClassNotFoundException. I was getting it nowhere in Camel exception hierarchy because this exception was being suppressed and all I was getting a generic exception message. Here is the exception:
ClassNotFoundException: com.vividsolutions.jts.geom.Geometry
After searching for the issue I found out that It requires one more dependency. So I added it and it resolved the issue.
Issue URL: https://github.com/elastic/elasticsearch/issues/9891
Dependency: https://mvnrepository.com/artifact/com.vividsolutions/jts-core/1.14.0
here i am trying to query a table of sql server 2008 r2 from my c++ application. It contains 21,54,514. but it throws an exception like "Query timeout expired" . below is my code base
ADODB::_ConnectionPtr m_pDBConnection;
ADODB::_RecordsetPtr m_pRS;
m_pDBConnection.CreateInstance("ADODB.Connection");
m_pRS.CreateInstance("ADODB.RecordSet");
m_pRS->Open(wstrSQL.c_str(), _variant_t((IDispatch *) m_pDBConnection, true),
ADODB::adOpenStatic,
ADODB::adLockReadOnly,
ADODB::adCmdText);
When the above line is get executed it throws the above said exception.
i know the issue , the issue is actually with default timeout set. it is actually 15 sec.
can anybody please tell how to reset or change timeout in ADODB::_RecordsetPtr. I searched in google a lot , we can do reset timeout for ADODB::_ConnectionPtr but not for ADODB::_RecordsetPtr. it would be vary usefull for me. Thanks in advance.
According to Coding Journey you need to set the CommandTimeout on the connection and on the command.
// The recordset for the result
ADODB::_RecordsetPtr rs;
// Timeout on connection
m_pDBConnection->CommandTimeout = 60;
// Need to create command first, then configure it, then open RecordSet
ADODB::_CommandPtr cmd(__uuidof(ADODB::Command));
cmd->ActiveConnection = m_pDBConnection;
cmd->CommandText = wstrSQL.c_str();
cmd->CommandTimeout = 60;
rs->Open(cmd, vtMissing, ADODB::adOpenStatic, ADODB::adLockReadOnly, ADODB::adCmdText);
// Reset the timeout on the connection
m_pDBConnection->CommandTimeout = 15;
I am hoping someone can help get me in the right direction...
I am using Powerbuilder 12 Classic and trying to consume a Oracle CRM OnDemand web service.
Using Msxml2.XMLHTTP.4.0 commands, I have been able to connect using https and retrieve the session id, which I need to send back when I invoke the method.
When I run the code below, I get the SBL-ODU-01007 The HTTP request did not contain a valid SOAPAction header error message. I am not sure what I am missing??
OleObject loo_xmlhttp
ls_get_url = "https://secure-ausomxxxx.crmondemand.com/Services/Integration?command=login"
try
loo_xmlhttp = CREATE oleobject
loo_xmlhttp.ConnectToNewObject("Msxml2.XMLHTTP.4.0")
loo_xmlhttp.open ("GET",ls_get_url, false)
loo_xmlhttp.setRequestHeader("UserName", "xxxxxxx")
loo_xmlhttp.setRequestHeader("Password", "xxxxxxx")
loo_xmlhttp.send()
cookie = loo_xmlhttp.getResponseHeader("Set-Cookie")
sesId = mid(cookie, pos(cookie,"=", 1)+1, pos(cookie,";", 1)-(pos(cookie,"=", 1)+1))
ls_post_url = "https://secure-ausomxxxx.crmondemand.com/Services/Integration/Activity;"
ls_response_text = "jsessionid=" + sesId + ";"
ls_post_url = ls_post_url + ls_response_text
loo_xmlhttp.open ("POST",ls_post_url, false)
loo_xmlhttp.setRequestHeader("COOKIE", left(cookie,pos(cookie,";",1)-1) )
loo_xmlhttp.setRequestHeader("COOKIE", left(cookie,pos(cookie,";",1)-1) )
ls_post_url2 = "document/urn:crmondemand/ws/activity/10/2004:Activity_QueryPage"
loo_xmlhttp.setRequestHeader("SOAPAction", ls_post_url2)
loo_xmlhttp.send()
ls_get_url = "https://secure-ausomxxxx.crmondemand.com/Services/Integration?command=logoff"
loo_xmlhttp.open ("POST",ls_get_url, false)
loo_xmlhttp.send()
catch (RuntimeError rte)
MessageBox("Error", "RuntimeError - " + rte.getMessage())
end try
I believe you are using incorrect URL for Login and Logoff;
Here is the sample:
https://secure-ausomxxxx.crmondemand.com/Services/Integration?command=login
https://secure-ausomxxxx.crmondemand.com/Services/Integration?command=logoff
Rest of the code looks OK to me.
I have run into similar issues in PB with msxml through ole. Adding this may help:
loo_xmlhttp.setRequestHeader("Content-Type", "text/xml")
you need to make sure that the your value for ls_post_url2 is one of the values that is found in the wsdl file. Just search for "soap:operation soapAction" in the wsdl file to see the valid values for SOAPAction.
I create a simple silverlight 4.0 application used to read the excel file data in the share point 2010 server. I try to use the "Excel Web Services" but I get an error here when calling the GetRangeA1 method:
An unhandled exception of type 'System.ServiceModel.Dispatcher.NetDispatcherFaultException' occurred in mscorlib.dll
Additional information: The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://schemas.microsoft.com/office/excel/server/webservices:GetRangeA1Response. The InnerException message was 'Error in line 1 position 361. Element 'http://schemas.microsoft.com/office/excel/server/webservices:anyType' contains data from a type that maps to the name 'http://schemas.microsoft.com/office/excel/server/webservices:ArrayOfAnyType'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type corresponding to 'ArrayOfAnyType' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details.
the source code is like:
namespace SampleApplication
{
class Program
{
static void Main(string[] args)
{
ExcelServiceSoapClient xlservice = new ExcelServiceSoapClient();
xlservice.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
Status[] outStatus;
string targetWorkbookPath = "http://phc/Shared%20Documents/sample.xlsx";
try
{
// Call open workbook, and point to the trusted location of the workbook to open.
string sessionId = xlservice.OpenWorkbook(targetWorkbookPath, "en-US", "en-US", out outStatus);
Console.WriteLine("sessionID : {0}", sessionId);
//1. works fines.
object res = xlservice.GetCellA1(sessionId, "CER by Feature", "B1", true, out outStatus);
//2. exception
xlservice.GetRangeA1(sessionId, "CER by Feature", "H19:H21", true, out outStatus);
// Close workbook. This also closes session.
xlservice.CloseWorkbook(sessionId);
}
catch (SoapException e)
{
Console.WriteLine("SOAP Exception Message: {0}", e.Message);
}
}
}
}
I am totally new to the silverlight and sharepoint developping, I search around but didn't get any luck, just found another post here, any one could help me?
This appears to be an oustanding issue, but two workarounds I found so far:
1) Requiring a change in App.config.
http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/ab2a08d5-2e91-4dc1-bd80-6fc29b5f14eb
2) Indicating to rebuild service reference with svcutil instead of using Add Service Reference:
http://social.msdn.microsoft.com/Forums/en-GB/sharepointexcel/thread/2fd36e6b-5fa7-47a4-9d79-b11493d18107
I'm researching a way to build an n-tierd sync solution. From the WebSharingAppDemo-CEProviderEndToEnd sample it seems almost feasable however for some reason, the app will only sync if the client has a live SQL db connection. Can some one explain what I'm missing and how to sync without exposing SQL to the internet?
The problem I'm experiencing is that when I provide a Relational sync provider that has an open SQL connection from the client, then it works fine but when I provide a Relational sync provider that has a closed but configured connection string, as in the example, I get an error from the WCF stating that the server did not receive the batch file. So what am I doing wrong?
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
builder.DataSource = hostName;
builder.IntegratedSecurity = true;
builder.InitialCatalog = "mydbname";
builder.ConnectTimeout = 1;
provider.Connection = new SqlConnection(builder.ToString());
// provider.Connection.Open(); **** un-commenting this causes the code to work**
//create anew scope description and add the appropriate tables to this scope
DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription(SyncUtils.ScopeName);
//class to be used to provision the scope defined above
SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning();
....
The error I get occurs in this part of the WCF code:
public SyncSessionStatistics ApplyChanges(ConflictResolutionPolicy resolutionPolicy, ChangeBatch sourceChanges, object changeData)
{
Log("ProcessChangeBatch: {0}", this.peerProvider.Connection.ConnectionString);
DbSyncContext dataRetriever = changeData as DbSyncContext;
if (dataRetriever != null && dataRetriever.IsDataBatched)
{
string remotePeerId = dataRetriever.MadeWithKnowledge.ReplicaId.ToString();
//Data is batched. The client should have uploaded this file to us prior to calling ApplyChanges.
//So look for it.
//The Id would be the DbSyncContext.BatchFileName which is just the batch file name without the complete path
string localBatchFileName = null;
if (!this.batchIdToFileMapper.TryGetValue(dataRetriever.BatchFileName, out localBatchFileName))
{
//Service has not received this file. Throw exception
throw new FaultException<WebSyncFaultException>(new WebSyncFaultException("No batch file uploaded for id " + dataRetriever.BatchFileName, null));
}
dataRetriever.BatchFileName = localBatchFileName;
}
Any ideas?
For the Batch file not available issue, remove the IsOneWay=true setting from IRelationalSyncContract.UploadBatchFile. When the Batch file size is big, ApplyChanges will be called even before fully completing the previous UploadBatchfile.
// Replace
[OperationContract(IsOneWay = true)]
// with
[OperationContract]
void UploadBatchFile(string batchFileid, byte[] batchFile, string remotePeer1
I suppose it's simply a stupid example. It exposes "some" technique but assumes you have to arrange it in proper order by yourself.
http://msdn.microsoft.com/en-us/library/cc807255.aspx