Tuesday, January 26, 2016

How to configure mail in StreamServer project(5.x)

one of my customer wants to the deliver his purchase order as email .These email address are defined in the stream file header. These entries are based on the CRS945 and MNS205.
image_thumb9_thumb[1]
According to the above example Mail should goes to the fromMailAddres@test.lk and from address should be tomail@test.lk.
As first step Mail server settings should be defined in the relevant Platform settings in the design center.
Go to the relevant platform .
image_thumb11_thumb[2]
Then right click on the mail settings and go to the settings tab and click the connector .
image_thumb13_thumb[1]
Then need to select the Connector type .There are several inbuilt connects types available with streamserver . For this case I'm use the STMP(MIME)(Legacy) connector .
Please note that by default this connector use the 25 as the mail port for sending emails and if your client use separate port then you have to you another connector . Ideally STMP MIME connector.
then provide relevant mail server address and UN and PW based on the customer site mail configuration .You can ask these information for IT administrator of the customer site.
After configuring the platform we need to configure the Runtime settings .
Below is the runtime settings for my PO.In run time we need to set from email /to email /subject and other required settings for the email.
When stream serve begin the execution, stream server agent create some set of initial variables for all the entries which stated with * sign in the streamfile and assign values .
image_thumb15_thumb[1]
For my case below are the variables generated by the agent.Please refer the below url for all agent generated values .(http://streamshare.streamserve.com/Forum/Topic/?topicID=990).
Stream File Name
Agent Generated Name
Value
*TOMAIL1
$mvx_tomail
fromMailAddres@test.lk
*FRMAIL1
$mvx_frmail
tomail@test.lk
*SUBJECT1
$mvx_subject
M3 output
image_thumb28_thumb[1]
right click on mail settings and go the settings and select respective platform .
image_thumb30_thumb[1]
And then go the Edit mail.
image_thumb32_thumb[1]
And fill the From/to/subject etc based on the agent generated variable  and click ok .
Then you are good to go. Save export and deploy the project.

Tuesday, February 17, 2015

Sort blocks in the StreamServe

Some instances we need to sort blocks in the stream server mom development. Think a scenario like below. I have stream file in below architecture.

2M

1L

1L

1L

2M

1L

2M

But I need to print it like below,

1L

1L

1L

1L

2M

2M

2M

There are several way to achieve this task.Doing by MAK is very extensive task.So here im going to play with block sorting option.

I  use PMS241 as my demo project.

First go the event.and double click on it

image

Identify the blocks that you want to sort and apply the sort block priority as below.(In my case case blocks are PMS2414L and PMS2414M.

Set 4L block priority

image

Set 4M block priority.

image

We are done now.Block sort priority lower one come first.That means number is low, then it is get prioritized. same as the M3 print out sorting order.

Finally save and deploy. It should work.  Smile

Thursday, February 12, 2015

Adding site binding gives object null reference error in IIS7

Recently I have tried to add new binding to the my existing site using IIS GUI. But when fill the relevant information and click ok button its ended up with prompting object null reference to me.

image 

But I could not find solution for this but found the another way to do the same task using Appcmd.exe(only available in IIS 7 or above). I want to add new net.tcp biding to the site and I ran below code in the command prompt(please make sure to run comman prompt as Administrator mode- other wise there will be another errors.).

appcmd set site /site.name: contoso /+bindings.[protocol='https',bindingInformation='*:443:'].

Wednesday, February 11, 2015

How to hide overlay in StreamServe

In some times you have to hide the overlay in stream serve dynamically. For a example if the activity is print you want to skip the overlay and if its mail need to continue with the overlay.But in this case you cannot use normal Skip function as overlays are static content. But there are several ways to do this task and in this post am going tell you to do this via a variable which is used the the overlay properties.

So first you have to go to the overlay properties and assign variable for it.

Untitled

image

Assign variable name as mentioned above(you can have any name for the variable and same should use in the script part.) Please make sure to Tick the “supress overlay” check box.

Now we are done in the overlay.

Then move the Body or what ever page that you use the overlay and add a script before page load event and apply below code.

In this example I going to skip the overlay when the activity is prints

if(&mvx_activity ==”PRINT”){

$prabodha = “TRUE”;

}else{

$prabodha = “FALSE”;

}

Bingo it should work.

Friday, August 15, 2014

System.BadImageFormatException: Could not load file or assembly(Windows service)

Recently I have created a windows service and I wanted to to install that service to the my QA server.for that I used InstallUtil command.So for that below command in my command prompt.

image

But that command failed with below message

System.BadImageFormatException: Could not load file or assembly '{WriteOffService.exe}' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Then after my check dependencies those were placed fine.After I search I found the reason for this. Smile

I have complied my application according to the 32 bit configuration and I used 64 Bit installUtil to the install application. after I installed it using 32 bit installUtil and its worked as expected.

After you install .Net framework(in my case it is version 4.0) its created the two separate folders for 32 bit and 64 bit.In side those folders for according to the Framework version

Intallation root:\Windows\Microsoft.NET\

 image

(here you can see two different folders Framework(32) and Framwork64(64)).That each folder contains two InstallUtil versions according to the .Net Framework version.

image

64 bit version

image

32 bit version

Monday, April 7, 2014

WCF Discovery : Ad Hoc Discovery Client

WCF Discovery is a new feature which was shipped with WCF 4.0.WCF discovery is an implementation of the OASIS WS-Discovery specification.Think a scenario where  client application has the address of a specific service hard-coded into its configuration, then if that service moves, becomes temporarily unavailable, or is just too busy to handle requests, the client will not be able to communicate with it. WCF provides discovery and routing to address these issues. By implementing discovery client Application can locate the specific service address dynamically. As well as service can broadcasts its status to the all clients when service goes down or up.

There are two ways to implement WCF discovery.

  • Add Hoc Discovery
  • Manage Discovery

In this example I m going to explain Add Hoc Discovery client.In this client, service address not hard coded.Instead of that setting up the client endpoint address dynamically.

How this works ?

In Adhoc model clients send Probe message to the network .This message contains the information about the service which it wishes to connect. After service receives a Probe request, it can examine its contents, and if the probe matches the contract implemented by the service, it can respond to the client with a ProbeMatch message. TheProbeMatch message contains the service addressing information that the client needs to connect to the service.Client message uses the UDP protocol to send the probe message.

When implementing in order to  support above model service need to add specific endpoint call udpDiscoveryEndpoint and Service Discovery behavior to the service behaviors

what is udpDiscoveryEndpoint – This is a standard endpoint which used to implement the ad hoc mode of discovery.

<services>
<service name="Discovery.PTSService" behaviorConfiguration="discoveryBehaviour">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="httpBinding"
contract="Discovery.IPTSService" />
<!—new discovery endpoint-->
<endpoint kind="udpDiscoveryEndpoint"/>
</service>
</services>


What is Kind ?


udpDiscoveryEndpoint is standard endpoint .if we need to use standard endpoint we have to use kind instead of name. for more information http://msdn.microsoft.com/en-us/library/ee358762(v=vs.110).aspx


<serviceBehaviors>
<behavior name="discoveryBehaviour">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />

<!-- service dicovery behaviors -->
<serviceDiscovery />
</behavior>
</serviceBehaviors>


Additionally we can set the scope for the service endpoint behaviors.which Adds the scope information for the endpoint that can be used in matching criteria for finding services.


Now our service is completed.(please make sure service is up and running)Now move the client implementation.


image


Client need to have reference to the System.ServiceModel.Discovery and your service.


image


static void Main(string[] args)
{
//initialize new discovery Client with UdpDiscoveryEndpoint
DiscoveryClient client = new DiscoveryClient(new UdpDiscoveryEndpoint());

// define the find criteria with serivce type
FindCriteria criteria = new FindCriteria(typeof(IPTSService));

// then clinet .Find
FindResponse services = client.Find(criteria);

client.Close();
}


Additionally FindCriteria can set the time out for service discovery. whether criteria can find service or not its return the output after the specified time.


criteria.Duration = TimeSpan.FromSeconds(50);


Lets run and see what happens.I have put watcher to the my services object..


image


Now you can see Find response contains all the required for the service invocation.

Thursday, April 3, 2014

The type 'System.ServiceModel.Routing.RoutingService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found

Recently I have created WCF router service and deployed to IIS. But once I run the my router service its gives me above error Sad smile.Normally this kind of errors happen when service couldn't find the service host reference. but in my router service its seems ok .

<%@ ServiceHost Language="C#" Debug="true" Service="System.ServiceModel.Routing.RoutingService" %>


Then I use full qualified name instead of the name as below.Bingo then its works Smile 


<%@ ServiceHost Language="C#" Debug="true" Service="System.ServiceModel.Routing.RoutingService,System.ServiceModel.Routing, version=4.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35"  %>