sap .net connector 3.0 idoc processing - sap-dotnet-connector

I need to implement Idoc processing with SAP .net connector 3.0
I'm looking for C# exemples. I didn't find any help into SAP .net connector 3.0 library: SAP.Middleware.Connector !!! Amazing: no reference at all on IDOC implementation !
old classes used in SAP .net connector 2.0 (such as SAPIDocReceiver) seem to have been removed from this new version.
i heard about 'IDOC_INBOUND_ASYNCHRONOUS' method (or class ?) which should be used in SAP .net connector 3.0 ?
thanks to all, any help appreciated

You might consider to act as a RFC Server in NCO 3.0 and handle either 'IDOC_INBOUND_IN_QUEUE' and/or 'IDOC_INBOUND_ASYNCHRONOUS'.
[RfcServerFunction(Name = "IDOC_INBOUND_IN_QUEUE")]
public static void IDOC_INBOUND_IN_QUEUE(RfcServerContext serverContext, IRfcFunction rfcFunction)
{
//Create table to handle control records
IRfcTable irtControl = rfcFunction.GetTable("IDOC_CONTROL_REC_40");
//Create table to handle data records
IRfcTable irtData = rfcFunction.GetTable("IDOC_DATA_QUEUE");
//Process tables
//
//Confirm receipt of IDoc
//BAPI call back to SAP to confirm if needed
}
This site may be of value http://www.dataxstream.com/

Related

ASP .net core time out error using Oracle

I'm new to ASP .Net Core and am working my way through a demo project to learn the tech stack.
My project is using .net core 2.2 and Oracle.ManagedDataAccess.Core and Oracle.EntityFramework.Core.
I created a model and then went and scaffolded my view and controller through VS 2019. I've set up ConfigureService(...) to use Oracle. I added an HTML link on my main index page to hook into the view created for my model. When it calls the Controller::Index() function, I end up getting the following timeout error
OracleException: Connection request timed out
OracleInternal.ConnectionPool.PoolManager<PM, CP, PR>.Get(ConnectionString csWithDiffOrNewPwd, bool bGetForApp, OracleConnection connRefForCriteria, string affinityInstanceName, bool bForceMatch)
Any help or guidance as to what I could be doing wrong would be greatly appreciated!
It looks like a error connecting to the database.
There are some things you should check:
Make sure the connection string to the database, stored in the appsettings.json is correct.
Make sure to have a firewall rule which allows inbound traffic to the port from where the Oracle db is listening.
If the problem persists then you should provide the code you are using to access the database.

Read existing messages from a Subscription/Topic in Azure ServiceBus

I am trying to read all existing messages on an Azure ServiceBus Subscription, using the Microsoft.Azure.ServiceBus.dll (in .Net Core 2.1) but am struggling.
I've found many examples that the following should work, but it doesn't:
var client = new SubscriptionClient(ServiceBusConnectionString, topicName, subscription, ReceiveMode.PeekLock, null);
var totalRetrieved = 0;
while (totalRetrieved < count)
{
var messageEnumerable = subscriptionClient.PeekBatch(count);
//// ... code removed from this example as not relevant
}
My issue is that the .PeekBatch method isn't available, and I'm confused as to how I need to approach this.
I've downloaded the source for the ServiceBusExplorer from GitHub (https://github.com/paolosalvatori/ServiceBusExplorer) and the above code example is pretty much as it's doing it. But not in .Net Core / Microsoft.Azure.ServiceBus namespace.
For clarity though, I'm trying to read messages that are already on the queue - I've worked through other examples that create listeners that respond to new messages, but I need to work in this disconnected manner, after the message has already been placed on the queue.
ServiceBusExplorer uses WindowsAzure.ServiceBus Library, which is a .Net Framework Library and you cannot use it in .Net Core applications. You should use Microsoft.Azure.ServiceBus (.Net Standard Library) in .Net Core applications.
Check here for samples of Microsoft.Azure.ServiceBus
var client = new SubscriptionClient(ServiceBusConnectionString, topicName, subscription, ReceiveMode.PeekLock, null);
client .RegisterMessageHandler(
async (message, token) =>
{
await subscriptionClient.CompleteAsync(message.SystemProperties.LockToken);
}
);
Try using RegisterMessageHandler. It will
receive messages continuously from the entity. It registers a message handler and
begins a new thread to receive messages. This handler is awaited
on every time a new message is received by the receiver.

SYBASE ODBC .Net CORE

1. Has anyone successfully used ODBC from c# to Sybase ASE?
2. Or Better, has anyone successfully used Sybase ASE with .NET Core?
I am using .NET Core 1.1 and the current Sybase.AdoNet4.AseClient.dll doesn't work, so I am attempting to use ODBC. I have tried to use two ODBC packages:
Mono.Data.OdbcCore (NuGet)
MSA.Net.Core.ODBC (NuGet)
Both work well with in-line queries and both work well calling a Sybase Store Procedures WITHOUT Parameter but both have the same exact error when trying to send parameters to a sp, where the parameters are required.
Here is a snippet:
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "XX_GetLookUp";
command.Parameters.Add("#Type", OdbcType.VarChar).Value = "ACC";
using (var reader = command.ExecuteReader()) {
...
}
I constantly receiving the following error during the command.ExecuteReader():
System.Data.Odbc.OdbcException: 'ERROR [ZZZZZ] [SAP][ASE ODBC Driver][Adaptive Server Enterprise]Procedure iKYC_GetLookUp expects parameter #Type, which was not supplied.
I have tried to use Type with and without the # but each generate the same error.
I did try several other flavors as well:
command.CommandText = "{call dbo.iKYC_GetLookUp(?)}";
command.CommandText = "{call dbo.iKYC_GetLookUp}";
command.CommandText = "{dbo.iKYC_GetLookUp(?)}";
command.CommandText = "dbo.iKYC_GetLookUp(?)";
command.CommandText = "dbo.iKYC_GetLookUp ?";
Where each above generates: System.Runtime.InteropServices.SEHException: 'External component has thrown an exception.'
I also tried to build the parameter object separate, with no luck (same error, missing #Type):
OdbcParameter p = new OdbcParameter();
p.ParameterName = "#Type";
p.DbType = DbType.AnsiString;
p.Direction = ParameterDirection.InputOutput;
p.Value = "ACC";
cmd.Parameters.Add(p);
As stated prior, if I make the parameter as null, on the store procedure, the code works and data is returned as expected, so the issue appears to be around the parameters being passed.
Has anyone successfully used ODBC from c# to Sybase ASE?
Has anyone successfully used Sybase ASE with .NET Core?
Additional information:
I am using Visual Studio 2017 (v 15.2). Core 1.1 and using Sybase ASE 16.0 sp2.
We had a similar issue - we wanted to use ADO.NET on the AWS Serverless stack - which is .NET Core only. We raised an issue with SAP requesting support for .NET Core, but got nothing back.
We had a go with ODBC and couldn't get it to work with return values on our stored procedures, and bit the bullet and wrote our own ADO.NET Core DbProvider for ASE 15-16.
It implements the TDS 5 protocol under the hood natively in .NET Core and outperforms the SAP/Sybase implementation in all of our test cases.
https://github.com/DataAction/AdoNetCore.AseClient
There's docs on the wiki to run the unit, integration and benchmark tests for yourself.
Most features are implemented, and pull requests and feedback are welcome. .NET 4.6 and .NET Core 1.0, 1.1, 2.0 and 2.1 are supported.
We have this working using AWS Lambda and .NET Core 2.0.

Migration from Flex 3 to Flex 4.5: problem with network format

I'm currently migrating a large project from Flex 3 to Flex 4.5. The problem I'm stuck on is network communication: we're using a custom protocol that we embed in AMF3, but it seems the messages sent by flash.net.NetConnection aren't readable.
Our Java back-end uses some BlazeDS classes to deserialize the message, namely flex.messaging.io.amf.AmfMessageDeserializer.AmfMessageDeserializer, and I can monitor the network traffic with Charles Web Proxy which decodes AMF3. The very simple code herebelow sends a message that can be decoded by Charles when compiled in Flex 3.5, but not in Flex 4.5 (I get "Failed to parse data (com.xk72.amf.AMFException: Unsupported AMF3 packet type 17 at 26").
import mx.controls.Alert;
private function init():void
{
var pdl : Dictionary = new Dictionary();
var connection : NetConnection = new NetConnection();
connection.connect("http://localhost");
var responder : Responder = new Responder(result);
connection.call("net", responder, pdl);
}
private function result(pdl : Object) : void {
Alert.show("coucou", "hello");
}
I've set up an apache server at localhost:80 to test this.
Has anyone used NetConnection in Flex 4.5 and encountered deserialization problems? How did you solve them?
Thanks,
Daniel
AMF3 has a bunch of different core types it can serialize. One of those core types is new to AMF3 in the past year or two, Dictionary, and it has a "packet type" of 17, thus the error message. I'm not sure why Flex 3 would serialize it as something other than a Dictionary and Flex 4.5 would serialize it as the new Dictionary type, but you're getting an error because your BlazeDS backend doesn't support the new Dictionary type.
The solution is to either figure out what it was sending as in Flex 3 and switch to that, or to upgrade BlazeDS (there seems to have been a patch added to BlazeDS last year for Dictionary http://forums.adobe.com/thread/684487).
edit: Didn't realize that the error was with Charles. Charles probably hasn't added support for Dictionary, as it's not part of the documented AMF3 specs. Have you tried the beta of Charles?
Since you're working with legacy code, you may need to set the NetConnection's objectEncoding property manually before you make the connection. You can set the connection's objectEncoding with the help of the ObjectEncoding class.
What version of Flash Player are you using?

how to call procedure in database asynchronously from java 1.4 code?

platform:
Sql server 2000
java 1.4
ejb 3.0
I'm not sure to get the question but calling a stored procedure involves using a CallableStatement. For the asynchronous part, and because you mentioned EJBs, the standard way would be to use JMS and a Message Driven Bean. But I'm a bit confused by the part where you mention Java 1.4 and EJB 3.0 (that requires Java 1.5). Maybe you should clarify that requirement. Sending JMS messages to a MDB 3.0 from a Java 1.4 client should be possible though.
If you don't find a way to handle this at database level, you can do it like you would do any asynchronous stuff:
thread = new Thread() {
public void run() {
// do your procedure call here
}
};
thread.start();

Resources