cancel
Showing results for 
Search instead for 
Did you mean: 

PCo Socket Agent destination problem

janbuchmann
Contributor
0 Kudos

Hi there

I need some help with notification processing in PCo. I've created a socket agent for receiving weights from a scale and sending it to a webservice. The WSDL URL is exposed from my SAP ECC.

I created a notification in the PCo management console with the webservice being the destination. I've maintained output destination mapping in the destination, as well an output expression in the notification. Notification trigger is enabled and set to Always. In addition, I created another simulation notification for test purposes to get the XML into with a file directory.

I've successfully tested both notifications via "Test Notification Delivery" on the output screen. I got the expected result in my SAP system as well as an XML file.

However, once the agent is up & running and the weighing results are coming through (the log shows for example : SCALE [x.x.x.x:82] received message: Gross 0.123kg), I don't get any result. Nothing in SAP, not even an XML output.

What am I missing?

Thanks

Jan

Accepted Solutions (1)

Accepted Solutions (1)

former_member196557
Active Contributor
0 Kudos

Hi Jan,

How do you have the Socket Agent set up for Message handling: Termination characters or length?

if the scale outputs a termination character sequence (Most due, usually a CR-LF), then set the connection in the Source agent to use termination characters and enter \0D\0A for the CR (0x0D) and LF (0x0A) characters, as shown in this example (Note: you can specify an termination character by using \nn where nn is the Hex value of the character):

Note, the Check Connection box tells PCo to send a NULL (0x00) character to the source on whatever interval is defined in Retry Interval of Reliable Messaging tab for the Agent.

You can also set the PCo Agent Instance log to Verbose to capture all of the messages. If you are not generating a notification, then the log will show that some number of bytes was received but PCo did not receive either the correct termination sequence or the specified number of bytes.

Regards, Steve

janbuchmann
Contributor
0 Kudos

Hi Steve

Thank you for your prompt response.

I defined the socket agent with a fixed length:

This is what I get in the log in verbose mode:

(I do hope that I am restricting the log to the relevant entries...)

Interesting enough, even though I set the scale to send a fixed length of 24, PCo tells me the stream length is 27. I therefore changed my socket agent and also removed the "Check connection" tick.

The log is still pretty much the same:

Do I need to be concerned about the deadband message?

Thanks & regards

Jan

former_member196557
Active Contributor
0 Kudos

Hi Jan,

I would strongly recommend that you change the Socket message to use a terminator character string, and make sure that the scale outputs one (almost every scale I have encountered does have a way to configure a termination character sequence). Fixed length messages are OK as long you always get the exact number of bytes in each message, any less and pco will buffer them, any more and PCo will take the first <length> bytes in the buffer to process and leave the rest in the buffer.

What triggers the scale to send you a weight message?

Check Connection setting is only to force PCo to check the connection (it is a client connecting to a TCP server) to try to reconnect if the connection is broken (i.e., scale is power cycled or network connection is interrupted). Since it is sending a NULL character, the scale should not respond to it.

Regards, Steve

janbuchmann
Contributor
0 Kudos

Hi Steve

I will try to follow your recommendation next week.

I set the scale to print mode and defined a print template containing only the weight. It is therefore hitting the print button that triggers sending the weight.

Thanks so far and have a great weekend!

Jan

former_member196557
Active Contributor
0 Kudos

Hi Jan,

One other thing to set: Change the Notification Trigger to While True, and use the expression editor to add the expression

stringlength(<subscription tag>)>0;

This will always trigger the notification when a non-zero-length tag string tag value is received.

Regards, Steve

janbuchmann
Contributor
0 Kudos

Hi Steve

You are a star! I've followed your recommendation, added a line feed on the scale and used \0A as a terminator. The socket agent then received messages, but for some reason two: one with the actual weight as on my screenshot and an empty one. Which lead to notifications with empty values. I then followed your second recommendation and added above expression to the notification trigger, but that also didn't help. Only when I changed the deadband > 0.0, I got the expected results: the simulator created the XML and even my webservice got called with populated values.

Thank you so much for your help!

Have a great weekend!

Regards

Jan

Answers (0)