XML validation warning in UpsServices.upsRateInquire
----------------------------------------------------

                 Key: OFBIZ-244
                 URL: http://issues.apache.org/jira/browse/OFBIZ-244
             Project: OFBiz (The Open for Business Project)
          Issue Type: Bug
          Components: framework
            Reporter: Jacopo Cappellato
            Priority: Minor


Copied from an issue in the old server from Matt Kasubaski

I've hooked up the UPS service for ground, air, and next day, and I'm seeing an 
error being printed to system.err when the service is used.

Here's the error:

[Error] :1:54: cvc-elt.1: Cannot find the declaration of element 
'RatingServiceSelectionResponse'.
 

Here's what I've done so far looking into this to make sure it wasn't a change 
I made to my custom version:

 Updated my stock version of OfBiz to today's code (just in case there's been a 
change.)
 Modified shipment.properties for the UPS username/password so UPS will 
correctly respond.
 Modified the database table "product_store_shipment_meth" such that the UPS 
methods have a service_name of "upsRateEstimate".

 Started up Ofbiz while redirecting standard out to a file. (So I can see 
standard error better.)

To test:

 Place a large widget in the cart and proceeded to checkout.
 Once I navigated to the shipping screen, I would see the error. (One for each 
UPS service call.)

I spent some time digging into the code and think I found out why and the fix 
but would like confirmation that this really is the fix.

 
UpsServices.upsRateInquire calls Util.XML.readXmlDocument with the validate 
flag set to false.
However, UtilXML.readXmlDocument has some code which doesn't look right.

At line 220 or so, the code reads:

        factory.setValidating(validate);

        factory.setNamespaceAware(true);
        factory.setAttribute("http://xml.org/sax/features/validation";, 
Boolean.TRUE );
        
factory.setAttribute("http://apache.org/xml/features/validation/schema";, 
Boolean.TRUE );

 
>From what I've read about the two setAttribute values, they control XML 
>validation for the SaxParser. Since UPS doesn't have a DTD, it passes in false 
>and no DTD validation occurs because of the setValidating code. However, there 
>still is some validating going on since I am seeing error messages when both 
>are set to TRUE and no error messages when they're set to FALSE. (If 
>setValidating is set to true, a different error is displayed as one would 
>expect.)
 

Would this be the correct fix then, or is this turning off something that needs 
to be there?

        factory.setValidating(validate);

 

        factory.setNamespaceAware(true);

        factory.setAttribute("http://xml.org/sax/features/validation";, new 
Boolean(validate));

        
factory.setAttribute("http://apache.org/xml/features/validation/schema";, new 
Boolean(validate));

 
As a side note when I was playing around with different combinations of which 
of the two attributes were set to true vs false I seen some unexpected 
behavior. According to the xml apache site, 
http://xml.apache.org/xerces2-j/features.html#validation, if 
xml.org/sax/features/validation is false, then no validation is done, but what 
I was seeing was apache.org/xml/features/validation/schema has to be set to 
false for the error to disappear.

 
>From what I can see, everything works fine as far as getting the correct 
>results from UPS. I'm just trying to clean up errors that appear in the log.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to