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 » Validating SOAP body using Message Set

Post new topic  Reply to topic Goto page 1, 2  Next
 Validating SOAP body using Message Set « View previous topic :: View next topic » 
Author Message
ayanc
PostPosted: Mon Mar 24, 2008 7:18 am    Post subject: Validating SOAP body using Message Set Reply with quote

Voyager

Joined: 15 Nov 2004
Posts: 88

Hi,

My Flow structure is:

HttpInput -> Trace -> Compute -> Trace -> MQOutput

I have defined a message set and modified the SOAP Body. I have imported my message body structure defined under the same message set project but under a different namespace. Under wildcard composition "message" of the soap body I have added the input message.

My HTTP Input node setting is pointing to envelope and validation is set to content and value.

However if I send a message with different tag name, I am not seeing any errors. How can I ensure that the correct message is allowed through?

This is in MB 6.0 CSD 03.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Mar 24, 2008 10:47 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Have you enabled validation in your message flow?
Back to top
View user's profile Send private message
ayanc
PostPosted: Mon Mar 24, 2008 8:26 pm    Post subject: Reply with quote

Voyager

Joined: 15 Nov 2004
Posts: 88

I have set the validation option in input node to "Content and Value" and failure action is set as "Exception". However the parse timing is on demand.

Is there anything specific you want me to try.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Mar 25, 2008 5:03 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Set Parse Timing to 'Complete' and see whether you get an exception.
If not, then this is a known defect in v6. The symptom is that everything under the root tag gets validated, but not the root tag itself. So an unrecognised root tag can contain any content you like, and you won't get a validation error.
The defect has been fixed in v6.1. May be worth noting that if you were on v6.1 you would probably be using the SOAP domain, not MRM. And that would give you proper standards-compliant schema validation.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Mar 25, 2008 5:07 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

kimbert wrote:
Set Parse Timing to 'Complete' and see whether you get an exception.
If not, then this is a known defect in v6. The symptom is that everything under the root tag gets validated, but not the root tag itself. So an unrecognised root tag can contain any content you like, and you won't get a validation error.


I don't think ayanc is trying to validate the message after a SOAPExtract node so this is a SOAP message, and the root tag is going to be Envelope, right?

and ayanc has configured the model itself to contain a full message tree under Body... So the root tag should not be 'unrecognized'.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
ayanc
PostPosted: Tue Mar 25, 2008 5:52 am    Post subject: Reply with quote

Voyager

Joined: 15 Nov 2004
Posts: 88

Jeff,

You are right. The input message is a SOAP message. No SOAPExtract nodes have been used. Let me explain with more detail:

Input message:

<?xml version="1.0"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope">
<env:Body>
<ws:Book xmlns:ws="http://www.johnsoncontrols.com/http">
<ws:Title>Huckleberry Finn</ws:Title>
<ws:Author>Mark Twain</ws:Author>
<ws:Publisher>Penguin</ws:Publisher>
</ws:Book>
</env:Body>
</env:Envelope>


Flow Structure is:
HttpInput -> Trace -> Compute -> Trace -> MQOutput

Data from first Trace node:

(0x01000000):Properties = (
(0x03000000):MessageSet = 'M0D9IHS002001'
(0x03000000):MessageType = 'Envelope'
(0x03000000):MessageFormat = 'XML1'
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 1208
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2008-03-24 14:27:48.906'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'SOAP-HTTP'
(0x03000000):Topic = NULL
(0x03000000):ContentType = 'application/x-www-form-urlencoded'
)
(0x01000000):HTTPInputHeader = (
(0x03000000):X-Original-HTTP-Command = 'POST http://LOCALHOST/Incoming/Books HTTP/1.0'
(0x03000000):Accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, */*'
(0x03000000):Accept-Language = 'en-us'
(0x03000000):Accept-Encoding = 'gzip, deflate'
(0x03000000):User-Agent = 'Mozilla/4.0'
(0x03000000):Content-Length = '329'
(0x03000000):Host = 'LOCALHOST'
(0x03000000):Content-Type = 'application/x-www-form-urlencoded'
)
(0x01000015):MRM = (
(0x01000015)http://schemas.xmlsoap.org/soap/envelope:Body = (
(0x01000015)http://www.johnsoncontrols.com/http:Book = (
(0x03000015)http://www.johnsoncontrols.com/http:Title = 'Huckleberry Finn'
(0x03000015)http://www.johnsoncontrols.com/http:Author = 'Mark Twain'
(0x03000015)http://www.johnsoncontrols.com/http:Publisher = 'Penguin'
)
)
)
)


My message set structure is defined as follows:

Two message definition files have been used:

1. SOAP message (Imported from IBM Supplied messages soapenv11.mxsd)

2. Soap Body message - Namespace used: http://www.johnsoncontrols.com/http

The soap body message contains two messages one for input (HttpInputMsg) and one for output (HttpOutputMsg). A message category file has been created accordingly.

I have modified the soapenv11.mxsd as follows:

Original:
soapenv:body -> sequence -> message

Modified:
soapenv:body -> sequence -> message -> ws:HttpInputMsg

Basically I have imported the mxsd definition in the soap message structure and added the input message under the wildcard composition "message".


Now if I change the input data element like "<Title>" replaced with some other name say "<Toast>" the message is not failing.

I am not sure if I made done something wrong in modelling the structure. However my objective is that the soap body must be a valid body as defined in the message set.

I would be grateful if you could let me know what is the correct way to model my message set and flow to achieve this.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Mar 25, 2008 10:40 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

There's an easy way to check whether you are encountering the known defect. Just introduce some other fault ( temporarily change a tag name ) in the input message, at a deeper nesting level. If that causes a failure then it is the known defect.
Explanation : Whenever you use Composition=Message, you are ( in MRM parser terminology ) using a multipart message model. The MRM parser treats the embedded message as a new message, with its own root tag.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Mar 25, 2008 1:12 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I should also have said...if you want tighter validation in v6, you can change Composition=Message to Composition=Choice.
Back to top
View user's profile Send private message
ayanc
PostPosted: Wed Mar 26, 2008 5:52 am    Post subject: Reply with quote

Voyager

Joined: 15 Nov 2004
Posts: 88

Hi Kimbert,

I have modified the message set to include more elements and the structure is now as per the input message structure below:

<?xml version="1.0"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope">
<env:Body>
<ws:Book xmlns:ws="http://www.johnsoncontrols.com/http">
<ws:Title>Huckleberry Finn</ws:Title>
<ws:Author>Mark Twain</ws:Author>
<ws:Publisher>Penguin</ws:Publisher>
<ws:Price>
<ws:Currency>USD</ws:Currency>
<ws:Amount>15.23</ws:Amount>
</ws:Price>
</ws:Book>
</env:Body>
</env:Envelope>

I have modified the parse timing to complete. And instead of the above message i have completely removed the new section <ws:Price>. The min occurs is 1 for the element. However still no error occurs.

In addition I changed message composition to choice and tried again with no results.

So what I understand is that MB 6.0 does not provide any validation features as of now.

Assuming that there is indeed a validation feature in 6.0 - My idea about the envelope message is as follows:

the body structure should be modified as

soapenv:body -> sequence -> choice -> inputSoap
-> outputSoap

So my understanding is I am keeping a choice structure of both types of messages input and output under soap body. This would literally mean that during my input i shall be using the inputSoap message and my response would have the structure of outputSoap message.

Is my understanding correct? I believe this is a more of a conceptual question.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Mar 27, 2008 4:37 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

- Validation has been a well-established and widely used feature of WMB since v2.1.
- Your message model looks a little strange. Why have you defined a choice with only one member?
- The ws:price has minOccurs=1, but it is within a choice. That may mean that it will be treated as optional.
- If you want to trigger a validation error, just add a random tag as a sibling of ws:price. How about '<extraTag/>'.
- Your message model should look like this:
Code:
env:Envelope
    env:Header
    env:Body composition=choice
        message1
        message2
        message3
        ...
In other words, the SOAP body is modelled as a choice of root elements. You should get the validation you need if you do it this way.
If not, please take a user trace and check for warnings about self-defining elements in your message.
Back to top
View user's profile Send private message
ayanc
PostPosted: Thu Mar 27, 2008 5:05 am    Post subject: Reply with quote

Voyager

Joined: 15 Nov 2004
Posts: 88

Hi Kimbert,

I am sorry for my statement that has created a wrong impression... I did not intend to mean that MB does not provide validation at all. I was actually referring to the known defect that you were trying to explain.

The choice does not have only one message modelled. Rather it has two messages inputSoap and outputSoap. I do apologize for the poor representation again.

I am sure there is a gap in my understanding of how we should model these messages. That is precisely what I am trying to fill up.

Previously I was trying to validate using two methods:

1. Introducing an element that does not exist by renaming the element in the input message to something else.
2. Not sending mandatory segment in the input message.

Now I will also try out the following:

- Add extra tag under a complex element.

I shall let you know the results.
Back to top
View user's profile Send private message
ayanc
PostPosted: Mon Mar 31, 2008 1:57 am    Post subject: Reply with quote

Voyager

Joined: 15 Nov 2004
Posts: 88

Hi,

I provided the extra tag but again could not get it error out. As per your instruction I took out a trace of the flow.

Your guess is right: the message is being considered as self defining.

UserTrace BIP5493W: Message, element or attribute 'Envelope' is self-defining within parent ''.

These messages appear for all the elements and hence there seems to be no validation.

However I have defined the message set and assigned it to the HTTP Input node as well. This is evident from the trace of the message after passing the HTTPInput node

(
(0x01000000):Properties = (
(0x03000000):MessageSet = 'M0D9IHS002001'
(0x03000000):MessageType = 'Envelope'
(0x03000000):MessageFormat = 'XML1'
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 1208
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2008-03-31 09:28:03.653'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'SOAP-HTTP'
(0x03000000):Topic = NULL
(0x03000000):ContentType = 'application/x-www-form-urlencoded'
)
(0x01000000):HTTPInputHeader = (
(0x03000000):X-Original-HTTP-Command = 'POST http://LOCALHOST/Incoming/Books HTTP/1.0'
(0x03000000):Accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, */*'
(0x03000000):Accept-Language = 'en-us'
(0x03000000):Accept-Encoding = 'gzip, deflate'
(0x03000000):User-Agent = 'Mozilla/4.0'
(0x03000000):Content-Length = '410'
(0x03000000):Host = 'LOCALHOST'
(0x03000000):Content-Type = 'application/x-www-form-urlencoded'
)
(0x01000015):MRM = (
(0x01000015)http://schemas.xmlsoap.org/soap/envelope:Body = (
(0x01000015)http://www.johnsoncontrols.com/http:Book = (
(0x03000015)http://www.johnsoncontrols.com/http:Title = 'Huckleberry Finn'
(0x03000015)http://www.johnsoncontrols.com/http:Author = 'Mark Twain'
(0x03000015)http://www.johnsoncontrols.com/http:Publisher = 'Penguin'
(0x01000015)http://www.johnsoncontrols.com/http:Price = (
(0x03000015)http://www.johnsoncontrols.com/http:Currency = 'USD'
(0x03000015)http://www.johnsoncontrols.com/http:Amount = '15.23'
(0x03000015)http://www.johnsoncontrols.com/http:ExtraTag = 'Extras'
)
)
)
)


Can you guide me as to what I missed out? I think it is something very trivial but somehow it has missed my attention.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Mar 31, 2008 2:54 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Good - we're close to solving this. The problem is that the MRM parser cannot match the name/namespace of the XML root tag to a message definition in the specified message set.

My guess is that you have specified the wrong message set. If you set up a project reference from the message flow project to the message set project then you will be able to fill in the Message Set and Message Type by selecting from a combo box. Apologies if you already did that.
Back to top
View user's profile Send private message
ayanc
PostPosted: Tue Apr 01, 2008 7:20 am    Post subject: Reply with quote

Voyager

Joined: 15 Nov 2004
Posts: 88

Hi Kimbert,

Project referencing was already done and the message set was selected from the drop down.

I will create a fresh new message set project and start everything from scratch. Will let u know how it goes.

Is there any documentation available on this. Whatever I found was for v5. But not something that gave me a step by step guide to handle this case.
Back to top
View user's profile Send private message
ayanc
PostPosted: Wed Apr 02, 2008 12:46 am    Post subject: Reply with quote

Voyager

Joined: 15 Nov 2004
Posts: 88

Hi Kimbert,

Things are working fine now.

However it is quite embarassing to state that I had incorrectly assigned the namespace for the soap message. Actually I missed out the trailing "/" character from the following namespace:

"http://schemas.xmlsoap.org/soap/envelope/"

So everything became self defining and validation was not working. Your pointers to check for the warning messages in user trace really worked out.

Thanks for all your support.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Validating SOAP body using Message Set
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.