Hello,
If someone familiar with creating service clients with AXIOM, please help!
I was checked for outgoing SOAP messages with http sniffer on client
requests to server and realized that some of them is malformed by
interleaving each other why other is empty. Sometimes they become so twisted
that even result = sender.sendReceive(method); can't pass XML structure
analyze phase and can't do the request at all - exceptions thrown is very
varied then, but all of them indicates broken XML structure. How can this
happen?
I didn't use any static objects in my code which can assign to the same
static variables and i checked content of outgoing OMElement - it's always
well-formed. Problem happen inside sendReceive method.
I suppose sendReceive method of sender object sometimes write to same
httpclient stream. How i can
avoid such interleaving?
Example of such broken request:
1 thread: <??xmxlml ..... (and so on)
while
2 thread is empty
but
3 thread's request is properly formed and passed
ServiceClient sender = new ServiceClient();
sender.setOptions(options);
result = sender.sendReceive(method);
very sorry for bad english.
With hope,
Daniil
2008/12/4 Daniil Chipenko <[EMAIL PROTECTED]>
> Good day,
>
> I'm using Axis2 1.4 with tomcat5.5 and created both service and client from
> a scratch with AXIOM via HTTP port.
> And they worked together like charm, just before i'm beggining to put them
> under some load. Even when there is just 3 simultaneous calls - one of my
> client threads written with AXIOM begins to throw varied exceptions without
> any stack trace, like:
>
> org.apache.axiom.om.OMException
> or
> org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException:
> ParseError at [row,col]:[1,1]
> Message: An invalid XML character (Unicode: 0x0) was found in the comment.
> or
> com.sun.org.apache.xerces.internal.xni.XNIException: Scanner State 7 not
> Recognized
> or
> org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException:
> ParseError at [row,col]:[1,1]
> Message: Open quote is expected for attribute "{1}" associated with an
> element type "name".
> ... and this happens not always, but approx. 1/3 times of 3
> simultaneus threads starts.
>
> Here is my code:
>
> OMElement method = fac.createOMElement(new QName(chartName));
>
> for(String key : keys){
> OMElement value = fac.createOMElement(new QName(key));
> String mapvalue = ((String[]) params.get(key))[0];
> value.addChild(fac.createOMText(value, mapvalue));
> method.addChild(value);
> }
>
> Options options = new Options();
> options.setTo(ApplicationProperties.targetEPRFinance);
> options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> OMElement result = fac.createOMElement(new
> QName("EmptyResult"));
>
> System.out.println("Payload for service: " +
> method.toString());
>
> try {
> ServiceClient sender = new ServiceClient();
> sender.setOptions(options);
> result = sender.sendReceive(method);
> } catch (AxisFault e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> System.out.println("Result from service: " +
> result.toString());