wood burning stoves 2.0*
The moose likes Web Services and the fly likes unable to tcpmon a web service consumer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "unable to tcpmon a web service consumer" Watch "unable to tcpmon a web service consumer" New topic
Author

unable to tcpmon a web service consumer

Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Hi All,

There is Amazon web service at http://soap.amazon.com/schemas3/AmazonWebServices.wsdl and I wrote a axis web service client that uses stubs to consume the above wsdl service. Now how can I use Axis tcpmon tool to monitor the web service request and web service response. I think using tcpmon we can only monitor web service soap requests but not soap responses.


RR Kumaran
SCJP 1.4
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
I guess Tcpmon monitor has listener port where your client will make a request localhost:8888 and it will then be sent to original target port amazon.com:80 ...by that way you see the request and response.
You may have to try it.

i am sure tcpTrace has this option.


Spritle Software Blogs
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Hi Balaji,

For my example, can you please list down the various settings required in tcpmon since I am not getting what is the listen-port settings and I have only the http-proxy-support settings, listener-target-hostname settings and listener-target-port settings ...
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Sorry Nritya, I am not very much aware of that settings and dont have time to test and tell it to you.
AW keep us informed.
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
TCPMon traces requests and associated responses without any additional setting.
So if you are able to send your request to a TCPMon port, you'll also see the SOAP response.


/ JeanLouis<br /><i>"software development has been, is, and will remain fundamentally hard" (Grady Booch)</i><br /> <br />Take a look at <a href="http://www.epfwiki.net/wikis/openup/" target="_blank" rel="nofollow">Agile OpenUP</a> in the Eclipse community
Dharamvir (DV) Punia
Ranch Hand

Joined: Oct 04, 2004
Posts: 34
I have never used TCPMon which comes with axis but I do use TCP/IP Monitor which comes with wsad. In order to track your reponse from external host, you need to change your settings in your tcp ip monitor to reflect "Remote Host Name" or "Remote host" which ever is used by TCPMon.

e.g in wsad, I can specify the following:
local port = 9081
Remote Host Name= www.javaranch.com
Remote Port = 80

So using same idea, you should be able to apply on TCPMon.

-DV
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Jean- First of all my requests are thro' stubs generated over the wsdl file imported from amazon website and as you said the requests are not to the listen port (whatever we set) of tcpmon. Since stubs handle the request to actual remote ip and remote port (both belonging to amazon) and the response comes from amazon web site, in such cases how to we configure the listen port in tcpmon ?

i believe we can use tcpmon only on the server where web service provider exists but not on the client side where the web service is consumed. am I right guys ?
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
Nritya ,

Are you using static stub generation or dynamic stub generation. ?

The static method allows you to change the code (thus the port) before runtime invocation.
So you can redirect the call to a TCP/Mon port, modifying the source code

You can use A TCP/Monitor to intercept any request between a Consumer and a Provider. But for simplicity you should consider using NetTool (capescience.com). NetTool has 2 feature, TCP monitoring and TCP tunneling.

So you can send your request to the NetTool port, and NetTool will redirect them to the server port.
[ December 15, 2004: Message edited by: Jean-Louis Marechaux ]
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Jean- to be more specific in the steps that i have tried, i am using stub based approached and i modified the line in the stub generated AmazonSearchServiceLocator.java

from

private java.lang.String AmazonSearchPort_address = "http://soap.amazon.com:88/onca/soap3";

to

private java.lang.String AmazonSearchPort_address = "http://localhost:88/onca/soap3";


and I compiled all the stubs and when I ran the client that uses the above such stubs, I am getting below error:

JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
If your TCPMon is listening on port 88 of localhost and forwarding to the real Amazon service, I can't figure out why it does not work.
You try to go from A to B and inserting a TCPMON between the source and the destination is just something like :
A--> TCPMON -->B

I've done it a couple of time, both with TCPMon and NetTools withouyt any error or problem

Can you see any log in your TCPMon. Is it properly started on localhost:88 ??

btw, not that I wonder a lot but my full firstname is Jean-Louis (a composed firstname)
[ December 17, 2004: Message edited by: Jean-Louis Marechaux ]
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Jean-Louis- I am using Apache AXIS's tcpmon and did you ever try ur tcpmon to monitor remote web services hosted at amazon,ebay,google,netmethods etc. ?

Is my stub based approached illustrated in previous mail correct ?

Even if I configured tcpmon's listen port as 88, how does it all requests to localhost:88 redirected to tcpmon ?
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
Maybe I've missed something here, so please correct me if needed.

1 - Your web service provider (ebay, amazon, etc..) is remote. Nevertheless, your web service consumer (your stub) is local and static (so pre generated) as you told me in a previous post

2 - Your consumer stub sends requests to a remote server, lets say http//amazon:999/amazonService/ as an example

3 - Even If your stub is local and your provider is remote, you can insert a TCP sniffer between them
Ex :
- modify your stub to send SOAP requests to http://localhost:88/amazonService instead of the real URL provider
- Install TCPMON on localhost and configure it to listen to port 88 and to redirect from localhost:88 to amazon:999

can you do that ?
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
may be I am doing something wrong in changing the remote server and port in the generated stubs to localhost:88. are there any checklist for this process or any urls, tutorials that explain my case

I think there is no error in configuring tcpmon but the generated stubs.
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
No there's nothing wrong, and that's what I've tried to explain in my previous post (part 3 - modify your stub)

So, now that your stub sends requests to http://localhost:88/onca/soap3, and if (AND ONLY IF) TCPMON is properly configured and started (Listen port = 88, status = waiting for connections), then you should at leat see all the requests logged in TCPMON

BUT :

1 - Due to the configuration you've chosen (localhost), your STUB and your TCPMON have to be installed on the same machine (trivial, but who knows....)

2 - Double check your port 88 is not already used by another process.
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Jean-

after I created the stubs using AXIS, I have changed the below code in AmazonSearchServiceLocator.java

from



to




and I configured axis's tcpmon tool to run on listen port 88 and checked the radio button "act as listener" and gave the remote server as soap.amazon.com and remote port as 80.


Is the above procedure correct. Do I need to change any more stub file generated by axis. The Web Service I am trying to consume is at url http://soap.amazon.com/schemas3/AmazonWebServices.wsdl ?
James Clinton
Ranch Hand

Joined: Jun 23, 2003
Posts: 190
Have you got TCPMON working?

If not, this how I've used it locally. HTH.

JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
Morning Nritya,

According to your post "December 16, 2004 11:28 PM", your changes in the locator are ok 'cause the error message indicates a problem with localhost:88

I believe your TCPMON config is not correct, but I've no idea why ??

1- Could you tell me if you see something in the TCPMON (a http trace in the pane ?

2 - Could you test another port, like 7777 or 8888 instaed of 88 and let us know what occurs.
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Jean-

I have changed 88 to 7080 in both AmazonSearchServiceLocator.java as well as tcmpmon listen port but I am getting "Waiting for Connection" in tcpmon and when I run my client I am getting http response as "faultString: (503)Service Unavailable"

Still I am trying my luck ...
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
Hi Nritya

Sounds like you were able to send a request to the Amazon web service now that you've changed the TCPMon listening port.
Could you confirm you see both the request AND the response (SOAPFault) logged in TCPMOn ??
If yes, maybe now you are just facing an Amazon problem. Their service is not up and running


(remember my firstname is Jean-Louis )
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
neither I can see the soap request and soap response in tcpmon. I think the request is not routed to tcpmon in the first place.

Are there any tutorials, links that explain how to use tcpmon for monitoring remote servers.

Jean, please give me your personal id so that I can send screenshot of my tcpmon.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unable to tcpmon a web service consumer