It's not a secret anymore!*
The moose likes Web Services and the fly likes AxisFault: Document root element is missing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "AxisFault: Document root element is missing" Watch "AxisFault: Document root element is missing" New topic
Author

AxisFault: Document root element is missing

Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Hi All,

I have a web service developed using .NET SOAP Toolkit and when I try
to consume that service using AXIS 1.2.1 Final java client I am getting
below axis fault from the service . Now can anyone please tell
what am I missing here.

The request soap message that the client generates conforms to the
wsdl and still why the service complains with below axis fault :



WSDL
----------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:s1="http://amla.org/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="http://mr.com/services/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://mr.com/services/"
xmlns="http://schemas.xmlsoap.org/wsdl/">

<types>

<s:schema elementFormDefault="qualified"
targetNamespace="http://mr.com/services/">
<s:import namespace="http://amla.org/" />
<s:element name="GLR">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="request"
type="s1:LRRequest" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GLRResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="GLRResult" type="s1:LRResponse" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GLRTest">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="TierName"
type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="MinPoints"
type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="MaxPoints"
type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GLRTestResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="GLRTestResult" type="s1:LRResponse" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="LRResponse" nillable="true"
type="s1:LRResponse" />
</s:schema>

<s:schema elementFormDefault="qualified"
targetNamespace="http://amla.org/">
<s:complexType name="LRRequest">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ClientID"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CardProduct"
type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="EndPointRange"
type="s:int" />
<s:element minOccurs="1" maxOccurs="1"
name="StartPointRange" type="s:int" />
<s:element minOccurs="0" maxOccurs="1" name="Tier" type="s:string" />
</s:sequence>
</s:complexType>
<s:complexType name="LRResponse">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ErrorCode"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="ErrorDescription" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Rewards"
type="s1:ArrayOfLR" />
</s:sequence>
</s:complexType>
<s:complexType name="ArrayOfLR">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded"
name="LR" type="s1:LR" />
</s:sequence>
</s:complexType>
<s:complexType name="LR">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Description"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="DetailPageURL"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="Points" type="s:float" />
<s:element minOccurs="0" maxOccurs="1" name="RewardCode"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="RewardSubCode"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="SmallImageURL"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="LargeImageURL"
type="s:string" />
</s:sequence>
</s:complexType>
</s:schema>
</types>

<message name="GLRSoapIn">
<part name="parameters" element="s0:GLR" />
</message>
<message name="GLRSoapOut">
<part name="parameters" element="s0:GLRResponse" />
</message>
<message name="GLRTestSoapIn">
<part name="parameters" element="s0:GLRTest" />
</message>
<message name="GLRTestSoapOut">
<part name="parameters" element="s0:GLRTestResponse" />
</message>
<message name="GLRTestHttpGetIn">
<part name="TierName" type="s:string" />
<part name="MinPoints" type="s:string" />
<part name="MaxPoints" type="s:string" />
</message>
<message name="GLRTestHttpGetOut">
<part name="Body" element="s0:LRResponse" />
</message>
<message name="GLRTestHttpPostIn">
<part name="TierName" type="s:string" />
<part name="MinPoints" type="s:string" />
<part name="MaxPoints" type="s:string" />
</message>
<message name="GLRTestHttpPostOut">
<part name="Body" element="s0:LRResponse" />
</message>

<portType name="LRSoap">
<operation name="GLR">
<input message="s0:GLRSoapIn" />
<output message="s0:GLRSoapOut" />
</operation>
<operation name="GLRTest">
<input message="s0:GLRTestSoapIn" />
<output message="s0:GLRTestSoapOut" />
</operation>
</portType>

<portType name="LRHttpGet">
<operation name="GLRTest">
<input message="s0:GLRTestHttpGetIn" />
<output message="s0:GLRTestHttpGetOut" />
</operation>
</portType>

<portType name="LRHttpPost">
<operation name="GLRTest">
<input message="s0:GLRTestHttpPostIn" />
<output message="s0:GLRTestHttpPostOut" />
</operation>
</portType>

<binding name="LRSoap" type="s0:LRSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<operation name="GLR">
<soap peration
soapAction="http://mr.com/services/GLR"
style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
<operation name="GLRTest">
<soap peration
soapAction="http://mr.com/services/GLRTest"
style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>

<binding name="LRHttpGet" type="s0:LRHttpGet">
<http:binding verb="GET" />
<operation name="GLRTest">
<http peration location="/GLRTest" />
<input>
<http:urlEncoded />
</input>
<output>
<mime:mimeXml part="Body" />
</output>
</operation>
</binding>

<binding name="LRHttpPost" type="s0:LRHttpPost">
<http:binding verb="POST" />
<operation name="GLRTest">
<http peration location="/GLRTest" />
<input>
<mime:content type="application/x-www-form-urlencoded" />
</input>
<output>
<mime:mimeXml part="Body" />
</output>
</operation>
</binding>

<service name="LR">
<port name="LRSoap" binding="s0:LRSoap">
<soap:address location="http://mm.com/dra/services/lr.asmx" />
</port>
<port name="LRHttpGet" binding="s0:LRHttpGet">
<http:address location="http://mm.com/dra/services/lr.asmx" />
</port>
<port name="LRHttpPost" binding="s0:LRHttpPost">
<http:address location="http://mm.com/dra/services/lr.asmx" />
</port>
</service>
</definitions>





SOAP Request Message generated by AXIS 1.2.1 Final Client
-------------------------------------------------------------------------------------------
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Body>
<GLR xmlns="http://mr.com/services/">
<request>
<ns1:ClientID xmlns:ns1="http://amla.org/">100</ns1:ClientID>
<ns2:CardProduct xmlns:ns2="http://amla.org/">TV</ns2:CardProduct>
<ns3:EndPointRange xmlns:ns3="http://amla.org/">200</ns3:EndPointRange>
<ns4:StartPointRange
xmlns:ns4="http://amla.org/">100</ns4:StartPointRange>
<ns5:Tier xmlns:ns5="http://amla.org/">Tier1</ns5:Tier>
</request>
</GLR>
</soapenv:Body>
</soapenv:Envelope>






Response SOAP Message from Service
------------------------------------------------------------------------AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXParseException: Document root element is missing.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace rg.xml.sax.SAXParseException:
Document root element is missing.
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)
at org.apache.crimson.parser.Parser2.parse(Unknown Source)
at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2754)
at org.apache.axis.client.Call.invoke(Call.java:2737)
at org.apache.axis.client.Call.invoke(Call.java:2413)
at org.apache.axis.client.Call.invoke(Call.java:2336)
at org.apache.axis.client.Call.invoke(Call.java:1793)
at lr.LRSoap_BindingStub.getLR(LRSoap_BindingStub.java:188)
at Client.main(Client.java:30)

{http://xml.apache.org/axis/}hostname:L0337

org.xml.sax.SAXParseException: Document root element is missing.
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:701)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2754)
at org.apache.axis.client.Call.invoke(Call.java:2737)
at org.apache.axis.client.Call.invoke(Call.java:2413)
at org.apache.axis.client.Call.invoke(Call.java:2336)
at org.apache.axis.client.Call.invoke(Call.java:1793)
at lr.LRSoap_BindingStub.getLR(LRSoap_BindingStub.java:188)
at Client.main(Client.java:30)
Caused by: org.xml.sax.SAXParseException: Document root element is missing.
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)
at org.apache.crimson.parser.Parser2.parse(Unknown Source)
at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
... 10 more





Thanks & Regards,


RR Kumaran
SCJP 1.4
Anoop Singh
Greenhorn

Joined: Jul 18, 2005
Posts: 1
hey I am also getting the same problem any body please help
Amit G Piplani
Ranch Hand

Joined: Jul 21, 2004
Posts: 83
Hi,
Kindly chnage the following entries in WSDL :
<operation name="GLR">
<soap peration
soapAction="http://mr.com/services/GLR"
style="document" />


to
<operation name="GLR">
<soap peration
soapAction="http://mr.com/services/GLR"
style="rpc" />


And kindly check whether SOAP call has been made successful.


SCJP,SCWCD,SCBCD,SCDJWS1.4, SCDJWS1.5
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Hi Amit,

My WSDL is a Document/Literal style and why I need to change it to RPC/Literal. Can you please justify your approach ...


Thanks & Regards,
Amit G Piplani
Ranch Hand

Joined: Jul 21, 2004
Posts: 83
As per your Web Service Request, the rpc style has been used. That's why i recommended for the changes IN WSDL and regenerate the axis stubs and try hitting Web Service again.
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Hi Amit and Tim,

Thank you for the responses. As you see in my WSDL and my request soap message, I am accessing an operation called GLR which uses SOAP Binding + DOCUMENT/LITERAL wsdl constucts. Also, there are other operations that use HTTP Binding + RPC/LIETAL wsdl constructs which I am not tyring in the present context of this post.

So I think the wsdl constructs are valid w.r.t the operation GLR and also the WSDL is validated 'OK' by XML SPY WSDL Validator. Hope this clears the confusion.


Thanks & Regards,
 
Consider Paul's rocket mass heater.
 
subject: AxisFault: Document root element is missing
 
Similar Threads
got error when call to >net webservice from java client
JAX-WS generated client request missing SOAP body
.NET doesn't Serialize Java Set
KSoap2 question, please reply
H