Hello list. (this is a bit long, but I hope useful to other members)

After spending several days reading docs, mailing lists, articles, writing examples, etc., we (me and a friend)
have become illuminated and very confused at the same time.
We've read a thousand opinions on the pros-cons about doc/lit, rpc/encoded, and all of its variations.
Almost none of them address the issues concerning the "returning" types/encoding of an invocation.
We are concerned because we're actually writing the *client*, and specifying how a *service* should respond to us.


What we want to do is use some kind of rcp-style call (wrapped?) where we have a web service that
can respond to several operations (we tried Axis' "message" style but it won't send the operation name).
In return, it will respond *pure free XML*.
Yes, I know, it's all XML down the wire, but we haven't found a standard way to automatically deserialize that XML
into a DOM object. A way that will work and interoperate accross all WS platforms.


Let's say we have a class with a method like this: Element MyMethod (....)

We don't like the "apachesoap:Element" type that Axis returns, as it will probably destroy interoperability, or not?
In Axis, we found that it's not enough to deploy using style="wrapped", as the ?wsdl returned automatically will insist
on using "apachesoap:Element" or "apachesoap:Document" if the corresponding Java method is declared to return
a DOM Element or Document. If we declare it to return Object, then "anyType" is produced by the automatic ?wsdl
which is better, but leaves the Java code badly documented.


We kind of solved it using the following in the deployment WSDD:

<operation name="MyMethod" qname="operNS:MyMethod" xmlns:operNS="http://mipaquete";
returnQName="retNS:MyMethod" xmlns:retNS="http://mipaquete"; returnType="rtns:anyType"
xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >


The above will produce an automatic ?wsdl which has an "xsd:anyType" return type.
This is better because it gets rid of the "apachesoap:" types.


But STILL when actually calling the operation, *even if* the Java method is declared to return Object, it seems that
some part of Axis -- right before returning -- looks at the instanceof the Object returned and if it's an Element or Document
will again put the "apachesoap:" type, disregarding what the WSDD says.


The quick and dirty solution we found was to also add the following code right before returning:

MessageContext mc= MessageContext.getCurrentContext();
OperationDesc opd= mc.getOperation();
opd.setReturnType(new QName("http://www.w3.org/2001/XMLSchema-instance";, "anyType"));
mc.setOperation(opd);


This is the only way we could find to actually return pure XML without strange Axis/SOAP types.
But it's UGLY.


For the client part, we tried writing a WSDL from scratch and creating a new Service that acutally uses that WSDL file.
We declared the operations to be document/literal and the return type like this:


<element name="MyMethod" type="xsd:anyType"/>

This WSDL will produce a correct type of WS invocation with a wrapped style parameter lists, wrapped in an operation name.
The returning XML is actually identified by the Axis Client to be a lot of XML so it deserializes as an Element object.


What if the service is written in .NET (I know this is not the place to ask :-) )?
Will they be able to return free XML? (As returned by an XML database, for ex?)
What are your opinions on interoperability?
What are the best practices in Web Servicves for returning a plain old XML Document and have it interpreted like that?
We want to make it simple on the people writing the services for which we are going to be clients.
We are talking about a "document/lit" approach but on the *returning* part, not on the *calling* part (for which "wrapped" seems to have been invented)
Are other platforms as "hacky" in this respect as we have found Axis to be?


Thank you for your patience. :-)

BarZ


Nueva forma de conectarse a internet en URUGUAY ------------- Cuanto gasta hoy ? -------------- Tel. 0909.20.30 => Acceso 100% digital 56K! Promocion lanzamiento: $0,10 mas IVA el minuto. =============================================== http://www.internet.com.uy - Internet en serio.






Reply via email to