Fabrício, sounds like you trying to use Axis in message mode – sending and receiving raw XML documents? You need to change from RPC/encoded to document/literal, plus change your wsdd as follows:

 

-          service provider should be “java:MSG

-         remove all the type mappings

 


From: Fabrício [mailto:[EMAIL PROTECTED]
Sent: 26 September 2005 23:14
To: [email protected]
Subject: Web service receiving and returning org.w3c.dom.Element

 

Hello all,

 

Does anyone have a real example of a web service that receives and returns an org.w3c.dom.Element? I created one, but doesn’t work! :’-((((((((((((

 

Always I get this error:

 

org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.

 

My web service is just this:

 

import org.w3c.dom.Element;

 

public class ElementWS {

 

     

      public Element method(Element e){

            return e;

      }

}

 

And my wsdd is:

 

<deployment xmlns="http://xml.apache.org/axis/wsdd/"

            xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

 

 <service name="ElementWS" provider="java:RPC">

  <parameter name="className" value="ElementWS"/>

  <parameter name="allowedMethods" value="*"/>

 

  <typeMapping

      qname="myNS:Element"

      xmlns:myNS="urn:ElementWS"

      languageSpecificType="java:org.w3c.dom.Element"

      deserializer="org.apache.axis.encoding.ser.ElementDeserializerFactory"

      serializer="org.apache.axis.encoding.ser.ElementSerializerFactory"/>

 

 </service>

 

</deployment>

 

In my client I used registerTypeMapping too. This is a piece of my client:

 

               DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

               DocumentBuilder builder = factory.newDocumentBuilder();

               Document documentXML = builder.parse("People.xml");

               Element e = documentXML.getDocumentElement();

                       

               Object[] params = {e};

              

               Service service = new Service();

              

               QName qnElement = new QName("urn:ElementWS", "Element");

              

               Call call = (Call) service.createCall();

             

               call.registerTypeMapping(Element.class, qnElement ,

                         new org.apache.axis.encoding.ser.ElementSerializerFactory(),

                         new org.apache.axis.encoding.ser.ElementDeserializerFactory());

 

               call.setTargetEndpointAddress( new java.net.URL(urlWS) );

              

               call.setOperationName( new QName(urlWS, "method") );

              

               Element ele = (Element) call.invoke(params);

              

               System.out.println(ele);

 

Does anyone can see why I’m getting this error?

 

Thanks very, very, very, very much!!

 

Fabrício.

CONFIDENTIALITY & PRIVILEGE NOTICE

This e-mail is confidential to its intended recipient. It may also be privileged. Neither the confidentiality nor any privilege attaching to this e-mail is waived lost or destroyed by reason that it has been mistakenly transmitted to a person or entity other than its intended recipient. If you are not the intended recipient please notify us immediately by telephone or fax at the numbers provided above or e-mail by Reply To Author and return the printed e-mail to us by post at our expense. We believe, but do not warrant, that this e-mail and any attachments are virus-free, but you should check. We may monitor traffic data of both business and personal e-mails. We are not liable for any opinions expressed by the sender where this is a non-business e-mail. If you do not receive all the message, or if you have difficulty with the transmission, please telephone us immediately.

Reply via email to