• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Please help, Axis problem

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

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.
Arash
 
Ranch Hand
Posts: 548
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you please post your complete source code and other server side axis wsdd files here ...
 
Arash A
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Thanks for your reply.

The standalone java program is:

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

public class DOMTest {

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

It prints the XML on the console.

The Message Service using Axis:

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

public class TVMessage {

public Document tvMessage(Document doc) {

try {

System.out.prinyln(doc.getDocumentElement());

} catch (Exception ex) {

System.out.println(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="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/jboss-net/services/TVMessageService" xmlns:intf="http://localhost:8080/jboss-net/services/TVMessageService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types />
<wsdl:message name="tvMessageRequest" />
- <wsdl:message name="tvMessageResponse">
<wsdl art name="tvMessageReturn" type="xsd:anyType" />
</wsdl:message>
- <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="http://schemas.xmlsoap.org/soap/http" />
- <wsdl peration name="tvMessage">
<wsdlsoap peration soapAction="" />
- <wsdl:input name="tvMessageRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/jboss-net/services/TVMessageService" use="encoded" />
</wsdl:input>
- <wsdl utput name="tvMessageResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/jboss-net/services/TVMessageService" use="encoded" />
</wsdl utput>
</wsdl peration>
</wsdl:binding>
- <wsdl:service name="TVMessageService">
- <wsdl ort binding="impl:TVMessageServiceSoapBinding" name="TVMessageService">
<wsdlsoap:address location="http://localhost:8080/jboss-net/services/TVMessageService" />
</wsdl ort>
</wsdl:service>
</wsdl efinitions>

Thanks for your help.
Arash
 
Arash A
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I forgot the wsdd

<!-- Example Web Service Descriptor -->

<deployment
xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

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

</deployment>

Thanks.
Arash
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this...

import org.apache.axis.utils.XMLUtils;
...

XMLUtils utils = new XMLUtils();
System.out.println(utils.DocumentToString(doc));//doc is of type Document
 
reply
    Bookmark Topic Watch Topic
  • New Topic