File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Please help, Axis problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Please help, Axis problem" Watch "Please help, Axis problem" New topic

Please help, Axis problem

Arash A

Joined: Dec 20, 2003
Posts: 5

I appreciate if anybody can help me.

I wrote a message service using this method on the server side using Axis:

public Document method (Document body)

In a standalone java program when I have a Document object I can simply convert it to String. (String str = doc.getDocumentElement())

Here it does not work! Why?!?! How I can convert this Documnet to a String?

Thanks for any help.
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
can you please post your complete source code and other server side axis wsdd files here ...

RR Kumaran
SCJP 1.4
Arash A

Joined: Dec 20, 2003
Posts: 5

Thanks for your reply.

The standalone java program is:

import org.w3c.dom.*;
import javax.xml.parsers.*;

public class DOMTest {

public static void main(String[] args) throws Exception {
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = db.parse(new File("data.xml"));

It prints the XML on the console.

The Message Service using Axis:

import org.w3c.dom.*;
import javax.xml.parsers.*;

public class TVMessage {

public Document tvMessage(Document doc) {

try {


} catch (Exception ex) {

return doc;


I will get back the proper SOAP but doesnt print the doc on console just the first element follwing with null.

I did not create wsdl and axis generated it for me.

<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl efinitions targetNamespace="http://localhost:8080/jboss-net/services/TVMessageService" xmlns="" xmlns:apachesoap="" xmlns:impl="http://localhost:8080/jboss-net/services/TVMessageService" xmlns:intf="http://localhost:8080/jboss-net/services/TVMessageService" xmlns:soapenc="" xmlns:wsdl="" xmlns:wsdlsoap="" xmlns:xsd="">
<wsdl:types />
<wsdl:message name="tvMessageRequest" />
- <wsdl:message name="tvMessageResponse">
<wsdl art name="tvMessageReturn" type="xsd:anyType" />
- <wsdl ortType name="TVMessage">
- <wsdl peration name="tvMessage">
<wsdl:input message="impl:tvMessageRequest" name="tvMessageRequest" />
<wsdl utput message="impl:tvMessageResponse" name="tvMessageResponse" />
</wsdl peration>
</wsdl ortType>
- <wsdl:binding name="TVMessageServiceSoapBinding" type="impl:TVMessage">
<wsdlsoap:binding style="rpc" transport="" />
- <wsdl peration name="tvMessage">
<wsdlsoap peration soapAction="" />
- <wsdl:input name="tvMessageRequest">
<wsdlsoap:body encodingStyle="" namespace="http://localhost:8080/jboss-net/services/TVMessageService" use="encoded" />
- <wsdl utput name="tvMessageResponse">
<wsdlsoap:body encodingStyle="" namespace="http://localhost:8080/jboss-net/services/TVMessageService" use="encoded" />
</wsdl utput>
</wsdl peration>
- <wsdl:service name="TVMessageService">
- <wsdl ort binding="impl:TVMessageServiceSoapBinding" name="TVMessageService">
<wsdlsoap:address location="http://localhost:8080/jboss-net/services/TVMessageService" />
</wsdl ort>
</wsdl efinitions>

Thanks for your help.
Arash A

Joined: Dec 20, 2003
Posts: 5
Sorry, I forgot the wsdd

<!-- Example Web Service Descriptor -->


<service name="TVMessageService" style="message" >
<parameter name="className" value="TVMessage"/>
<parameter name="allowedMethods" value="tvMessage"/>


sanker san
Ranch Hand

Joined: Dec 17, 2004
Posts: 56
try this...

import org.apache.axis.utils.XMLUtils;

XMLUtils utils = new XMLUtils();
System.out.println(utils.DocumentToString(doc));//doc is of type Document
I agree. Here's the link:
subject: Please help, Axis problem
It's not a secret anymore!