Okay, your answer implies that you use an external serializer to get he XML, not the “built-in” one in Axis1.2.  Yes, there are many ways to do that.  In fact, I solved it temporarily by using Castor.  It too, like XStream, knows how to serialize a bean based java object to XML.  It took 2 or 3 lines of code like your example.

 

But, the whole point of using WSDLtoJava and getting Axis to generate and use the java objects for serializing and deserializing is the notion that I shouldn’t need get yet another 3rd party product and reinvent the wheel.  After all, the generated java objects are generated with all the necessary namespace awareness etc.  They are built into the classes, I can see them.

 

It is inconceivable to me that I can’t get at them independent of Axis neeeding a msgContext etc to handle this.  I’m also very surprised that nobody on this list has ever had the need to simply populate a generated java object and want access to serialized data without invoking the “invoke” command.

 

I suppose I can continue to crawl through the Axis code and figure out how to do this, there has got to be a way.

 

Again, for the record, the reason why I’m doing this is because I want to support a simple REST interface in addition to SOAP.  I get data on a “post” to my server/servlet, I generate the appropriate serviceRequest object (the generated one, the one I would normally get through a SOAP service), I then pass it to my back end that knows how to process this, and it returns me “serviceResponse”, again the generated object.

 

At this point Axis has not even been used.  All I want now is to use what Axis uses to create the DOM and get the XML so I can write it back down httpRequest.OutputStream.

 

ah, not so complicate – but I guess nobody else has done this.

 

Thanks for you input and help Uday,

 

I suppose I shouldn’t bang my head against this and just use yet another serialzer even thought Axis has one and I can’t use it independently.

 

 

 


From: Uday Kamath [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 26, 2005 10:11 AM
To: axis-user@ws.apache.org
Subject: RE: How to access and use Serializer independently?

 

There are many ways, i can tell you how i did it once, the serializable java object which is response of web service (wsdl2java generated from 1.2/1.3) can be passed on to XStream (http://xstream.codehaus.org/) as a Java Bean that generates XML from the Bean in a faster way. You cna give synonyms like below and have a great formatted XML back.

 

public PurchaseOrderFusionService(String wsdlUrl) {
  this.wsdlURI=wsdlUrl;
  xstream.alias(
   "PurchaseOrder",examples.webservices.purchaseOrder.statelessSession.PurchaseOrder.class);
  xstream.alias(
         "Item",examples.webservices.purchaseOrder.statelessSession.Item.class);
 }

 

 public String[] findAll() throws Exception {
  PurchaseOrder[] orders = getPurchaseOrderService().getAllPurchaseOrders();
  String[] results = new String[orders.length];
  for(int i=0; i< results.length; i++){
   results[i] = xstream.toXML(orders[i]);
  }
  return results;
 }

Hope that gives you some solution

-Uday

 


From: Parikh,Pratik [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 26, 2005 9:48 AM
To: axis-user@ws.apache.org
Subject: RE: How to access and use Serializer independently?

Hi Paul,

 

    I would guess yes. You will have to write a handler for it.

 

Thanks,

Parikh, Pratik

 


From: Paul Grillo [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 26, 2005 8:42 AM
To: axis-user@ws.apache.org
Subject: FW: How to access and use Serializer independently?

Can’t believe that nobody has tried this.  Let me reword it, and maybe somebody can give me a yes/no answer.

 

Is it possible to populate an axis1.2 generated java binding object (from WSDL2Java) and generate XML to an outputstream?

 

yes or no would be good.

 

if yes, a general idea on how would be helpful

 

I thank anybody that can help.

 

 

 


From: Paul Grillo
Sent: Monday, October 24, 2005 12:15 PM
To: axis-user@ws.apache.org
Subject: How to access and use Serializer independently?

 

I’ve been playing with this for awhile, and there just “seems” to be a lot of coupling that makes it difficult to do this.

 

Essentially I have a service running perfectly using the default serializer/deserializer for Axis 1.2

 

Now I would like to incorporate a REST interface on a few simple messages we support.

 

Scenario.

 

FooRequest and FooResponse are classes that work just fine.  They have been generated by WSDLtoJava and we use them with our service.

 

I now get a Post that contains parameters that allow me to create FooRequest from the httpRequest.  We scrub it and do it properly.

We then take FooRequest and pass it to our backend processor that knows how to return the FooResponse object.  Normally this object is passed back to the Axis engine and it handles it for non-REST input.

 

Now, all I really want to do is take FooResponse and use Axis Deserializer to generate XML or a DOM from which I can get to the XML so that I can write it back to the Web Client httpResponse.

 

How do I do that?  Is there not an easy way to use the getSerializer built into the generated objects and invoke it?  If so, what is the magic sequence to do this?

 

I’m hoping the answer is far shorter than the question.

 

Thanks for any help

 

-paul

CONFIDENTIALITY NOTICE

This message and any included attachments
are from Cerner Corporation and are intended
only for the addressee. The information
contained in this message is confidential and
may constitute inside or non-public information
under international, federal, or state
securities laws. Unauthorized forwarding,
printing, copying, distribution, or use of such
information is strictly prohibited and may be
unlawful. If you are not the addressee, please
promptly delete this message and notify the
sender of the delivery error by e-mail or you
may call Cerner's corporate offices in Kansas
City, Missouri, U.S.A at (+1) (816)221-1024.
---------------------------------------- --

 

Reply via email to