You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "nagaveni.g22" <na...@gmail.com> on 2013/06/06 15:16:50 UTC

CXF gives an javax.xml.ws.soap.SOAPFaultException: Error reading XMLStreamReader when the SOAP response is blank

Hi, 

I have a scenario, where my response from the server will be blank for few
operations, when server responds blank, my cxf codes gives me this exception 

 Inbound Message
----------------------------
ID: 3
Response-Code: 200
Encoding: ISO-8859-1
Content-Type: application/pdf
Headers: {Content-length=[100], Content-type=[application/pdf], Date=[Thu,
06 Jun 2013 13:02:34 GMT], Transfer-encoding=[chunked]}
--------------------------------------

 javax.xml.ws.soap.SOAPFaultException: Error reading XMLStreamReader.

here is the code where i am getting the error 

SOAPMessage soapRequest = dispatcher.createMessage();
		if (request.getSOAPHeader() != null
				&& request.getSOAPHeader().getAny().size() > 0) {
			Node header = request.getSOAPHeader().getAny().get(0);
			SOAPHeader soapHeader = soapRequest.getSOAPHeader();
			Node importedHeaderNode = soapHeader.getOwnerDocument().importNode(
					header, true);
			soapHeader.appendChild(importedHeaderNode);
		}
		Node body = request.getSOAPBody().getAny().get(0);

		SOAPBody soapBody = soapRequest.getSOAPBody();
		Node importedBodyNode = soapBody.getOwnerDocument().importNode(body,
				true);
		soapBody.appendChild(importedBodyNode);
		soapRequest.saveChanges();

		/** Invoke the service endpoint. **/
		SOAPMessage response = dispatcher.invoke(soapRequest);

"SOAPMessage response = dispatcher.invoke(soapRequest);" line gets the
exception, is there any way i can treat blank response as success?

Quick response will be appreciated. Many thanks. 




--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-gives-an-javax-xml-ws-soap-SOAPFaultException-Error-reading-XMLStreamReader-when-the-SOAP-responk-tp5728846.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF gives an javax.xml.ws.soap.SOAPFaultException: Error reading XMLStreamReader when the SOAP response is blank

Posted by Daniel Kulp <dk...@apache.org>.
On Jun 6, 2013, at 9:16 AM, nagaveni.g22 <na...@gmail.com> wrote:

> Hi, 
> 
> I have a scenario, where my response from the server will be blank for few
> operations, when server responds blank, my cxf codes gives me this exception 
> 
> Inbound Message
> ----------------------------
> ID: 3
> Response-Code: 200
> Encoding: ISO-8859-1
> Content-Type: application/pdf
> Headers: {Content-length=[100], Content-type=[application/pdf], Date=[Thu,
> 06 Jun 2013 13:02:34 GMT], Transfer-encoding=[chunked]}

This doesn't look blank to me.   It's got a content-lenght of 100 and type of application/pdf.

Basically, for a SOAP call, this would be a completely invalid response.

You could try the invokeOneWay call on dispatch.   That MIGHT work.

Dan



> --------------------------------------
> 
> javax.xml.ws.soap.SOAPFaultException: Error reading XMLStreamReader.
> 
> here is the code where i am getting the error 
> 
> SOAPMessage soapRequest = dispatcher.createMessage();
> 		if (request.getSOAPHeader() != null
> 				&& request.getSOAPHeader().getAny().size() > 0) {
> 			Node header = request.getSOAPHeader().getAny().get(0);
> 			SOAPHeader soapHeader = soapRequest.getSOAPHeader();
> 			Node importedHeaderNode = soapHeader.getOwnerDocument().importNode(
> 					header, true);
> 			soapHeader.appendChild(importedHeaderNode);
> 		}
> 		Node body = request.getSOAPBody().getAny().get(0);
> 
> 		SOAPBody soapBody = soapRequest.getSOAPBody();
> 		Node importedBodyNode = soapBody.getOwnerDocument().importNode(body,
> 				true);
> 		soapBody.appendChild(importedBodyNode);
> 		soapRequest.saveChanges();
> 
> 		/** Invoke the service endpoint. **/
> 		SOAPMessage response = dispatcher.invoke(soapRequest);
> 
> "SOAPMessage response = dispatcher.invoke(soapRequest);" line gets the
> exception, is there any way i can treat blank response as success?
> 
> Quick response will be appreciated. Many thanks. 
> 
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/CXF-gives-an-javax-xml-ws-soap-SOAPFaultException-Error-reading-XMLStreamReader-when-the-SOAP-responk-tp5728846.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com