You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Ali Sadik Kumlali <as...@yahoo.com> on 2006/05/14 00:11:23 UTC
[Axis2][1.0] Unexpected EOF in prolog
Hi all,
Has anyone ran into this exception? I could manage :) to get it with
following steps:
- Used EchoBlockingDualClient sample. Didn't change client code.
- Changed message receiver of MyService to RawXMLINOnlyMessageReceiver
- Changed MyService.java as following:
----------------------------------------------------------------------
public class MyService {
private MessageContext inMsgCtx;
public void setOperationContext(OperationContext opctx)
throws AxisFault {
inMsgCtx =
opctx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
}
public void echo (OMElement incomingPayload)
throws XMLStreamException {
incomingPayload.build();
incomingPayload.detach();
OMElement outgoingPayload = incomingPayload;
oldOptions = inMsgCtx.getOptions();
String messageID = inMsgCtx.getMessageID();
EndpointReference targetEPR = oldOptions.getReplyTo();
String action = oldOptions.getAction();
sendResult(messageID, targetEPR, action, outgoingPayload);
}
public void sendResult(String messageId, EndpointReference targetEPR,
String action, OMElement payload) {
ServiceClient sender = null;
try {
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setUseSeparateListener(false);
options.setAction(action);
options.setMessageId(UUIDGenerator.getUUID());
options.setRelationships(new RelatesTo[] {
new RelatesTo(messageId,
AddressingConstants.Submission.
WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE)});
ConfigurationContext confCtx =
ListenerManager.defaultConfigurationContext;
sender = new ServiceClient(confCtx, null);
sender.setOptions(options);
// Blocking Invocation
sender.sendReceive(payload);
} catch (AxisFault axisFault) {
axisFault.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
sender.finalizeInvoke();
} catch (AxisFault axisFault) {
// have to ignore this
axisFault.printStackTrace();
}
}
}
}
----------------------------------------------------------------------
When I pass "true" to setUseSeparateListener(), there is no problem.
Otherwise I get following exception:
----------------------------------------------------------------------
[DEBUG][2006-05-13 23:15:08,046] org.apache.axis2.engine.Phase -
Checking post-conditions for phase "MessageOut"
postMethod.getStatusCode(): 200
contentEncoding: null
org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException:
Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]; nested exception is:
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException:
Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:126)
at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:349)
at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:279)
at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:513)
...
----------------------------------------------------------------------
Is it normal behavior due to a missing point in my code, or is it a
bug?
Any help would be appreciated.
Regards,
Ali Sadik Kumlali
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: [Axis2][1.0] Unexpected EOF in prolog
Posted by Ali Sadik Kumlali <as...@yahoo.com>.
Hi Chamikara,
Thank you very much for the valuable comments. With your help, I've
discovered that my assumption was wrong. In sendResult(), I must have
call fireAndForget() instead of sendReceive(), since I didn't expect a
response from the client. By using fireAndForget() the code runs as
expected.
Now, only thing remained is to make my custom fireAndForget() that let
me handle HTTP 500 situations ;-)
Regards,
Ali Sadik Kumlali
--- Chamikara Jayalath <ch...@gmail.com> wrote:
> Hi Ali,
>
> Even though you have done changes to your service code you are still
> using
> the serviceClient.sendReceive() method in the client side which uses
> the
> OutInAxisOperationClient.
>
> When useSeperateListner=false, OutInAxisOperationClient expects a
> same-channel response message and that should be the reason for this
> exception. When it is true what is expected is a asnyc response which
> you
> send within your service code.
>
> Chamikara
>
>
> On 5/14/06, Ali Sadik Kumlali <as...@yahoo.com> wrote:
> >
> > Hi all,
> >
> > Has anyone ran into this exception? I could manage :) to get it
> with
> > following steps:
> >
> > - Used EchoBlockingDualClient sample. Didn't change client code.
> > - Changed message receiver of MyService to
> RawXMLINOnlyMessageReceiver
> > - Changed MyService.java as following:
> >
> >
>
----------------------------------------------------------------------
> > public class MyService {
> >
> > private MessageContext inMsgCtx;
> >
> > public void setOperationContext(OperationContext opctx)
> > throws AxisFault {
> > inMsgCtx =
> >
> opctx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> > }
> >
> > public void echo (OMElement incomingPayload)
> >
> > throws XMLStreamException {
> > incomingPayload.build();
> > incomingPayload.detach();
> >
> > OMElement outgoingPayload = incomingPayload;
> >
> > oldOptions = inMsgCtx.getOptions();
> > String messageID = inMsgCtx.getMessageID();
> > EndpointReference targetEPR = oldOptions.getReplyTo();
> > String action = oldOptions.getAction();
> > sendResult(messageID, targetEPR, action, outgoingPayload);
> > }
> >
> > public void sendResult(String messageId, EndpointReference
> targetEPR,
> > String action, OMElement payload) {
> > ServiceClient sender = null;
> > try {
> > Options options = new Options();
> > options.setTo(targetEPR);
> > options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> > options.setUseSeparateListener(false);
> > options.setAction(action);
> > options.setMessageId(UUIDGenerator.getUUID());
> > options.setRelationships(new RelatesTo[] {
> > new RelatesTo(messageId,
> > AddressingConstants.Submission.
> > WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE)});
> >
> > ConfigurationContext confCtx =
> > ListenerManager.defaultConfigurationContext;
> > sender = new ServiceClient(confCtx, null);
> > sender.setOptions(options);
> >
> > // Blocking Invocation
> > sender.sendReceive(payload);
> > } catch (AxisFault axisFault) {
> > axisFault.printStackTrace();
> > } catch (Exception ex) {
> > ex.printStackTrace();
> > } finally {
> > try {
> > sender.finalizeInvoke();
> > } catch (AxisFault axisFault) {
> > // have to ignore this
> > axisFault.printStackTrace();
> > }
> > }
> > }
> > }
> >
>
----------------------------------------------------------------------
> >
> > When I pass "true" to setUseSeparateListener(), there is no
> problem.
> > Otherwise I get following exception:
> >
> >
>
----------------------------------------------------------------------
> > [DEBUG][2006-05-13 23:15:08,046] org.apache.axis2.engine.Phase -
> > Checking post-conditions for phase "MessageOut"
> > postMethod.getStatusCode(): 200
> > contentEncoding: null
> > org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException:
> > Unexpected EOF in prolog
> > at [row,col {unknown-source}]: [1,0]; nested exception is:
> > org.apache.axiom.om.OMException:
> com.ctc.wstx.exc.WstxEOFException
> > :
> > Unexpected EOF in prolog
> > at [row,col {unknown-source}]: [1,0]
> > at
> > org.apache.axis2.transport.TransportUtils.createSOAPMessage(
> > TransportUtils.java:126)
> > at
> > org.apache.axis2.transport.TransportUtils.createSOAPMessage(
> > TransportUtils.java:67)
> > at
> > org.apache.axis2.description.OutInAxisOperationClient.send(
> > OutInAxisOperation.java:349)
> > at
> > org.apache.axis2.description.OutInAxisOperationClient.execute(
> > OutInAxisOperation.java:279)
> > at
> >
>
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:513)
> > ...
> >
>
----------------------------------------------------------------------
> >
> > Is it normal behavior due to a missing point in my code, or is it a
> > bug?
> >
> > Any help would be appreciated.
> >
> > Regards,
> >
> > Ali Sadik Kumlali
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: [Axis2][1.0] Unexpected EOF in prolog
Posted by Chamikara Jayalath <ch...@gmail.com>.
Hi Ali,
Even though you have done changes to your service code you are still using
the serviceClient.sendReceive() method in the client side which uses the
OutInAxisOperationClient.
When useSeperateListner=false, OutInAxisOperationClient expects a
same-channel response message and that should be the reason for this
exception. When it is true what is expected is a asnyc response which you
send within your service code.
Chamikara
On 5/14/06, Ali Sadik Kumlali <as...@yahoo.com> wrote:
>
> Hi all,
>
> Has anyone ran into this exception? I could manage :) to get it with
> following steps:
>
> - Used EchoBlockingDualClient sample. Didn't change client code.
> - Changed message receiver of MyService to RawXMLINOnlyMessageReceiver
> - Changed MyService.java as following:
>
> ----------------------------------------------------------------------
> public class MyService {
>
> private MessageContext inMsgCtx;
>
> public void setOperationContext(OperationContext opctx)
> throws AxisFault {
> inMsgCtx =
> opctx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> }
>
> public void echo (OMElement incomingPayload)
>
> throws XMLStreamException {
> incomingPayload.build();
> incomingPayload.detach();
>
> OMElement outgoingPayload = incomingPayload;
>
> oldOptions = inMsgCtx.getOptions();
> String messageID = inMsgCtx.getMessageID();
> EndpointReference targetEPR = oldOptions.getReplyTo();
> String action = oldOptions.getAction();
> sendResult(messageID, targetEPR, action, outgoingPayload);
> }
>
> public void sendResult(String messageId, EndpointReference targetEPR,
> String action, OMElement payload) {
> ServiceClient sender = null;
> try {
> Options options = new Options();
> options.setTo(targetEPR);
> options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> options.setUseSeparateListener(false);
> options.setAction(action);
> options.setMessageId(UUIDGenerator.getUUID());
> options.setRelationships(new RelatesTo[] {
> new RelatesTo(messageId,
> AddressingConstants.Submission.
> WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE)});
>
> ConfigurationContext confCtx =
> ListenerManager.defaultConfigurationContext;
> sender = new ServiceClient(confCtx, null);
> sender.setOptions(options);
>
> // Blocking Invocation
> sender.sendReceive(payload);
> } catch (AxisFault axisFault) {
> axisFault.printStackTrace();
> } catch (Exception ex) {
> ex.printStackTrace();
> } finally {
> try {
> sender.finalizeInvoke();
> } catch (AxisFault axisFault) {
> // have to ignore this
> axisFault.printStackTrace();
> }
> }
> }
> }
> ----------------------------------------------------------------------
>
> When I pass "true" to setUseSeparateListener(), there is no problem.
> Otherwise I get following exception:
>
> ----------------------------------------------------------------------
> [DEBUG][2006-05-13 23:15:08,046] org.apache.axis2.engine.Phase -
> Checking post-conditions for phase "MessageOut"
> postMethod.getStatusCode(): 200
> contentEncoding: null
> org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException:
> Unexpected EOF in prolog
> at [row,col {unknown-source}]: [1,0]; nested exception is:
> org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException
> :
> Unexpected EOF in prolog
> at [row,col {unknown-source}]: [1,0]
> at
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(
> TransportUtils.java:126)
> at
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(
> TransportUtils.java:67)
> at
> org.apache.axis2.description.OutInAxisOperationClient.send(
> OutInAxisOperation.java:349)
> at
> org.apache.axis2.description.OutInAxisOperationClient.execute(
> OutInAxisOperation.java:279)
> at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:513)
> ...
> ----------------------------------------------------------------------
>
> Is it normal behavior due to a missing point in my code, or is it a
> bug?
>
> Any help would be appreciated.
>
> Regards,
>
> Ali Sadik Kumlali
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>