It's not a secret anymore!*
The moose likes Web Services and the fly likes Soap With Attachment Axis Fault Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Soap With Attachment Axis Fault" Watch "Soap With Attachment Axis Fault" New topic
Author

Soap With Attachment Axis Fault

Anoop Singhal
Greenhorn

Joined: May 07, 2010
Posts: 12
Dear Sir,

I am using a webservices which uses Soap with attachment to transmit zip file to their server. I followed the sample code provided and getting the error. The stack trace is paseted below. Any help in this regard will be highly appreciated.

Regards
Anoop

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.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:435)
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:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at in.gov.incometaxindiaefiling.itrservice.v_1_0.ITRServiceSoapBindingStub.submitITR(ITRServiceSoapBindingStub.java:255)
at in.gov.incometaxindiaefiling.itrservice.v_1_0.ITRServicePortProxy.submitITR(ITRServicePortProxy.java:50)
at UploadXML.doGet(UploadXML.java:150)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
at java.lang.Thread.run(Unknown Source)

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

org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
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:435)
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:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at in.gov.incometaxindiaefiling.itrservice.v_1_0.ITRServiceSoapBindingStub.submitITR(ITRServiceSoapBindingStub.java:255)
at in.gov.incometaxindiaefiling.itrservice.v_1_0.ITRServicePortProxy.submitITR(ITRServicePortProxy.java:50)
at UploadXML.doGet(UploadXML.java:150)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
at java.lang.Thread.run(Unknown Source)
Caused by: org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.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)
... 25 more
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 576

Hi Anoop.
I am using a webservices which uses Soap with attachment to transmit zip file to their server

Are you using SAAJ API to create request SOAP message with attachment?
I followed the sample code provided

From where did you pick sample code?

Your request SOAP message seems not conforming to WSDL/XSD.

Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Anoop Singhal
Greenhorn

Joined: May 07, 2010
Posts: 12
Hi Naren,

Thanks for your message.

The API is for sending ITR XML to Income Tax server in India. We downloaded the document from there website which has the sample code. We created some class objects and called the required functions.

Here is the WSDL URI https://incometaxindiaefiling.gov.in/ditws/v_1_0/ITRServiceSoapHttpPort?wsdl

I extracted the package using Eclipse and got the classes from there.

Let me know if you require any information Any help would be highly appreciated.

Reagrds
Anoop
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 576

Hi Anoop,

Can you answer these questions?
I extracted the package using Eclipse

What is the web service engine you are using within Eclipse to generate client side proxy classes?


For some reason, this WSDL is not complete. I get errors when importing this. Can you post the correct WSDL and relevant XSD files here?
Anoop Singhal
Greenhorn

Joined: May 07, 2010
Posts: 12
Hi Naren,

I did it using new WebServices and extracted the package.

Regarding wsdl this is the only URL provided to us by the service provider and every thing else needs to be done by us. This is a government department so technical support from their side is not available.

Regards
Anoop
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 576

Hi Anoop,
I did it using new WebServices and extracted the package.

Don't you know what is the web services API you are using within Eclipse? I'm sure Eclipse should prompt you whilst creating through its wizard. Check that out.
Regarding wsdl this is the only URL provided to us by the service provider and every thing else needs to be done by us. This is a government department so technical support from their side is not available

Okay, I'll check again this WSDL.
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 576

Alright, I quickly went through DIT_WS_User_Manual, which I don't need to but did out of curiosity

Hope you have taken care of getting digital certificate from the organization and no problem in authentication. Clearly, your SOAP request message is not properly created based on the exception stack trace. Can you post your SOAP request message here? Or you can validate within any browser if its well-formed.

Note: If you don't know how to get SOAP message, you can use Fiddler software to inspect complete HTTP request where your SOAP message is also present.

shubham srivastava
Greenhorn

Joined: Jan 04, 2011
Posts: 2
Anoop,

where you able to fix this?
parag dandegaonkar
Greenhorn

Joined: Jan 30, 2009
Posts: 7
Hello sir,
i am also facing the same problem:-- I am passing one attach zip file and one java object and call web service i am getting following error...(Using Apache AXIS2)

\\\AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.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:435)
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:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at in.gov.incometaxindiaefiling.itrservice.v_1_0.ITRServiceSoapBindingStub.submitITR(ITRServiceSoapBindingStub.java:252)
at com.august.itr.client.ITRClient.processUserItrDetails(ITRClient.java:138)
at com.august.itr.client.ITRClient.getItrDetails(ITRClient.java:68)
at com.august.itr.client.ITRClient.main(ITRClient.java:262)

{http://xml.apache.org/axis/}hostname:Parag-PC

org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
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:435)
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:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at in.gov.incometaxindiaefiling.itrservice.v_1_0.ITRServiceSoapBindingStub.submitITR(ITRServiceSoapBindingStub.java:252)
at com.august.itr.client.ITRClient.processUserItrDetails(ITRClient.java:138)
at com.august.itr.client.ITRClient.getItrDetails(ITRClient.java:68)
at com.august.itr.client.ITRClient.main(ITRClient.java:262)
Caused by: org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.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)
... 12 more

can you please tell me what can i do to resolve this bus

thank you in an advance.

SCJP5,SCWCD5
shubham srivastava
Greenhorn

Joined: Jan 04, 2011
Posts: 2
This is actually is a bit wierd the way these guys have written the ws . Moreover i m not going to highlight the bad part but as far as the solution is concerned generate your client proxy in Jdevloper and use the encoding type as MIME.

The rest you would have done by now.
Suresh Kiran
Greenhorn

Joined: Aug 11, 2012
Posts: 1

Hi . I am new to webservices and digital certificate, signature. I am using Eclipse and tomcat server for testing soapUI.
I have given a wsdl which is the same DIT user manual but for the ITRV Services.


https://incometaxindiaefiling.gov.in/ditws/v_1_0/ITRVServicePort?wsdl .

I have generated the java classes and jars from given wsdl.

Now i am getting same error as :

Error Message 4 ; nested exception is:
org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.


My another error is when i try to test the webservices using the SOAPUI. I am not getting the response.
But I am getting the plain html text as response.

Even i dont know whether i am in right path or not. Please any one can guide me.

I can be pleased to give information regarding this issue . Can you please tell me what can i do to resolve it.

Thanks in advance
 
jQuery in Action, 2nd edition
 
subject: Soap With Attachment Axis Fault