If you're trying to validate the input message part on the client, the question is where does the client get it?  If the part is generated by serializing a Java stub object that has been produced using WSDL2Java, presumably such an object should reflect (to whatever extent WSDL2Java-generated classes embody the constraints imposed by the schema) the schema's constraints.  Then you would only need validation of the serialized form as a test of the serializer or of the WSDL2Java code generation quality -- you would not need it in production.  If you did not need it in production, you could snarf up the serialized messages produced by your test inputs and run them through a separate validator (see the Xerces documentation).
 
If the encoding is literal and the input part is some random DOM Element produced by the client, you certainly might need to validate it either in the client or server.  One way you could do this is to produce a slightly altered serializer.  The serializer would look like whatever serializer is currently being used (possibly the ElementSerializer), but would run the Xerces parser on the serialized form first and throw an exception for invalid input.  The serializer for the part would make its own stream, serialize to that, validate, and then copy to the real serialization stream if there were no validation errors.  (I'm just guessing about this.)
 
To use Xerces 2 for validation, you have to set several features and properties, including a specification of the location of the schema.  See the Features, Properties and XML Schema how-to pages in the Xerces documents.
 
Jeff
----- Original Message -----
Sent: Friday, October 18, 2002 7:08 AM
Subject: RE: help - axis and schema validation

Can you suggest an alternative as to how I
can achieve this?
 
Naveen
 
 
-----Original Message-----
From: Tom Jordahl [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 18, 2002 10:03 AM
To: '[EMAIL PROTECTED]'
Subject: RE: help - axis and schema validation
Sensitivity: Confidential

 
Axis does not do this.
 

--
Tom Jordahl
Macromedia Server Development

-----Original Message-----
From: Naveen Srinivasa Murthy [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 18, 2002 10:00 AM
To: [EMAIL PROTECTED]
Subject: help - axis and schema validation
Importance: High
Sensitivity: Confidential


I want to know whether the Service and Call objects
provided by axis, can somehow do a schema validation
of a webservice input parameter before Webservice invocation.

consider this part of my wsdl

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost/axis/services/MyService/axis/services/MyService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost/axis/services/MyService/axis/services/MyService-impl" xmlns:intf="http://localhost/axis/services/MyService/axis/services/MyService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:esxsd="http://naveen.com/myxml.xsd"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <wsdl:message name="serviceMethodResponse">
    <wsdl:part name="return" type="xsd:string"/>
  </wsdl:message>
  <wsdl:message name="serviceMethodRequest">
    <wsdl:part name="arg" element="esxsd:ROOT"/>
    <wsdl:part name="arg2" type="xsd:string"/>


the input param 'arg' is supposed be an xml conforming

to the 'ROOT' element in the http://naveen.com/myxml.xsd schema.

 

I m calling my webservice using a Service and Call objects

and im providing the WSDL url to the Service obj during the WS

call. Is the Call object supposed to automatically validate

the input against http://naveen.com/myxml.xsd schema? If not can

I achieve this?

 

Please let me know...

 

thanks

Naveen

Reply via email to