Hi, 

I am trying to return multiple messages back from the server to the
client's callback, however, I keep getting this error:

org.apache.axis2.AxisFault: Invalid message addition , operation context
completed
        at
org.apache.axis2.description.OutInAxisOperation.addMessageContext(OutInA
xisOperation.java:64)
        at
org.apache.axis2.context.OperationContext.addMessageContext(OperationCon
text.java:89)
        at
org.apache.axis2.engine.AddressingBasedDispatcher.invoke(AddressingBased
Dispatcher.java:121)
        at org.apache.axis2.engine.Phase.invoke(Phase.java:377)

on the client.

Any ideas?

Roshan Punnoose
Phone: 301-497-6039

-----Original Message-----
From: Punnoose, Roshan [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 18, 2006 1:37 PM
To: [email protected]
Subject: [Axis2] Problem using a ServiceClient on the server

I am trying to push back a response to a Client's Callback listener, but
I keep getting this error:

Caused by: java.lang.IllegalStateException: Current state not
START_ELEMENT
        at
com.ctc.wstx.sr.BasicStreamReader.getAttributeCount(BasicStreamReader.ja
va:582)
        at
org.apache.axiom.om.impl.builder.StAXBuilder.processAttributes(StAXBuild
er.java:130)
        at
org.apache.axiom.om.impl.mtom.MTOMStAXSOAPModelBuilder.createOMElement(M
TOMStAXSOAPModelBuilder.java:126)
        at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:1
25)
        ... 31 more

Here is my code:

OMFactory fac = OMAbstractFactory.getOMFactory();
                OMNamespace omNs = fac.createOMNamespace(
                                "http://example1.org/example1";,
"example1");

                OMElement data = fac.createOMElement("mtomSample",
omNs);

                OMElement file = fac
                                .createOMElement("file",
data.getDefaultNamespace());

                FileDataSource fileDataSource = new
FileDataSource("C:/temp/query.txt");
                DataHandler dataHandler = new
DataHandler(fileDataSource);

                OMText textData = fac.createOMText(dataHandler, true);
                file.addChild(textData);
                data.addChild(file);

                Options options = new Options();
        
options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
                options.setTo(ref);
                options.setProperty(Constants.Configuration.ENABLE_MTOM,
                                Constants.VALUE_TRUE);
        
options.setProperty(Constants.Configuration.CACHE_ATTACHMENTS,
                                Constants.VALUE_TRUE);
        
options.setProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR,
                                "C:/temp/attachments_temp");
        
options.setProperty(Constants.Configuration.FILE_SIZE_THRESHOLD,
                                "10240");
        
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

                RelatesTo relatesTo = new RelatesTo(
        
AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE,
                                messageId);
                options.setRelationships(new RelatesTo[] { relatesTo });

                ServiceClient client = null;
                try {
                        Thread.sleep(5000);
                        client = new ServiceClient();
                        client.setOptions(options);
                        client.sendReceive(file);
                } catch (Exception e) {
                        e.printStackTrace();
                }

Any ideas why this might be happening? It works if I just return the
same OMElement synchronously through the invoked method.

Roshan
BEGIN:VCARD
VERSION:2.1
N:Punnoose;Roshan
FN:Punnoose, Roshan
ADR;WORK:;2115
LABEL;WORK:2115
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:20050413T183207Z
END:VCARD
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to