|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
JESS: Jess as Web ServiceHello, I'm trying to develop a Web Service under Tomcat
and axis using Java. I'm just beginning so I deployed a service with
the basic method "executeCommand". I've implemented a client which
invokes this method... Until here everything works fine, the problem
comes with the response via SOAP. Since the return value is a
jess.Value object and it's not directly serializable, I cannot get the
right answer at the client side (I receive a null object). I would
like to know how could I solve this problem, I tried this code:
Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL(endpointURL) ); call.setOperationName(new QName("urn:myJess","executeCommand")); call.addParameter( "arg1", XMLType.XSD_STRING, ParameterMode.IN); call.setReturnType( org.apache.axis.encoding.XMLType.XSD_ANYTYPE ); QName qname = new QName( "urn:myJess", "Value" ); call.registerTypeMapping(Value.class, qname, new org.apache.axis.encoding.ser.BeanSerializerFactory(Value.class, qname), new org.apache.axis.encoding.ser.BeanDeserializerFactory(Value.class, qname)); Value ret = (Value) call.invoke( new Object[] { textToSend } ); and I added this to the wsdd file <beanMapping qname="myNS:Value" xmlns:myNS="urn:myJess" languageSpecificType="java:jess.Value"/> </service> I think it doesn't work because jess.Value is not a Bean Class. Then, I also tried <typeMapping qname="typeNS:Value"but since all jess.Value attributes are declared private, I cannot compile the classes which implement serialization/deserialization of jess values. Thank you very much, I'd be very grateful if could get this problem fixed. Juan |
|
|
Re: JESS: Jess as Web ServiceA SOAP implementation that I use achieves a simplification of SOAP
development by having only one method which is exposed and that method is the same for any application so developed. The one parameter of that method is an array of (DOM) Elements and it returns an array of Elements. Because an Element can be the top node of a DOM tree any information is able to be passed in the SOAP message and the specification of methods is essentially eliminated. A control element is one of the elements in the Element Array to further define the requirements of the call and is generally analogous to the request which wraps the request parameters. Another control element is in the return array in which you can wrap return responses as converted to strings via DOM which SOAP converts to xml. Juan Ondiviela said the following on 4/10/2008 6:58 AM: > Hello, I'm trying to develop a Web Service under Tomcat and axis using > Java. I'm just beginning so I deployed a service with the basic method > "executeCommand". I've implemented a client which invokes this > method... Until here everything works fine, the problem comes with the > response via SOAP. Since the return value is a jess.Value object and > it's not directly serializable, I cannot get the right answer at the > client side (I receive a null object). I would like to know how could > I solve this problem, I tried this code: > > Service service = new Service(); > Call call = (Call) service.createCall(); > > call.setTargetEndpointAddress( new > java.net.URL(endpointURL) ); > call.setOperationName(new > QName("urn:myJess","executeCommand")); > call.addParameter( "arg1", XMLType.XSD_STRING, > ParameterMode.IN); > call.setReturnType( > org.apache.axis.encoding.XMLType.XSD_ANYTYPE ); > QName qname = new QName( "urn:myJess", "Value" ); > > call.registerTypeMapping(Value.class, qname, > new > org.apache.axis.encoding.ser.BeanSerializerFactory(Value.class, qname), > new > org.apache.axis.encoding.ser.BeanDeserializerFactory(Value.class, > qname)); > > Value ret = (Value) call.invoke( new Object[] { textToSend > } ); > > > and I added this to the wsdd file > > <beanMapping qname="myNS:Value" > xmlns:myNS="urn:myJess" > languageSpecificType="java:jess.Value"/> > </service> > I think it doesn't work because jess.Value is not a Bean Class. > > Then, I also tried > > <typeMapping qname="typeNS:Value" > > > xmlns:typeNS="urn:myJess" > languageSpecificType="java:" > serializer="ValueSerFactory" > deserializer="ValueDeserFactory" > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> > > > </service> > but since all jess.Value attributes are declared private, I cannot > compile the classes which implement serialization/deserialization of > jess values. > > > Thank you very much, I'd be very grateful if could get this problem fixed. > > Juan -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users you@...' in the BODY of a message to majordomo@..., NOT to the list (use your own address!) List problems? Notify owner-jess-users@.... -------------------------------------------------------------------- |
|
|
Re: JESS: Jess as Web ServiceHi Juan,
This is why I just don't get the whole "web services" thing. At some point, it was intended as a lighter, simpler, portable replacement for things like CORBA, DCOM, and RMI, but it's turned into something vastly *more* complex, *more* heavyweight, and at least as, if not more, vendor-dependent. Struggling mightily to get this "easy to use" wrapper-builder to adapt itself to such a simple API should make you question the value of the whole process. Anyway, to make this even more complex for you, Value is a polymorphic class; some Jess data types are returned as *subclasses* of Value. In any case, only some types of Value objects (STRING, SYMBOL, FLOAT, INTEGER, LONG, maybe FACT_ID as an int) are going to be meaningful at the client end in a Web Services context, so if it were me, I'd just write a small Java wrapper around executeCommand() (that name is deprecated, by the way; use eval() instead) which either just returned these simple types as a String or, if you wanted to get fancy, returned your own simpler Value-like class which was more amenable to marshalling via SOAP. On Apr 10, 2008, at 7:58 AM, Juan Ondiviela wrote: > Hello, I'm trying to develop a Web Service under Tomcat and axis > using Java. I'm just beginning so I deployed a service with the > basic method "executeCommand". I've implemented a client which > invokes this method... Until here everything works fine, the > problem comes with the response via SOAP. Since the return value is > a jess.Value object and it's not directly serializable, I cannot > get the right answer at the client side (I receive a null object). > I would like to know how could I solve this problem, I tried this > code: > > Service service = new Service(); > Call call = (Call) service.createCall(); > > call.setTargetEndpointAddress( new java.net.URL > (endpointURL) ); > call.setOperationName(new QName > ("urn:myJess","executeCommand")); > call.addParameter( "arg1", XMLType.XSD_STRING, > ParameterMode.IN); > call.setReturnType > ( org.apache.axis.encoding.XMLType.XSD_ANYTYPE ); > QName qname = new QName( "urn:myJess", "Value" ); > > call.registerTypeMapping(Value.class, qname, > new org.apache.axis.encoding.ser.BeanSerializerFactory > (Value.class, qname), > new org.apache.axis.encoding.ser.BeanDeserializerFactory > (Value.class, qname)); > > Value ret = (Value) call.invoke( new Object[] > { textToSend } ); > > > and I added this to the wsdd file > > <beanMapping qname="myNS:Value" > xmlns:myNS="urn:myJess" > languageSpecificType="java:jess.Value"/> > </service> > I think it doesn't work because jess.Value is not a Bean Class. > > Then, I also tried > > <typeMapping qname="typeNS:Value" > > xmlns:typeNS="urn:myJess" > languageSpecificType="java:" > serializer="ValueSerFactory" > deserializer="ValueDeserFactory" > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> > > </service>but since all jess.Value attributes are declared private, > I cannot compile the classes which implement serialization/ > deserialization of jess values. > > > Thank you very much, I'd be very grateful if could get this problem > fixed. > > Juan --------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 PO Box 969, MS 9012 ejfried@... Livermore, CA 94550 http://www.jessrules.com -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users you@...' in the BODY of a message to majordomo@..., NOT to the list (use your own address!) List problems? Notify owner-jess-users@.... -------------------------------------------------------------------- |
| Free Forum Powered by Nabble | Forum Help |