|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Undefined functions porting to WBIMB 6.0.0.1 |
« View previous topic :: View next topic » |
Author |
Message
|
chrismm |
Posted: Wed Apr 19, 2006 7:15 am Post subject: Undefined functions porting to WBIMB 6.0.0.1 |
|
|
Newbie
Joined: 19 Apr 2006 Posts: 5
|
We have just upgraded to 6 from 5.1 and have come across the following strange problem, we have two methods in a common code esql file with one method calling the other, when the first method is called externally from within a node in our flow we get the error "BIP2558E: (b2b.swift.xml.common.BuildSwiftNetHeader, 80.7) : Undefined function '.archiveMessage'. " when we try to deploy.
Here is the (cut down code)
Firstly in file 'common_code.esql' :-
Code: |
BROKER SCHEMA b2b.swift.xml.common
CREATE PROCEDURE BuildSwiftNetHeader(IN InputRoot REFERENCE,IN OutputRoot REFERENCE,IN Environment REFERENCE)
BEGIN
...
-- Archive message
...
CALL archiveMessage(Environment.usr.B2B.Sender,
SenderMsgRef, 'Outbound', Environment.usr.B2B.MsgType,
Environment.usr.B2B.MsgRef,
OutputRoot.XMLNS);
END;
CREATE PROCEDURE archiveMessage(
IN Sender CHARACTER,
IN SenderMsgRef CHARACTER,
IN Direction CHARACTER,
IN MsgType CHARACTER,
IN uniqueID CHARACTER,
IN Msg REFERENCE )
BEGIN
...
-- Insert message into database.
INSERT INTO Database.db2mqsi.MSGEXCH_ARCHIVES( SENDER,SENDER_MSG_REF,DIRECTION,MSG_TYPE,MSGEXCH_UID,MSG)
VALUES(Sender,SenderMsgRef,Direction,MsgType,uid,archiveMsg);
END; |
This is called from a different module :-
Code: |
BROKER SCHEMA b2b.swift.xml.outbound
PATH b2b.swift.xml.common;
CREATE COMPUTE MODULE CheckDuplicateAndRouteMsgType
CREATE FUNCTION main() RETURNS BOOLEAN
BEGIN
-- CALL CopyMessageHeaders();
CALL CopyEntireMessage();
...
CALL BuildSwiftNetHeader( ORoot, IRoot, ERoot );
RETURN TRUE;
END; |
We have also tried calling the methods explicitly using the schema as a qualifier but with the same error.
Has anyone come across this or know what the solution is ? |
|
Back to top |
|
 |
JT |
Posted: Wed Apr 19, 2006 8:07 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Are you saying this worked in v5, but no longer works in v6? |
|
Back to top |
|
 |
chrismm |
Posted: Wed Apr 19, 2006 11:57 pm Post subject: |
|
|
Newbie
Joined: 19 Apr 2006 Posts: 5
|
Yes, this code worked fine in WBIMB 5 |
|
Back to top |
|
 |
chrismm |
Posted: Thu Apr 20, 2006 12:09 am Post subject: Complete code included. |
|
|
Newbie
Joined: 19 Apr 2006 Posts: 5
|
We now believe it has something to do with XML namespaces, here is the complete code :-
Code: |
CREATE PROCEDURE BuildSwiftNetHeader(IN InputRoot REFERENCE,IN OutputRoot REFERENCE,IN Environment REFERENCE)
BEGIN
-- Create the XML Parser before we use it
-- You should use LASTCHILD here.
CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNS';
SET OutputRoot.Properties.MessageFormat = 'XMLNS';
-- Add relevant header info as described in the
-- SwiftAlliance Gateway MQ Host Adapter Developer Guide.
SET OutputRoot.MQMD.Format = MQFMT_STRING;
SET OutputRoot.MQMD.MsgType = MQMT_REQUEST;
-- Set the Correlation ID as hex representation of 'FILXMLCLIENT'
SET OutputRoot.MQMD.CorrelId = CAST(x'46494C584D4C434C49454E54202020202020202020202020' AS BLOB);
DECLARE OutboundQueue CHARACTER;
SET OutputRoot.MQMD.ReplyToQ = 'SWF.XML.CLIENT.RESPONSE';
-- Leave the ReplyToQMgr blank,this should force
-- the local queue manager to put its name in there.
SET OutputRoot.MQMD.ReplyToQMgr ='';
-- Set the Version within the XML Declaration
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML.Version) = '1.0';
-- Set the Encoding within the XML Declaration
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML."Encoding") = 'UTF-8';
-- Add the SWIFTnet header components
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwSec:AuthorisationContext"."SwSec:UserDN" = TRIM(Environment.usr.B2B.GFAS_Environment.USERDN);
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestControl"."SwInt:RequestCrypto" = 'TRUE';
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestControl"."SwInt:NRIndicator" = 'TRUE';
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestControl"."SwInt:DeliveryCtrl"."SwInt:DeliveryMode" = 'SnF';
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestControl"."SwInt:DeliveryCtrl"."SwInt:NotifQueue" = 'fidigb2l_ifiadelnotif!p';
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestControl"."SwInt:DeliveryCtrl"."Sw:DeliveryNotif" = 'FALSE';
-- Add the SWIFTnet Requestheader components
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestHeader"."SwInt:Requestor" = TRIM(Environment.usr.B2B.GFAS_Environment.REQUESTOR);
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestHeader"."SwInt:Responder" = TRIM(Environment.usr.B2B.GFAS_Environment.Responder);
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestHeader"."SwInt:Service" = TRIM(Environment.usr.B2B.GFAS_Environment.SERVICE);
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestHeader"."SwInt:RequestType" = Environment.usr.B2B.MsgType;
-- Add the SWIFTnet Application header components including the current timestamp which needs to be
-- reformatted for SWIFT
DECLARE WF3_Time TIMESTAMP CURRENT_TIMESTAMP;
DECLARE Time_Format CHARACTER SUBSTRING(CAST(WF3_Time AS CHARACTER) FROM 12 FOR 10) || 'T' ||
SUBSTRING(CAST(WF3_Time AS CHARACTER) FROM 23 FOR 8) || '+00:00';
DECLARE hdr NAMESPACE 'urn:swift:xsd:$ahV10';
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestPayload".hdr:AppHdr.(XML.NamespaceDecl)xmlns = 'urn:swift:xsd:$ahV10';
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestPayload".hdr:AppHdr.hdr:MsgRef = Environment.usr.B2B.MsgRef;
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestPayload".hdr:AppHdr.hdr:CrDate = Time_Format;
-- Add in the crypto block.
DECLARE USERDN CHARACTER TRIM(Environment.usr.B2B.GFAS_Environment.USERDN);
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwSec:Crypto"."SwSec:CryptoControl"."SwSec:MemberRef"[1] = 'RequestPayload';
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwSec:Crypto"."SwSec:CryptoControl"."SwSec:MemberRef"[2] = 'RequestHeader';
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwSec:Crypto"."SwSec:CryptoControl"."SwSec:SignDN" = USERDN;
DECLARE MsgType CHARACTER Environment.usr.B2B.MsgType;
DECLARE NSDeclaration CHARACTER 'urn:swift:xsd:swift.if.ia$' || MsgType;
DECLARE Doc NAMESPACE NSDeclaration;
-- Add the actual application payload.
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestPayload".Doc:Document.(XML.NamespaceDecl)xmlns = Doc;
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestPayload".Doc:Document.Doc:{MsgType} = InputRoot.XMLNS.Doc:{MsgType};
-- Archive message
DECLARE SenderMsgRef CHARACTER;
IF Environment.usr.B2B.SenderMsgRef IS NOT NULL THEN
SET SenderMsgRef = Environment.usr.B2B.SenderMsgRef;
ELSE
SET SenderMsgRef = '';
END IF;
CALL archiveMessage(
Environment.usr.B2B.Sender,
SenderMsgRef,
'Outbound',
Environment.usr.B2B.MsgType,
Environment.usr.B2B.MsgRef,
OutputRoot.XMLNS);
END;
------------------------------------------------------------------------------------------------------------
-- AUTHOR: Abdul Kateregga
--
-- DATE: 21 June 2005
--
-- DESCRIPTION:
-- Procedure to archive messages to database.
--
--------------------------------------------------------------------------------------------------------------
CREATE PROCEDURE archiveMessage(
IN Sender CHARACTER,
IN SenderMsgRef CHARACTER,
IN Direction CHARACTER,
IN MsgType CHARACTER,
IN uniqueID CHARACTER,
IN Msg REFERENCE )
BEGIN
-- Make unique id and Integer
DECLARE uid INTEGER CAST( uniqueID AS INTEGER);
-- Make sure the msg is a blob.
DECLARE archiveMsg BLOB BITSTREAM( Msg );
-- Defensive code in case somebody sends us in a totally garbage message.
IF Sender is NULL THEN
SET Sender = 'Unknown';
END IF;
IF SenderMsgRef IS NULL THEN
SET SenderMsgRef = 'No Reference';
END IF;
IF MsgType IS NULL THEN
SET MsgType = 'Unknown';
END IF;
IF uid IS NULL THEN
SET uid = 9999999;
END IF;
-- Insert message into database.
INSERT INTO Database.db2mqsi.MSGEXCH_ARCHIVES( SENDER,SENDER_MSG_REF,DIRECTION,MSG_TYPE,MSGEXCH_UID,MSG)
VALUES(Sender,SenderMsgRef,Direction,MsgType,uid,archiveMsg);
END; |
|
|
Back to top |
|
 |
chrismm |
Posted: Thu Apr 20, 2006 1:21 am Post subject: caused by these lines, but what is the solution ?? |
|
|
Newbie
Joined: 19 Apr 2006 Posts: 5
|
We have now found if you comment out the following lines in the method BuildSwiftnetHeader, the error goes away ?? (but obviously the code is now incomplete )
Code: |
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestPayload".Doc:Document.(XML.NamespaceDecl)xmlns = Doc;
SET OutputRoot.XMLNS."SwInt:ExchangeRequest"."SwInt:Request"."SwInt:RequestPayload".Doc:Document.Doc:{MsgType} = InputRoot.XMLNS.Doc:{MsgType}; |
|
|
Back to top |
|
 |
JT |
Posted: Thu Apr 20, 2006 7:38 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Hmmm.........it also may be no small coincidence that it's the only reference in your code to the InputRoot tree. |
|
Back to top |
|
 |
chrismm |
Posted: Thu Apr 20, 2006 8:02 am Post subject: The Solution. |
|
|
Newbie
Joined: 19 Apr 2006 Posts: 5
|
The rather bizarre behaviour we have seen actualy boils down to the fact that NAMESPACE cannot be initialized with a variable like this :-
Code: |
DECLARE NSDeclaration CHARACTER 'urn:swift:xsd:swift.if.ia$' || MsgType;
DECLARE Doc NAMESPACE NSDeclaration;
|
unfortunately this is just what we need as the MsgType varies for each message. Luckily you are allowed to use a CONST CHARACTER string in place of a name space.
ie
Code: |
DECLARE Doc CONSTANT CHARACTER 'urn:swift:xsd:swift.if.ia$' || MsgType; |
|
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 20, 2006 8:36 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You can't just use variable names to access the contents like that.
Code: |
Declare Doc NAMESPACE {NSDeclaration}; |
might work - at least in version 6. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|