| Author | 
		  Message
		 | 
		
		  | wmbv7newbie | 
		  
		    
			  
				 Posted: Thu Jul 24, 2014 7:17 am    Post subject: Validate Node - Reference Schema Issue | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 13 May 2014 Posts: 121
  
  | 
		  
		    
			  
				Hi,
 
 
I am trying to validate my outgoing message against a predefined schema i.e. xsd.
 
 
The xsd is in a library and the Application having the message flow with the Validate Node is referencing this library.
 
 
However, in the validate node properties, it is not showing this schema. It only shows list of referenced Message Sets.
 
 
Is there some limitation like this which I am not aware of?
 
 
I am using WMB 8.0.0.2
 
 
Thanks! | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Simbu | 
		  
		    
			  
				 Posted: Thu Jul 24, 2014 2:17 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Master
 
 Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India 
  | 
		  
		    
			  
				Since you are using Library it is not required to set the message model. it validates based on the root tag of the XML message.
 
 
   
	| Quote: | 
   
  
	| Leave blank to use XML schema in the Library | 
   
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | wmbv7newbie | 
		  
		    
			  
				 Posted: Fri Jul 25, 2014 3:09 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 13 May 2014 Posts: 121
  
  | 
		  
		    
			  
				Thanks! It works...    
 
 
Although I have another issue in the validation. A part of the schema definition is -
 
 
   
	| Code: | 
   
  
	<?xml version="1.0" encoding="UTF-8"?><xsd:schema targetNamespace="http://www.pearson.com/ESB/Interface/OasisOrderMgmt/v1.0.0/" xmlns:tns="http://www.pearson.com/ESB/Interface/OasisOrderMgmt/v1.0.0/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
 
 
    <xsd:complexType name="ShippingType">
 
       <xsd:sequence>
 
          <xsd:element maxOccurs="1" minOccurs="0" name="Name" type="xsd:string"/>
 
          <xsd:element maxOccurs="1" minOccurs="0" name="Type" type="xsd:string"/>
 
          <xsd:element maxOccurs="1" minOccurs="0" name="Amount" type="xsd:decimal" nillable="true"/>
 
          <xsd:element maxOccurs="1" minOccurs="0" name="Percentage" type="xsd:decimal" nillable="true"/>
 
       </xsd:sequence>
 
    </xsd:complexType>
 
 
 
    <xsd:complexType name="OasisQuoteType">
 
       <xsd:sequence>
 
          <xsd:element maxOccurs="1" minOccurs="1" name="OrderFormID" type="xsd:string"/>
 
          <xsd:element maxOccurs="1" minOccurs="1" name="OrderFormName" type="xsd:string"/>
 
          <xsd:element maxOccurs="1" minOccurs="0" name="OrderFormTitle" type="xsd:string"/>
 
          <xsd:element maxOccurs="1" minOccurs="0" name="QuoteExpirationDate" type="xsd:date"/>
 
          <xsd:element maxOccurs="unbounded" minOccurs="1" name="Accounts" type="tns:AccountType"/>
 
          <xsd:element maxOccurs="unbounded" minOccurs="0" name="Addresses" type="tns:AddressType"/>
 
          <xsd:element maxOccurs="unbounded" minOccurs="1" name="QuoteLines" type="tns:QuoteLineType"/>
 
          <xsd:element maxOccurs="unbounded" minOccurs="0" name="Shipping" type="tns:ShippingType"/>
 
       </xsd:sequence>
 
    </xsd:complexType>
 
 
    <xsd:element name="OasisQuote" type="tns:OasisQuoteType"/>
 
</xsd:schema>
 
 | 
   
 
 
And the below xml fails validation.
 
 
   
	| Code: | 
   
  
	XMLNSC   
 
   OasisQuote   
 
      OrderFormID   a0gK0000002GpYEIA0   
 
      OrderFormName   Abbeville Co School District   
 
      OrderFormTitle   ICOM-2087 Test Data   
 
      QuoteExpirationDate   2014-09-07   
 
      Accounts   
 
         Number   0002193478   
 
      Addresses   
 
         Name   Abbeville Co School District   
 
         AddressLine1   400 Greenville St   
 
         City   Abbeville   
 
         State   AK   
 
         Zipcode   29620-1749   
 
         Phone   (864) 366-5427   
 
      QuoteLines   
 
         BundleName   Reading Street   
 
         ISBN10   0328056952   
 
         SystemIndicator   S   
 
         QuantityCharge   1.0   
 
         DiscountPercent   0.0   
 
         ListPrice   45.97   
 
         ContractedPrice   45.97   
 
         NetPrice   45.97   
 
         ISBNSequence   1   
 
      QuoteLines   
 
         BundleName   Reading Street   
 
         ISBN10   0328118036   
 
         SystemIndicator   S   
 
         QuantityCharge   1.0   
 
         DiscountPercent   0.0   
 
         ListPrice   130.47   
 
         ContractedPrice   130.47   
 
         NetPrice   130.47   
 
         ISBNSequence   2   
 
      Shipping   
 
         Amount   
 
         Percentage   
 
      out   http://www.pearson.com/ESB/Interface/OasisOrderMgmt/v1.0.0/   
 
 
 | 
   
 
 
 
The error I get is -
 
   
	| Quote: | 
   
  
	Text:CHARACTER:A schema validation error has occurred while validating the message tree
 
							Insert
 
									Type:INTEGER:2
 
									Text:CHARACTER:6000
 
							Insert
 
									Type:INTEGER:2
 
									Text:CHARACTER:1
 
							Insert
 
									Type:INTEGER:2
 
									Text:CHARACTER:1
 
							Insert
 
									Type:INTEGER:2
 
									Text:CHARACTER:1202
 
							Insert
 
									Type:INTEGER:5
 
									Text:CHARACTER:cvc-datatype-valid.1.2: The value "" is not a valid value for the "decimal" datatype.
 
							Insert
 
									Type:INTEGER:5
 
									Text:CHARACTER:/Root/XMLNSC
 
 | 
   
 
 
 
I believe this is regarding the Amount and Percentage fields but since I have set nillable = true, I thought this would pass.
 
 
Any hints?
 
 
Thanks! | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Fri Jul 25, 2014 4:41 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				you have set nillable to true but the value of the fields in your tree does not appear to be null (an empty String is not the same as null), nor do you seem to have xsi:nil="true" set... 
 
Working as designed   _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | wmbv7newbie | 
		  
		    
			  
				 Posted: Fri Jul 25, 2014 4:55 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 13 May 2014 Posts: 121
  
  | 
		  
		    
			  
				I tried setting Amount and Percentage to NULL but that doesn't work too. I am sending 0 now instead of blank to make it work.
 
 
Can you please tell me where do I set the xsi:nil='"true". I tried adding xsd:nil="true" to the element definition but I guess I am wrong here. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Fri Jul 25, 2014 5:01 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				xsi:nil="true" is an attribute of the field...
 
 
so roughly
 
   
	| Code: | 
   
  
	CREATE LASTCHILD OF XX NAME 'Amount';
 
CREATE FIRSTCHILD OF Amount NAMESPACE xsi NAME 'nil' VALUE '"true"';
 
SET nil TYPE = (XMLNSC.Attribute);
 
 
or
 
 
SET XX.Amount.(XMLNSC.Attribute)xsi:nil = '"true"';
 
 
 | 
   
 
 
 
Have fun   _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | wmbv7newbie | 
		  
		    
			  
				 Posted: Fri Jul 25, 2014 6:58 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 13 May 2014 Posts: 121
  
  | 
		  
		    
			  
				Well, I have the output coming from the mapping node. After that I have the validate node in which the validation is against the xsd. So, there is no compute node to add esql.
 
 
I guess then I would have to add an extra attribute to the field in the xsd as well. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Sat Jul 26, 2014 1:58 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				
   
	| wmbv7newbie wrote: | 
   
  
	Well, I have the output coming from the mapping node. After that I have the validate node in which the validation is against the xsd. So, there is no compute node to add esql.
 
 
I guess then I would have to add an extra attribute to the field in the xsd as well. | 
   
 
 
In the xsd you just have to set the nillable attribute of the element to true.   _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Sat Jul 26, 2014 12:09 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	Well, I have the output coming from the mapping node. After that I have the validate node in which the validation is against the xsd. So, there is no compute node to add esql. 
 
I guess then I would have to add an extra attribute to the field in the xsd as well. | 
   
 
You are not allowed to declare the xsi:type attribute in an xsd. So it is not possible ( in IIB v9 ) to add an xsi:type attribute into the message tree using the Mapping node. Unless martinb wants to correct me on that.
 
You will have to add a Compute node after the Mapping node. Don't forget to declare the namespace constant 'xsi' and initialise it with the correct namespace URL. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | wmbv7newbie | 
		  
		    
			  
				 Posted: Wed Jul 30, 2014 4:52 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 13 May 2014 Posts: 121
  
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	| You are not allowed to declare the xsi:type attribute in an xsd. So it is not possible ( in IIB v9 ) to add an xsi:type attribute into the message tree using the Mapping node.  | 
   
 
 
 
Right. Coudnt do that. It was giving me errors.
 
 
   
	| Quote: | 
   
  
	| You will have to add a Compute node after the Mapping node. Don't forget to declare the namespace constant 'xsi' and initialise it with the correct namespace URL. | 
   
 
 
 
So, went with this way. Added a compute node and had the following code to set the nil attribute.
 
   
	| Code: | 
   
  
	DECLARE amount REFERENCE TO OutputRoot.XMLNSC.oas:OasisQuote.Shipping.Amount;
 
SET amount.(XMLNSC.Attribute)xsi:nil = 'true'; | 
   
 
 
 
However, the Validate node is still giving me error -
 
   
	| Quote: | 
   
  
	Text:CHARACTER:A schema validation error has occurred while validating the message tree
 
							Insert
 
									Type:INTEGER:2
 
									Text:CHARACTER:5002
 
							Insert
 
									Type:INTEGER:2
 
									Text:CHARACTER:2
 
							Insert
 
									Type:INTEGER:2
 
									Text:CHARACTER:1
 
							Insert
 
									Type:INTEGER:2
 
									Text:CHARACTER:2214
 
							Insert
 
									Type:INTEGER:5
 
									Text:CHARACTER:cvc-complex-type.2.1: The complex type of element "Amount" has a content type of 'empty'. The element must not have a value or any child elements.
 
							Insert
 
									Type:INTEGER:5
 
									Text:CHARACTER:/Root/XMLNSC | 
   
 
 
 
Because I am validating against the schema in the referenced library which doesn't have this attribute I guess.
 
 
Am I wrong somewhere here?    | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Wed Jul 30, 2014 5:10 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				Try and add
 
   
	| Code: | 
   
  
	| SET amount VALUE = NULL; | 
   
 
 
and see if that helps.   _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | wmbv7newbie | 
		  
		    
			  
				 Posted: Wed Jul 30, 2014 6:36 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 13 May 2014 Posts: 121
  
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	Code: 
 
SET amount VALUE = NULL; 
 
 | 
   
 
 
 
So, when I tested this, Amount had a value 0 to it and it wasn't NULL. So, I don't think this is regarding blank in Amount. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Wed Jul 30, 2014 7:57 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				Put a Trace node into your flow.
 
Extract the tiny portion of the trace output that shows 'Amount' and its content.
 
Paste it here.
 
 
But to avoid embarrassment, you may want to look at it yourself before posting in case there is something obviously wrong with the message tree. Like the xsi namespace being wrongly specified in your ESQL. Or a stray space in the content of 'Amount' making it non-empty. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | wmbv7newbie | 
		  
		    
			  
				 Posted: Thu Aug 07, 2014 4:03 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 13 May 2014 Posts: 121
  
  | 
		  
		    
			  
				Whenever I am setting the xsi:nil = true, I have to make sure this is only when Amount is not having a value.
 
 
If Amount is blank, then setting this attribute works fine.
 
 
Thanks for the guidance everyone! | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |