xml-xmlbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <rdon...@apache.org>
Subject Re: Make XMLBeans work with AXIS
Date Wed, 04 Aug 2004 19:53:15 GMT
hi

you need to write custom de/serializer's for axis and configure your  
webservice to use them. unfortunately, the axis documentation is pretty  
sparse (when it comes to document based SOAP) but the examples are  
pretty good. i've been playing around with this kind of thing recently  
but it's not really ready for the limelight yet. i'll probably submit  
it to axis when it's ready (but i'm not sure when that'll be). it  
should be do-able to write your own. i'd suggest starting by taking a  
look at the castor based de/serializer.

- robert

On 4 Aug 2004, at 20:41, Yu Long wrote:

> Hi,everyone:
>    Can anyone help my case? I am currently trying to
> make XMLBeans work with AXIS. The example of the Web
> Service is called DineroService, which consumes a
> complex type object "dinero" as input and output a
> string. I wrote .xsd for the dinero object and
> compiled it(Namespace is edu.ufl.dineroSchema) using
> scomp in XMLBeans package. I tried two approaches to
> make it work with axis, neither one works.
>    I think the error I met may be related to the
> serializer/deserializer in XMLBeans. Can anyone share
> any insights on these issues?
>
> 1) I wrote a .jws file as follows.
>
> import org.apache.xmlbeans.*;
> import edu.ufl.dineroSchema.*;
>
> public class DineroService
> {
>    /**
>     * @jws:operation
>     */
>    public String run(DineroDocument dio)
>    {
>      System.out.println("Received a Dinero Doc:");
>      System.out.println(dio.xmlText());
>
>      if(!dio.validate()) return "The Dinero document
> was not valid.";
>      return "run dinero";
>    }
> }
>
> When I wrote a simple client to invoke this service.
> import java.io.*;
> import java.util.Vector;
> import java.net.URL;
> import org.apache.axis.message.SOAPBodyElement;
> import org.apache.axis.utils.XMLUtils;
> import org.w3c.dom.Document;
> import org.apache.axis.client.*;
> import org.apache.xmlbeans.*;
> import edu.ufl.dineroSchema.*;
> import edu.ufl.dineroSchema.DineroDocument.*;
> import edu.ufl.dineroSchema.UnifiedDocument.*;
> import edu.ufl.dineroSchema.DineroDocument.Dinero.*;
>
> public class dineroclient{
>
>   public static void main(String[] args){
>
>    try{
>    Service service= new Service();
>    Call call= (Call) service.createCall();
>    String
> EndPT="http://hopper.acis.ufl.edu:27007/axis/DineroService.jws? 
> method=run";
>    call.setTargetEndpointAddress(new URL(EndPT));
>
>    DineroDocument dinero= createDIO();
>    SOAPBodyElement[] input =new SOAPBodyElement[1];
>    String xml= dinero.toString();
>    Document doc=XMLUtils.newDocument(new
> ByteArrayInputStream(xml.getBytes()));
>    input[0]= new
> SOAPBodyElement(doc.getDocumentElement());
>
>    Vector result=(Vector)call.invoke(input);
>
> System.out.println("result:"+(String)result.firstElement());
>   }catch(Exception e){
>    System.out.println("Error"+e);
>    e.printStackTrace();
>   }
> }
>
>  public static DineroDocument createDIO()
> {
>    try{
>    DineroDocument newDiDoc
> =DineroDocument.Factory.newInstance();
>    Dinero newDi=newDiDoc.addNewDinero();
>    InformatType
> newInfo=InformatType.Factory.newValue("D");
>    newDi.xsetInformat(newInfo);
>
>    Level1 newLevel1= newDi.addNewLevel1();
>    Unified  newUnified=newLevel1.addNewUnified();
>    CachesizeType
> newcache=CachesizeType.Factory.newValue("512K");
>    newUnified.xsetUsize(newcache);
>    BlocksizeType
> newblock=BlocksizeType.Factory.newValue("128");
>    newUnified.xsetUbsize(newblock);
>    System.out.println("xml is "+newDiDoc);
>    return newDiDoc;
>   }catch(Exception e){
>    System.out.println("Error in DineroDocument"+e);
>    e.printStackTrace();
>    return null;
>  }
> }
> }
>
> I got the following error message. The begining is the
> xml:
>
> xml is <dinero xmlns="http://dineroSchema.ufl.edu">
>   <informat>D</informat>
>   <level1>
>     <unified>
>       <usize>512K</usize>
>       <ubsize>128</ubsize>
>     </unified>
>   </level1>
> </dinero>
>
> Errororg.xml.sax.SAXException: SimpleDeserializer
> encountered a child element, which is NOT expected, in
> something it was trying to deserialize.
> AxisFault
>  faultCode:
> {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
>  faultSubcode:
>  faultString: org.xml.sax.SAXException:
> SimpleDeserializer encountered a child element, which
> is NOT expected, in something it was trying to
> deserialize.
>  faultActor:
>  faultNode:
>  faultDetail:
>         {http://xml.apache.org/axis/}stackTrace:
> AxisFault
>  faultCode:
> {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
>  faultSubcode:
>  faultString: org.xml.sax.SAXException:
> SimpleDeserializer encountered a child element, which
> is NOT expected, in something it was trying to
> deserialize.
>  faultActor:
>  faultNode:
>  faultDetail:
>
> org.xml.sax.SAXException: SimpleDeserializer
> encountered a child element, which is NOT expected, in
> something it was trying to deserialize.
>         at
> org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.j 
> ava:260)
>         at
> org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.ja 
> va:169)
>         at
> org.apache.axis.encoding.DeserializationContextImpl.endElement(Deserial 
> izationContextImpl.java:1015)
>         at
> org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1528)
>         at
> org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
>         at
> org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507)
>         at
> org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
>         at
> org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507)
>         at
> org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
>         at
> org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
>         at
> org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
>         at
> javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
>         at
> org.apache.axis.encoding.DeserializationContextImpl.parse(Deserializati 
> onContextImpl.java:242)
>         at
> org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
>         at
> org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
>         at
> org.apache.axis.client.Call.invokeEngine(Call.java:2583)
>         at
> org.apache.axis.client.Call.invoke(Call.java:2553)
>         at
> org.apache.axis.client.Call.invoke(Call.java:1672)
>         at dineroclient.main(dineroclient.java:30)
>
>
> org.xml.sax.SAXException: SimpleDeserializer
> encountered a child element, which is NOT expected, in
> something it was trying to deserialize.
>         at
> org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.j 
> ava:260)
>         at
> org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.ja 
> va:169)
>         at
> org.apache.axis.encoding.DeserializationContextImpl.endElement(Deserial 
> izationContextImpl.java:1015)
>         at
> org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1528)
>         at
> org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
>         at
> org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507)
>         at
> org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
>         at
> org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507)
>         at
> org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
>         at
> org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
>         at
> org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
>         at
> javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
>         at
> org.apache.axis.encoding.DeserializationContextImpl.parse(Deserializati 
> onContextImpl.java:242)
>         at
> org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
>         at
> org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
>         at
> org.apache.axis.client.Call.invokeEngine(Call.java:2583)
>         at
> org.apache.axis.client.Call.invoke(Call.java:2553)
>         at
> org.apache.axis.client.Call.invoke(Call.java:1672)
>         at dineroclient.main(dineroclient.java:30)
>
> 2) If I use WSDL2Java, compile the dineroservice.wsdl
> and replace the data model codes with the one
> generated by the XMLBeans. I need the information of
> the serializer and deserializer of XMLBeans to replace
> the AXIS default ones in the deploy description file.
> Can anyone share insights on these?
>
>
>
> 		
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
> http://promotions.yahoo.com/new_mail
>
> - ---------------------------------------------------------------------
> To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
> Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
>
>


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Mime
View raw message