|
Yes, I’ve also noticed a few
quirks when using Axis with DII and it’s JAX-RPC implementation. Try altering your client as follows: SOAPMessage message =
MessageFactory.newInstance().createMessage(); message.getSOAPBody().addDocument(documentXML); Object[]
params = new Object[] { message.getSOAPBody().getFirstChild()
}; From:
Fabrício [mailto:[EMAIL PROTECTED] Chris, I did what you said, but
now it’s happening a strage think. My web service is: import
org.w3c.dom.Document; public class
ElementWS {
public Document method(Document body){
return body;
} } And my WSDD is: <deployment
xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"> <service
name="ElementWS" provider="java:MSG">
<parameter name="className" value="ElementWS"/>
<parameter name="allowedMethods" value="method"/> </service> </deployment> My client is: String urlWS =
"http://localhost:8081/axis/services/ElementWS";
DocumentBuilderFactory
factory = DocumentBuilderFactory.newInstance(); DocumentBuilder
builder = factory.newDocumentBuilder(); Document
documentXML = builder.parse("Test.xml"); Object[] params =
{documentXML}; Service service =
new Service(); Call call =
(Call) service.createCall(); call.setTargetEndpointAddress(
new java.net.URL(urlWS) ); call.setOperationName(
"method" ); Document ele =
(Document) call.invoke(params); I converted the web
service return to give a println and see the content and all I got was this: <?xml version="1.0"
encoding="UTF-8"?> What happened
with the content of my input XML document? Where are all nodes? Thanks a lot, Fabrício. De:
Chris Nappin [mailto:[EMAIL PROTECTED] 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: 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. |
