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 "Punnoose, Roshan" <pu...@bah-systems.com> on 2006/09/18 19:37:06 UTC

[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