Thursday, March 10, 2016

Sequence Numbers in eText templates

 

As I said earlier, Oracle’s eText template is really painful to work with. Its does not have support variables or arrays, so when the need arises to have something temporarily stored somewhere, you are lost. The one thing eText does have, is a method to generate sequence numbers. Basically you use the DEFINE_SEQUENCE command.

image

The define sequence command has four subcommands: reset at level, increment basis, start at, and maximum. The increment basis subcommand specifies if the sequence should be incremented based on record or extract instances. The allowed parameters for this subcommand are RECORD and LEVEL. Enter RECORD to increment the sequence for every record. Enter LEVEL to increment the sequence for every new instance of a level.  cleartext.blogspot.com

To generate the sequnce numbers, use the SEQUENCE_NUMBER function in the template.

image

But what if you just want to keep count of something, and not count levels or records in the data ? Just leave out the INCREMENT_BASIS completely.  cleartext.blogspot.com

image

So now, whenever SEQUENCE_NUMBER function is called, the current value will be printed, and the counter will be increased by 1. This happens everytime the function is invoked.

There are some payment interfaces where the number has to be incremented in steps of 5 or 10. For example, one of the ADP checkprinter format template requires a counter to start at 30, and be incremented in steps of 5. So its 30, 35, 40, 45…

To do that the SEQUENCE_NUMBER function should be used with some mathematics.

image

 

 

Originally published on cleartext.blogspot.com

Wednesday, March 2, 2016

.NET : No endpoint element matching this contract could be found in the client element

 

If you are using .NET and trying to integrate to Oracle Fusion Cloud service, any service, HCM,Sales Cloud, Service Cloud.., after consuming the WSDL and writing the first bits of code, you will get to this error:

cleartext.blogspot.com

Could not find default endpoint element that references contract ….' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

image

You will get the error wether you try importing as Web Reference or Service Reference. The reason for this is that even after successfully consuming the WSDL, .NET does not add the end point configuration into the app.config file.

 

1: Possible workaround: When you write the code to create the client object, (SalesCloud account, in my case), instead of going with the default no parameter initialization,  add parameters for Binding and Endpoints.cleartext.blogspot.com

 

VB.NET : Add this code to your project source:

Public Class UsernameTokenOverSslBinding : Inherits CustomBinding
    Public Sub New()
        MyBase.New()
    End Sub
    Public Overrides Function CreateBindingElements() As BindingElementCollection
        Dim bindingElements As BindingElementCollection = New BindingElementCollection
        bindingElements.Add(SecurityBindingElement.CreateUserNameOverTransportBindingElement())cleartext.blogspot.com
        Dim messageEncoding As MtomMessageEncodingBindingElement = New MtomMessageEncodingBindingElement
        messageEncoding.MessageVersion = MessageVersion.Soap11
        bindingElements.Add(messageEncoding)
        Dim transport As HttpsTransportBindingElement = New HttpsTransportBindingElement
        bindingElements.Add(transport)

        Return bindingElements.Clone()
    End Function
End Class

 

C# .NET: Add this code

 

 public class UsernameTokenOverSslBinding : CustomBinding     {         public override BindingElementCollection CreateBindingElements()         {
cleartext.blogspot.com
            BindingElementCollection bindingElements = new BindingElementCollection();             bindingElements.Add(SecurityBindingElement.CreateUserNameOverTransportBindingElement());             MtomMessageEncodingBindingElement messageEncoding = new MtomMessageEncodingBindingElement();             messageEncoding.MessageVersion = MessageVersion.Soap11;             bindingElements.Add(messageEncoding);             HttpsTransportBindingElement transport = new HttpsTransportBindingElement();             bindingElements.Add(transport);             return bindingElements.Clone();         }     }
 
Now pass this class object as the first parameter to your Interface Object Initialization.
Example: Previous code:
Dim accountclient As New OSC.AccountServiceClient()cleartext.blogspot.com
New code

Dim endpointAddress = New EndpointAddress(New Uri("URL”))  ‘ give the url here.
Dim accountclient As New OSC.AccountServiceClient(New UsernameTokenOverSslBinding(), endpointAddress)

 

…And thats it ! The object will now be able to connect to the server via a webservice call.

cleartext.blogspot.com

2: Possible workaround:  The other possible workaround is to add these lines to app.config file.

 

image

cleartext.blogspot.com

 

Any of these workarounds, and you should start seeing the response object:

image