ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » parsing multi ref soap using esql

Post new topic  Reply to topic
 parsing multi ref soap using esql « View previous topic :: View next topic » 
Author Message
nemo101
PostPosted: Sat Jul 07, 2007 6:12 am    Post subject: parsing multi ref soap using esql Reply with quote

Newbie

Joined: 06 Jul 2007
Posts: 9

hey guys can u please help me
i'm receiving a message with mutli ref fields in it
i'm not able to parse it or get the values from the fields

the input message is :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Body>
- <ns1:getAccountListResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:MTC_IN">
<getAccountListReturn href="#id0" />
</ns1:getAccountListResponse>
- <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:InPrecheckResponse" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="urn:MTC_IN">
<wsStatusProcess href="#id1" />
<accountId href="#id2" />
<accountType href="#id3" />
<authoAmount href="#id4" />
<balModDate href="#id5" />
<balance href="#id6" />
<currency xsi:type="soapenc:string" xsi:nil="true" />
<executionStatus href="#id7" />
<expiryDate href="#id8" />
<ownerId xsi:type="soapenc:string">9006559</ownerId>
<transactionId xsi:type="soapenc:string">000000000000000000</transactionId>
<transparentData xsi:type="soapenc:string">0</transparentData>
</multiRef>
<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">200</multiRef>
<multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:long" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0g/">0</multiRef>
<multiRef id="id3" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef>
<multiRef id="id4" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:long" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef>
<multiRef id="id5" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:long" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef>
<multiRef id="id8" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:long" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef>
<multiRef id="id6" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:long" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef>
<multiRef id="id7" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">6</multiRef>
</soapenv:Body>
</soapenv:Envelope>


i wana it to be some thing like :

<ns:getAccountListResponse xmlns:ns="urn:MTC_IN">
- <getAccountListReturn xsi:type="ns:InPrecheckResponse">
<wsStatusProcess xsi:type="xsd:int">0</wsStatusProcess>
<accountId xsi:type="xsd:long">12</accountId>
<accountType xsi:type="xsd:int">0</accountType>
<authoAmount xsi:type="xsd:long">0</authoAmount>
<balModDate xsi:type="xsd:long">0</balModDate>
<balance xsi:type="xsd:long">12</balance>
<currency xsi:nil="true" />
<executionStatus xsi:type="xsd:int">0</executionStatus>
<expiryDate xsi:type="xsd:long">0</expiryDate>
<ownerId xsi:nil="true" />
<transactionId xsi:nil="true" />
<transparentData xsi:nil="true" />
</getAccountListReturn>
</ns:getAccountListResponse>
Back to top
View user's profile Send private message
Vitor
PostPosted: Sat Jul 07, 2007 6:50 am    Post subject: Re: parsing multi ref soap using esql Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

nemo101 wrote:

i'm not able to parse it or get the values from the fields


What happens when you try? Error codes, messages, arrested by the FBI, what?

We need some clues here if we're going to help.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
wbi_telecom
PostPosted: Mon Jul 09, 2007 6:58 am    Post subject: Reply with quote

Disciple

Joined: 15 Feb 2006
Posts: 188
Location: Harrisburg, PA

Are you declaring the namespaces and using them in your references? MOst of the times the error is in defining the reference in case of namespace aware messages. If you cna share the esql you have written you will be helped quickly.

Cheers,
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Jul 09, 2007 12:42 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I think nemo101 wants the WMB XML parser to automatically link
Code:
 <wsStatusProcess href="#id1" />
with
Code:
 <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">200</multiRef>
to produce a message tree containing the parsed version of
Code:
 <wsStatusProcess xsi:type="xsd:int">200</wsStatusProcess>
by matching the href attribute values with the id attribute values.

None of the WMB XML parsers can do this trick, but it is straightforward to write some ESQL ( or XPath, if in a Java Compute node ) to do the job.
Back to top
View user's profile Send private message
nemo101
PostPosted: Mon Jul 09, 2007 10:46 pm    Post subject: Reply with quote

Newbie

Joined: 06 Jul 2007
Posts: 9

Kimbert you got this right thank you for your support

my ESQL to parse this (href - multiref) standard was :

Code:

SET OutputRoot = InputRoot;
      /*
      Parse Input Message if Multi Ref
      I/p = XMLNSC.null1:getAccountListResponse
      O/p = XMLNSC.null1:getAccountListResponse -Well Formated-
      */
      DECLARE I INTEGER 1;
      DECLARE J INTEGER;
   
      SET OutputRoot.XMLNS.null1:getAccountListResponse.null1:getAccountListReturn = InputRoot.XMLNSC.null1:getAccountListResponse.multiRef[1];
      SET J = CARDINALITY(OutputRoot.XMLNS.null1:getAccountListResponse.null1:getAccountListReturn.*[] );
   
      DECLARE temphref character;
      DECLARE tempval CHARACTER;
      
      WHILE I <= J DO
         
         IF (OutputRoot.XMLNS.null1:getAccountListResponse.null1:getAccountListReturn.*[I].href is NOT null ) THEN
            set temphref =  SUBSTRING( OutputRoot.XMLNS.null1:getAccountListResponse.null1:getAccountListReturn.*[I].href FROM 2) ;
            
         call Get_Multi_Ref( temphref , OutputRoot.XMLNSC.null1:getAccountListResponse , tempval );
         
         set OutputRoot.XMLNS.null1:getAccountListResponse.null1:getAccountListReturn.*[I]  = tempval;
         set OutputRoot.XMLNS.null1:getAccountListResponse.null1:getAccountListReturn.*[I].href = null ;       
         
         END IF;

         SET I = I + 1;
      END WHILE;
      
      -- XMLNS Worked only as a temp variable
      set OutputRoot.XMLNSC = null;
      set OutputRoot.XMLNSC = OutputRoot.XMLNS;
      set OutputRoot.XMLNS = null;      



and the code for the procedure Get_Multi_Ref is :
Code:

CREATE PROCEDURE  Get_Multi_Ref
                    ( IN href CHARACTER,
                     IN InBody REFERENCE ,
                     out fValue CHARACTER  )
   BEGIN
      DECLARE I INTEGER 1;
      DECLARE J INTEGER;
      
      SET J = CARDINALITY ( InBody.multiRef[] );
      
      while I <= J DO
         if (InBody.multiRef[I].id = href ) THEN
            SET fValue = FIELDVALUE(InBody.multiRef[I]) ;
            SET I = J ; -- Exit the loop
         END IF;   
         SET I = I +1;
      END While  ;
      
   END;


i extracted the envelope my self by esql, You know what the version 6.2 node soap extract is generating exceptions when supplied with a message with a multiref portion.



this code working fine for now but as you can see it's not generic and with every different message i'll have to change it again
i was wondering if there is a generic way to parse this href-multiref portion ?


thank you all for your support.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Jul 10, 2007 12:34 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I'm not going to write your ESQL for you, but I've got a couple of suggestions:
- Copying OutputRoot.XMLNS to OutputRoot.XMLNSC is both weird and dangerous. I don't know why you are doing it, but I suggest that you find an alternative solution.
- You rarely need to write a counted loop in ESQL. References do a better job, and are more elegant.
- Get_Multi_Ref will do the job, but it will not perform very well. You could replace the entire procedure with a single SELECT statement.
Back to top
View user's profile Send private message
nemo101
PostPosted: Tue Jul 10, 2007 3:41 am    Post subject: Reply with quote

Newbie

Joined: 06 Jul 2007
Posts: 9

thanks kimbert although i wasn't asking for you to rewrite my esql
i was looking only for guide lines like those you provided

thanks boss for your suggestions
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » parsing multi ref soap using esql
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.