Title: RE: XML Conversion...

Radek,

Thanks for this, this is very interesting, as I am attempting the same thing with the Castor XML implementation (see previous post). The issue I have though is that Castor XML and to the best of my knowledge JAXB, will not (yet) accept SOAP encoded XML.

As such in my SOAP requests, I am using document literal encoding. Do you also required this, for JAXB and your serialiser to work properly? Do you have a sample request I can look at? Also are you using an RPC style method signature in your implementation class?

Also my document literal SOAP requests (from a .Net C# client) don't carry any encodingStyle attribute. Yet in order to get my serialiser invoked I need to specify a SOAP encoding in the deployment descriptor? I noticed you also have this, so although my current solution works, the encodingStyle issue is a little strange to me?

Any thoughts?

Thanks.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

        <soap:Body>
                <PurchaseProduct xmlns="http://www.sprokets.com/sales">
                        <Product>
                                <Name>Widget (Small)</Name>
                                <Code>XYZ100</Code>
                                <Location>AB12</Location>
                        </Product>
                </PurchaseProduct>
        </soap:Body>
</soap:Envelope>

-----Original Message-----
From: Radek Wisniewski [mailto:[EMAIL PROTECTED]]
Sent: 16 August 2001 12:21
To: [EMAIL PROTECTED]
Subject: Re: XML Conversion...


I'v send already JAXB serializer, very beta version, probably to soap-dev
list.
Resending now again to soap-user.


Radek Wisniewski

On Thu, 16 Aug 2001, Balaji Iyer wrote:

> Hi,
>  Has anyone has had a look at the AddressBook demo in Apache Soap.
> Incase you have seen that, can someone throw more light with respect to
> generating xml feeds from a vector of java objects. The AddressBook demo
> has a SOAP Client (GetAllListings.java) which uses
>
> call.setMethodName("getAllListings");
> call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);
>
> getAllListings method  in  the AddressBook Class does just the
> generation of a DOM-TREE !! (Eeeks! !! )
>
> In my project usage...
> For eg. Say I have a method returning a Hashtable of
> MailInformationObjects. What should I do to convert this Hashtable into
> XML using Apache-SOAP.
> Solutions I propose ... (a) and (b) ... (a) is straight forward but
> going to be messy. (b) needs to have the configuration set up well
>
> (a) Use something like an Element Generator like in the AddressBook
> sample (part of code pasted)
>          public Element getAllListings()
>         {
>                DocumentBuilder xdb =
> XMLParserUtils.getXMLDocBuilder();
>     Document doc = xdb.newDocument();
>     Element bookEl = doc.createElement("AddressBook");
>
>     bookEl.appendChild(doc.createTextNode("\n"));
>
>     for (Enumeration keys = name2AddressTable.keys();
>          keys.hasMoreElements();)
>     {
>       String name = (String)keys.nextElement();
>       Address address = (Address)name2AddressTable.get(name);
>       Element listingEl = doc.createElement("Listing");
>                    -----
>                     ----
>                  ----
>                  -------
>                    ---------
>    listingEl.appendChild(addressEl);
>       listingEl.appendChild(doc.createTextNode("\n  "));
>       bookEl.appendChild(doc.createTextNode("  "));
>       bookEl.appendChild(listingEl);
>       bookEl.appendChild(doc.createTextNode("\n"));
>     }
>
>     return bookEl;
>    }
>
> Then use this Element in the SOAP Client Program and switch to XML
> Literal encoding and use the XML feed ?
>
> (b) Use some mapping facilities of APACHE-SOAP , (WHICH I AM NOT AWARE
> OF )
>      or use either JAXB1.0 or Castor 0.9.2 (I have used before) to
> generate xml feeds from my Hashtable of MailInformation Objects!!
>
> Has anyone ecountered this situation earlier... ? ? I am sure someone
> can propose more solutions?
> Pls, throw more light and roll this discussion.
>
> Regards,
> Balaji Iyer
>
>
> -----Original Message-----
> From: Evyatar Shoresh [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 16, 2001 3:51 PM
> To: [EMAIL PROTECTED]
> Subject: xml to bean convertition.
>
>
> Hi,
> I'm having a client-server aplication using soap as my messaging, my aim
> is to send a xml document from the client that will be transfered as an
> object ( pre-defined in a deployment descriptor ) to the method in the
> server as a parameter.
>
> My problem is that no matter which descriptor i use the server takes my
> xml as is and transfers it to the method as an Element object.
>
> Do you have any sample showing such a scenario?
>
> Thanx alot.
>

Reply via email to