JAXB client, Failed to read a response: javax.xml.bind.UnmarshalException - java

I have a webservice use jaxb, in client I build webservice client jar file by Netbean. My problem is sometime client send request but can't read response object, follow exception:
Failed to read a response: javax.xml.bind.UnmarshalException
- with linked exception:
[javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,36959]
Message: Premature EOF]
com.sun.xml.internal.ws.encoding.soap.DeserializationException: Failed to read a response: javax.xml.bind.UnmarshalException
- with linked exception:
[javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,36959]
Message: Premature EOF]
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:113)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)

Try to intercept your XML requests and response as described here
You may solve your problem then.

Related

An error occurred marshalling the object [java.io.IOException: Broken pipe]

I'm getting an error in my Java Springboot application, and the error doesn't mention anywhere which object is failing to be marshalled. We have org.eclipse.persistence.core at v2.7.7.
The full error is:
An I/O error has occurred while writing a response message entity to the container output stream. javax.ws.rs.WebApplicationException: HTTP 500 Internal Server Error
at org.eclipse.persistence.jaxb.rs.MOXyJsonProvider.writeTo(MOXyJsonProvider.java:994)
....
[Exception [EclipseLink-25003] (Eclipse Persistence Services - 2.7.7.v20200504-69f2c2b80d): org.eclipse.persistence.exceptions.XMLMarshalException
Exception Description: An error occurred marshalling the object
Internal Exception: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe]
at org.eclipse.persistence.jaxb.JAXBMarshaller.marshal(JAXBMarshaller.java:513)
at org.eclipse.persistence.jaxb.rs.MOXyJsonProvider.writeTo(MOXyJsonProvider.java:992)
Any ideas on what can cause the broken pipe? Is it due to marshalling an unsupported object? Or maybe there's another underlying issue?

Unable to parse SOAP response

I am using JAX-WS to call a SOAP webservice. While parsing a SOAP response getting below exception. My SOAP client is a JAR which is running inside another web application deployed in Weblogic server.
javax.xml.soap.SOAPException: Error parsing envelope: most likely due to an invalid SOAP message.: Unexpected EOF in prolog
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:677)
at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2139)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2045)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1134)
at oracle.j2ee.ws.saaj.util.ResettableXMLStreamReader.next(ResettableXMLStreamReader.java:218)
at oracle.j2ee.ws.saaj.soap.StaxHandler.moveNext(StaxHandler.java:213)
at oracle.j2ee.ws.saaj.soap.StaxHandler.staxParse(StaxHandler.java:117)
at oracle.j2ee.ws.saaj.soap.StaxHandler.staxParse(StaxHandler.java:105)
at oracle.j2ee.ws.saaj.soap.StaxHandler.staxParse(StaxHandler.java:88)
at oracle.j2ee.ws.saaj.soap.AbstractSOAPImplementation.getStaXParsedEnvelope(AbstractSOAPImplementation.java:235)
at oracle.j2ee.ws.saaj.soap.AbstractSOAPImplementation.createEnvelope(AbstractSOAPImplementation.java:70)
Surprisingly I am able to print the SOAP response in the logs.

Axis2 web service invocation error

I tried to create a simple tester for my service and I get this exception:
Exception in thread "main" org.apache.axis2.AxisFault: java.lang.UnsupportedOperationException: An access occurred that is not valid.
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.RobustOutOnlyAxisOperation$RobustOutOnlyOperationClient.handleResponse(RobustOutOnlyAxisOperation.java:91)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at pinservice.PinOperationStub.changePin(PinOperationStub.java:496)
at pinservice.PinOperationTester.main(PinOperationTester.java:22)
any help on troubleshooting this error or thoughts on why this happens ?
It is an incorrect use of message receiver (in-out and in-only). Make sure to update services.xml file with correct configuration. More details available in below link with simple example.
http://www.developer.com/services/article.php/3613896/Writing-an-Axis2-Service-from-Scratch.htm

Spring REST Template java.net.SocketException: Unexpected end of file from server

I have a REST Web Service made with Spring MVC 3.2.0 that calls others REST Web Services also with Spring MVC. I'm having the following exception:
25-11-2014 17:49:42-ERROR-ajp-/172.23.111.22:8109-9-pe.com.dummy.BusinessDummyImpl- I/O error on POST request for "http://172.23.111.23/dummy-2/rest/method1":Unexpected end of file from server; nested exception is java.net.SocketException: Unexpected end of file from server
org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://172.23.111.23/dummy-2/rest/method1":Unexpected end of file from server; nested exception is java.net.SocketException: Unexpected end of file from server
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:499)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:447)
at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:295)
Caused by: java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:747)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:608)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1334)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:479)
at org.springframework.http.client.SimpleClientHttpResponse.getRawStatusCode(SimpleClientHttpResponse.java:47)
at org.springframework.http.client.AbstractClientHttpResponse.getStatusCode(AbstractClientHttpResponse.java:32)
at org.springframework.web.client.DefaultResponseErrorHandler.getHttpStatusCode(DefaultResponseErrorHandler.java:55)
at org.springframework.web.client.DefaultResponseErrorHandler.hasError(DefaultResponseErrorHandler.java:49)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:485)
... 42 more
It happens randomly and when I check the log on dummy-2 WS there is no trace of error.
What can be causing this error?

java.security.PrivilegedActionException while hitting webservices over https

I am getting the following exception, when i am trying to hit the webservice over https using java client:
com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection post
SEVERE: SAAJ0009: Message send failed
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Message send failed
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:157)
at
Also if i use the same code for http , it works fine. Webservices are deployed on weblogic server.
Could anyone help me in resolving the issue.
Regards
Gurleen.
The exception says that message cannot be sent.
Is it a firewall problem like for the same question here : http://www.coderanch.com/t/223309/Web-Services/java/Sending-Soap-requests-thru-Https

Categories