Hi,
Please have a look at following blog posts, which explain how to debug
async clients.
[1]http://charithaka.blogspot.com/2008/07/how-to-monitor-messages-using-tcpmon-in.html
[2]http://pzf.fremantle.org/2008/07/how-to-debug-async-responses-in-axis2.html
regards
Charitha
http://charithaka.blogspot.com
www.wso2.org
Hasnain Badami wrote:
Hi
I am trying to debug an axis client, which interacts with a c#
webservice. I am sending three hello requests using the code
DMTServiceStub dmtStub =
*new* DMTServiceStub(); // Related to ws-addressing
dmtStub._getServiceClient().engageModule(Constants.
/MODULE_ADDRESSING/);
dmtStub._getServiceClient().getOptions().setUseSeparateListener(
*true*);
HttpTransportProperties.ProxyProperties pp =
*new* HttpTransportProperties.ProxyProperties();
pp.setProxyName(
"localhost");
pp.setDomain(
"localhost");
pp.setProxyPort(7070);
Options axisOptions = dmtStub._getServiceClient().getOptions();
axisOptions.setProperty(org.apache.axis2.transport.http.HTTPConstants.
/PROXY/, pp);
axisOptions.setProperty(org.apache.axis2.transport.http.HTTPConstants.
/REUSE_HTTP_CLIENT/, *true*);
axisOptions.setTransportInProtocol(Constants.
/TRANSPORT_HTTP/);
dmtStub._getServiceClient().setOptions(axisOptions);
DMTServiceCallbackHandler callback =
*new* DMTServiceCallbackHandler(*null*){ *public* *void*
receiveResultHello(org.tempuri.HelloResponseDocument result){
/log/.info("Call back, " + result.getHelloResponse().getHelloResult());
}
*public* *void* receiveErrorHello(Exception e){ /log/.info("Error
received " + e);
}
};
*for*(*int* counter=0; counter<3; counter++)
{
HelloDocument helloEnvelope = HelloDocument.Factory./newInstance/();
Hello helloRequest = Hello.Factory./newInstance/();
helloRequest.setMyValue(
"Hello, my name is HB " + counter);
helloEnvelope.setHello(helloRequest);
dmtStub.startHello(helloEnvelope, callback);
}
*I am using tcpmon to view the request and response. Using the above
code, axis2 starts listening at port 6060 for the response, but it
never gets any response. Tcpmon shows me the response that is being
sent. I can see that my axis2 client is setting the header
<wsa:ReplyTo> and <wsa:Address>, but its still not receiving any
response from the server, whereas tcpmon shows that the response is
coming in. Can anybody help me in debugging this scenario? I have
really spent a lot of time and am in difficulty. Interestingly if I set *
*dmtStub._getServiceClient().getOptions().setUseSeparateListener(true)
to false, I start receiving the response in my callback handler. I
cant understand what s going on.*
*Request tcpmon recieves:*
POST http://localhost:8001/DMTService/DMTService HTTP/1.1
Content-Type: application/soap+xml; charset=UTF-8;
action="http://tempuri.org/IDMTService/Hello"
User-Agent: Axis2
Host: localhost:8001
Proxy-Connection: Keep-Alive
Transfer-Encoding: chunked
290
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsa="http://www.w3.org/2005/08/addressing"><soapenv:Header><wsa:To>http://localhost:8001/DMTService/DMTService</wsa:To><wsa:ReplyTo><wsa:Address>http://10.0.75.51:6060/axis2/services/DMTService12499184</wsa:Address></wsa:ReplyTo><wsa:MessageID>urn:uuid:DA179A9626ABCF16EE1217410510466</wsa:MessageID><wsa:Action>http://tempuri.org/IDMTService/Hello</wsa:Action></soapenv:Header><soapenv:Body><Hello
<http://www.w3.org/2005/08/addressing%22%3E%3Csoapenv:Header%3E%3Cwsa:To%3Ehttp://localhost:8001/DMTService/DMTService%3C/wsa:To%3E%3Cwsa:ReplyTo%3E%3Cwsa:Address%3Ehttp://10.0.75.51:6060/axis2/services/DMTService12499184%3C/wsa:Address%3E%3C/wsa:ReplyTo%3E%3Cwsa:MessageID%3Eurn:uuid:DA179A9626ABCF16EE1217410510466%3C/wsa:MessageID%3E%3Cwsa:Action%3Ehttp://tempuri.org/IDMTService/Hello%3C/wsa:Action%3E%3C/soapenv:Header%3E%3Csoapenv:Body%3E%3CHello>
xmlns="http://tempuri.org/"><myValue
<http://tempuri.org/%22%3E%3CmyValue>
xmlns="http://tempuri.org/">Hello <http://tempuri.org/%22%3EHello>, my
name is HB 0</myValue></Hello></soapenv:Body></soapenv:Envelope>
0
*Response tcpmon recieves:*
HTTP/1.1 200 OK
Content-Length: 428
Content-Type: application/soap+xml; charset=utf-8
Server: Microsoft-HTTPAPI/1.0
Date: Wed, 30 Jul 2008 09:35:10 GMT
Connection: close
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action
<http://www.w3.org/2005/08/addressing%22%3E%3Cs:Header%3E%3Ca:Action>
s:mustUnderstand="1">http://tempuri.org/IDMTService/HelloResponse</a:Action><a:RelatesTo>urn:uuid:DA179A9626ABCF16EE1217410510466</a:RelatesTo></s:Header><s:Body><HelloResponse
xmlns="http://tempuri.org/"><HelloResult>Hello
<http://tempuri.org/%22%3E%3CHelloResult%3EHello>: Hello, my name is
HB 0</HelloResult></HelloResponse></s:Body></s:Envelope>
------------------------------------------------------------------------
Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.524 / Virus Database: 270.4.7/1543 - Release Date: 7/9/2008 6:32 PM
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]