Re: [AXIS2 1.4.1 - Xmlbeans] validating an input parameter with anyType in it

2009-09-08 Thread Michel Etienne

Hello,

I don't understand your suggestion;
the only types fo any are xs:anyType or xs:anySimpleType , where do you 
suggests to use Any ?


Thanks

Martin Kidby a écrit :



Hi.

I may be wide of the mark, but whilst I was researching my problem, I 
saw an article similar to your problem that suggested the use of 'Any' 
rather than 'AnyType'


Hope it helps you.


-Original Message-
From: Michel Etienne [mailto:michel.etie...@dryade.net]
Sent: 03 September 2009 15:47
To: axis-user@ws.apache.org; axis-...@ws.apache.org 
mailto:axis-...@ws.apache.org
Subject: Re: [AXIS2 1.4.1 - Xmlbeans] validating an input parameter 
with anyType in it


Hello

Since I had no answer yet, I repost my question .
Does anybody have an idea ?
Thanks

Best regards
Michel Etienne


Michel Etienne a écrit :
 Hello,
 I have a problem when I try to validate an input parameter with an
 AnyType member

 I use Xmlbeans and I get this error on the server side (I made a
 sample program to show the problem)

 2009-07-06 16:23:16,109 [HttpConnection-8080-1]
 WARN Server -  Invalid object
 demo.dryade.soap.impl.RequestDocumentImpl
  error: cvc-elt.4.2: Invalid xsi:type qname: 'typ:SpecificType' in
 element RequestPart
 2009-07-06 16:23:16,125 [HttpConnection-8080-1]
 WARN Server - Invalid content =
 soap:Request xmlns:soap=http://soap.dryade.demo;
 xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;
 RequestPart
 typ:element6 xmlns:typ=http://types.dryade.demo;1/typ:element6
 typ:element7 xmlns:typ=http://types.dryade.demo;test/typ:element7
 typ:element8 xsi:type=typ:SpecificType
 xmlns:typ=http://types.dryade.demo;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 typ:element4true/typ:element4
 typ:element5any test/typ:element5
 /typ:element8
 /RequestPart
 /soap:Request

 if the server produce an output with the same AnyType , it validate
 correctly :
 in an input-output transaction

 2009-07-06 16:23:16,125 [HttpConnection-8080-1] INFO Server - 
 Valid object demo.dryade.soap.impl.RequestResponseDocumentImpl

 in an ouput-only transaction

 2009-07-06 16:23:16,250 [HttpConnection-8080-2] INFO Server - 
 Valid object demo.dryade.soap.impl.NotifyDocumentImpl

 on the client side, the structures are always valid.

 I send you the entire code I used for this exemple; it is made with
 AXIS2 1.4.1 on Windows XP platform with Java 1.6

 (I can send the entire project archive if necessary)

 Thanks for help

 Best regards
 Michel Etienne


Cambridge Online Systems Ltd is registered in England and Wales with 
company number 1381717
Registered office: 163 Cambridge Science Park, Milton Road Cambridge 
CB4 0GP


Disclaimer:
The contents of this e-mail are intended for the named addressee only. 
It contains information which may be confidential and which may also 
be privileged. Unless you are the named addressee (or authorised to 
receive for the addressee) you may not copy or use it, or disclose it 
to anyone else.
If you received it in error please notify us immediately and then 
destroy it.

_
Cambridge Online Latest News:

Please visit our Website at http://www.cambridgeonline.net 
http://www.cambridgeonline.net/





Ce message entrant est certifié sans virus connu.
Analyse effectuée par AVG - www.avg.fr 
Version: 8.5.409 / Base de données virale: 270.13.76/2342 - Date: 09/02/09 18:03:00






RE: [AXIS2 1.4.1 - Xmlbeans] validating an input parameter with anyType in it

2009-09-03 Thread Martin Kidby
Hi.

I may be wide of the mark, but whilst I was researching my problem, I saw an 
article similar to your problem that suggested the use of 'Any' rather than 
'AnyType'

Hope it helps you.


-Original Message-
From: Michel Etienne [mailto:michel.etie...@dryade.net] 
Sent: 03 September 2009 15:47
To: axis-user@ws.apache.org; axis-...@ws.apache.org
Subject: Re: [AXIS2 1.4.1 - Xmlbeans] validating an input parameter with 
anyType in it

Hello

Since I had no answer yet, I repost my question .
Does anybody have an idea ?
Thanks

Best regards
Michel Etienne


Michel Etienne a écrit :
 Hello,
 I have a problem when I try to validate an input parameter with an 
 AnyType member

 I use Xmlbeans and I get this error on the server side (I made a 
 sample program to show the problem)

 2009-07-06 16:23:16,109 [HttpConnection-8080-1]  
 WARNServer -  Invalid object 
 demo.dryade.soap.impl.RequestDocumentImpl
  error: cvc-elt.4.2: Invalid xsi:type qname: 'typ:SpecificType' in 
 element RequestPart
 2009-07-06 16:23:16,125 [HttpConnection-8080-1]  
 WARNServer - Invalid content =
 soap:Request xmlns:soap=http://soap.dryade.demo; 
 xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;
  RequestPart
typ:element6 xmlns:typ=http://types.dryade.demo;1/typ:element6
typ:element7 xmlns:typ=http://types.dryade.demo;test/typ:element7
typ:element8 xsi:type=typ:SpecificType 
 xmlns:typ=http://types.dryade.demo; 
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
  typ:element4true/typ:element4
  typ:element5any test/typ:element5
/typ:element8
  /RequestPart
 /soap:Request

 if the server produce an output with the same AnyType , it validate 
 correctly :
 in an input-output transaction

 2009-07-06 16:23:16,125 [HttpConnection-8080-1]  INFO Server -  
 Valid object demo.dryade.soap.impl.RequestResponseDocumentImpl

 in an ouput-only transaction

 2009-07-06 16:23:16,250 [HttpConnection-8080-2]  INFO Server -  
 Valid object demo.dryade.soap.impl.NotifyDocumentImpl

 on the client side, the structures are always valid.

 I send you the entire code I used for this exemple; it is made with 
 AXIS2 1.4.1 on Windows XP platform with Java 1.6

 (I can send the entire project archive if necessary)

 Thanks for help

 Best regards
 Michel Etienne

Cambridge Online Systems Ltd is registered in England and Wales with company 
number 1381717
Registered office: 163 Cambridge Science Park, Milton Road Cambridge CB4 0GP

Disclaimer:
The contents of this e-mail are intended for the named addressee only. It 
contains information which may be confidential and which may also be privileged.
Unless you are the named addressee (or authorised to receive for the addressee) 
you may not copy or use it, or disclose it to anyone else.
If you received it in error please notify us immediately and then destroy it.
_
Cambridge Online Latest News:

Please visit our Website at http://www.cambridgeonline.net 

[AXIS2 1.4.1 - Xmlbeans] validating an input parameter with anyType in it

2009-07-07 Thread Michel Etienne

Hello,
I have a problem when I try to validate an input parameter with an 
AnyType member


I use Xmlbeans and I get this error on the server side (I made a sample 
program to show the problem)


2009-07-06 16:23:16,109 [HttpConnection-8080-1]  WARN
Server -  Invalid object demo.dryade.soap.impl.RequestDocumentImpl
 error: cvc-elt.4.2: Invalid xsi:type qname: 'typ:SpecificType' in 
element RequestPart
2009-07-06 16:23:16,125 [HttpConnection-8080-1]  WARN
Server - Invalid content =
soap:Request xmlns:soap=http://soap.dryade.demo; 
xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;

 RequestPart
   typ:element6 xmlns:typ=http://types.dryade.demo;1/typ:element6
   typ:element7 xmlns:typ=http://types.dryade.demo;test/typ:element7
   typ:element8 xsi:type=typ:SpecificType 
xmlns:typ=http://types.dryade.demo; 
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

 typ:element4true/typ:element4
 typ:element5any test/typ:element5
   /typ:element8
 /RequestPart
/soap:Request

if the server produce an output with the same AnyType , it validate 
correctly :

in an input-output transaction

2009-07-06 16:23:16,125 [HttpConnection-8080-1]  INFO Server -  Valid object 
demo.dryade.soap.impl.RequestResponseDocumentImpl

in an ouput-only transaction

2009-07-06 16:23:16,250 [HttpConnection-8080-2]  INFO Server -  Valid object 
demo.dryade.soap.impl.NotifyDocumentImpl

on the client side, the structures are always valid.

I send you the entire code I used for this exemple; it is made with 
AXIS2 1.4.1 on Windows XP platform with Java 1.6


(I can send the entire project archive if necessary)

Thanks for help

Best regards
Michel Etienne

Server source :

package demo.server;

import org.apache.log4j.Logger;

import java.util.ArrayList;

import javax.xml.namespace.QName;

import org.apache.xmlbeans.SchemaType;
import org.apache.xmlbeans.XmlBeans;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.XmlValidationError;
import org.apache.xmlbeans.impl.common.QNameHelper;

import demo.dryade.soap.DemoServicesSkeletonInterface;
import demo.dryade.soap.NotifyDocument;
import demo.dryade.soap.RequestDocument;
import demo.dryade.soap.RequestResponseDocument;
import demo.dryade.soap.RequestResponseDocument.RequestResponse;
import demo.dryade.types.ComplexType1;
import demo.dryade.types.SpecificType;

public class Server implements DemoServicesSkeletonInterface
{
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(Server.class);

public static boolean checkXmlSchema(XmlObject object)
{
if (object == null)
{
logger.warn(validation null object);
return false;
}
ArrayListXmlValidationError validationErrors = new 
ArrayListXmlValidationError();

XmlOptions validationOptions = new XmlOptions();
validationOptions.setErrorListener(validationErrors);

boolean validation = object.validate(validationOptions);
if (!validation)
{
StringBuffer errorTxt = new StringBuffer( Invalid object 
+object.getClass().getName());

for (XmlValidationError error : validationErrors)
{
errorTxt.append(\n  );
errorTxt.append(error.toString());
}
logger.warn(errorTxt);
logger.warn(Invalid content = \n+object.toString());

}
else
{
logger.info( Valid object +object.getClass().getName());
}
return validation;
}



@Override
public RequestResponseDocument Request(RequestDocument request)
{
checkXmlSchema(request);

RequestResponseDocument response = 
RequestResponseDocument.Factory.newInstance();

RequestResponse reqResponse = response.addNewRequestResponse();

ComplexType1 part = reqResponse.addNewResponsePart();

part.addElement1(12);
part.setElement2(test);

SpecificType elt3 = SpecificType.Factory.newInstance();
elt3.setElement4(true);
elt3.setElement5(any test);
part.setElement3(elt3);

checkXmlSchema(response);

return response;
}



@Override
public void Notify(NotifyDocument notify)
{
checkXmlSchema(notify);
}

}


Client Source :

package demo.client;


import java.math.BigInteger;
import java.util.ArrayList;

import org.apache.log4j.Logger;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.XmlValidationError;

import demo.dryade.soap.DemoServices;
import demo.dryade.soap.DemoServicesStub;
import demo.dryade.soap.NotifyDocument;
import demo.dryade.soap.RequestDocument;
import demo.dryade.soap.RequestResponseDocument;
import demo.dryade.soap.NotifyDocument.Notify;
import demo.dryade.soap.RequestDocument.Request;
import demo.dryade.types.ComplexType1;
import demo.dryade.types.ComplexType2;
import demo.dryade.types.SpecificType;

/**
* @author michel
*
*/
public class Client
{
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(Client.class);

public static boolean checkXmlSchema(XmlObject object)
{
if (object == null)
{
logger.warn(validation null object);
return false;
}
ArrayListXmlValidationError validationErrors = new