You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Glen Mazza <gl...@verizon.net> on 2007/11/21 09:07:32 UTC

Re: Problems calling 2 different web services from the same Eclipse Runtime...

Comments below...

Am Dienstag, den 20.11.2007, 23:57 -0800 schrieb Tophebboy:
> I don't know but I don't handle myself the BusFatory instanciation.
> I just have a client in each of my plugins which looks like the clients CXF
> generates automatically:
> 
> <code>
> String wsdlUrl = "my wsdl path";
> 		File wsdlFile = new File(wsdlUrl);
> 
> 		try {
> 			if (wsdlFile.exists()) {
> 				wsdlURL = wsdlFile.toURL();
> 			} else {
> 				wsdlURL = new URL(wsdlUrl);
> 			}
> 		} catch (MalformedURLException e) {
> 			e.printStackTrace();
> 		}
> 		try {
> 			System.out.println("Using WSDL: " + wsdlURL);
> 			MyRequestService ss = new MyRequestService(wsdlURL,
> 					SERVICE_NAME);
> 			
> 			MyRequest port = ss.getMyRequestPort();
> 

I would try to put your port and service initialization in a constructor
or initialize() method or similar--so it is only done once.  Presently
you are initializing these variables with every web service call, which
would be slow anyway.  Let us know if that worked.

HTH,
Glen



> 			
> 			// Uses the Web Service:
> 			//
> 			//Then, calls the method of port
> 
> </code>
> 
> 



Re: Problems calling 2 different web services from the same Eclipse Runtime...

Posted by Tophebboy <cb...@free.fr>.
I also tried using this:
<code>	
Service service = Service.create(SERVICE_NAME);
String endpointAddress =
EDocDocumentumPluginParam.EDocDocumentumPluginParam_EndpointAddress;

service.addPort(PORT_NAME, SOAPBinding.SOAP12HTTP_BINDING,
				endpointAddress);
_myPort = service.getPort(MyRequest.class);
</code>

instead of:

<code>
MyService ss = new MyService(wsdlURL,SERVICE_NAME);
_myPort = ss.getMyServicePort();
</code>

To get a reference on the port and I still have the same problem...Calling
several times one service is ok, but callin a service then another one leads
to the same ClassCastException...:-/


Tophebboy wrote:
> 
> Hi!
> This morning, I've tried putting the initialization stuff in an
> initialization methode which is called only one. And I still have the same
> problem...
> I will try to do what you're tellin later...
> Thanks.
> 
> 
> Glen Mazza-2 wrote:
>> 
>> BTW, may I ask, why do you need a different wsdl "each time"?  As far as
>> I can see you just need two WSDLs, one for each service.  If it is
>> because the endpoint changes, you can change the endpoint URL
>> programmatically--see Step #7 here[1].
>> 
>> Also, you said you are calling a different web service from two
>> different places.  What happens if you call the *same* web service from
>> those two different places--does it work then or break?  If the latter,
>> the fact that you are calling two different services may be just an
>> irrelevant distraction to finding the real problem.
>> 
>> What we will probably need from you next is a very simple one-class Java
>> application that iteratively asks a user if they want to call web
>> service #1 or #2, and then have two methods, one that calls each web
>> service.  Use the CXF samples in the /samples directory for web services
>> to call (call "ant server" on two of our web services).  If you can get
>> this program to work, that would mean the problem is somewhere else.  If
>> you cannot get the simple program to work, then send the program to us
>> in a JIRA report--it would be easier to then duplicate and then hunt
>> down the problem.
>> 
>> HTH,
>> Glen
>> 
>> [1] http://www.jroller.com/gmazza/date/20070817
>> 
>> Am Mittwoch, den 21.11.2007, 08:34 -0800 schrieb Tophebboy:
>>> I can call the same service 10 times, so I don't think it could come
>>> from
>>> that...The problem only comes when I call one service, the another
>>> one...
>>> On top of that, I'm currently doing tests to use CXF, and I need to be
>>> able
>>> to call the service with a different wsdl each time (I have to test the
>>> same
>>> service on several servers...). So I have to do it this way...
>>> Thanks very much anyway!
>>> Any other idea?
>>> 
>>> 
>>> Glen Mazza-2 wrote:
>>> > 
>>> > Comments below...
>>> > 
>>> > Am Dienstag, den 20.11.2007, 23:57 -0800 schrieb Tophebboy:
>>> >> I don't know but I don't handle myself the BusFatory instanciation.
>>> >> I just have a client in each of my plugins which looks like the
>>> clients
>>> >> CXF
>>> >> generates automatically:
>>> >> 
>>> >> <code>
>>> >> String wsdlUrl = "my wsdl path";
>>> >> 		File wsdlFile = new File(wsdlUrl);
>>> >> 
>>> >> 		try {
>>> >> 			if (wsdlFile.exists()) {
>>> >> 				wsdlURL = wsdlFile.toURL();
>>> >> 			} else {
>>> >> 				wsdlURL = new URL(wsdlUrl);
>>> >> 			}
>>> >> 		} catch (MalformedURLException e) {
>>> >> 			e.printStackTrace();
>>> >> 		}
>>> >> 		try {
>>> >> 			System.out.println("Using WSDL: " + wsdlURL);
>>> >> 			MyRequestService ss = new MyRequestService(wsdlURL,
>>> >> 					SERVICE_NAME);
>>> >> 			
>>> >> 			MyRequest port = ss.getMyRequestPort();
>>> >> 
>>> > 
>>> > I would try to put your port and service initialization in a
>>> constructor
>>> > or initialize() method or similar--so it is only done once.  Presently
>>> > you are initializing these variables with every web service call,
>>> which
>>> > would be slow anyway.  Let us know if that worked.
>>> > 
>>> > HTH,
>>> > Glen
>>> > 
>>> > 
>>> > 
>>> >> 			
>>> >> 			// Uses the Web Service:
>>> >> 			//
>>> >> 			//Then, calls the method of port
>>> >> 
>>> >> </code>
>>> >> 
>>> >> 
>>> > 
>>> > 
>>> > 
>>> > 
>>> 
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problems-calling-2-different-web-services-from-the-same-Eclipse-Runtime...-tf4844258.html#a13894181
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Problems calling 2 different web services from the same Eclipse Runtime...

Posted by Tophebboy <cb...@free.fr>.
Hi!
This morning, I've tried putting the initialization stuff in an
initialization methode which is called only one. And I still have the same
problem...
I will try to do what you're tellin later...
Thanks.


Glen Mazza-2 wrote:
> 
> BTW, may I ask, why do you need a different wsdl "each time"?  As far as
> I can see you just need two WSDLs, one for each service.  If it is
> because the endpoint changes, you can change the endpoint URL
> programmatically--see Step #7 here[1].
> 
> Also, you said you are calling a different web service from two
> different places.  What happens if you call the *same* web service from
> those two different places--does it work then or break?  If the latter,
> the fact that you are calling two different services may be just an
> irrelevant distraction to finding the real problem.
> 
> What we will probably need from you next is a very simple one-class Java
> application that iteratively asks a user if they want to call web
> service #1 or #2, and then have two methods, one that calls each web
> service.  Use the CXF samples in the /samples directory for web services
> to call (call "ant server" on two of our web services).  If you can get
> this program to work, that would mean the problem is somewhere else.  If
> you cannot get the simple program to work, then send the program to us
> in a JIRA report--it would be easier to then duplicate and then hunt
> down the problem.
> 
> HTH,
> Glen
> 
> [1] http://www.jroller.com/gmazza/date/20070817
> 
> Am Mittwoch, den 21.11.2007, 08:34 -0800 schrieb Tophebboy:
>> I can call the same service 10 times, so I don't think it could come from
>> that...The problem only comes when I call one service, the another one...
>> On top of that, I'm currently doing tests to use CXF, and I need to be
>> able
>> to call the service with a different wsdl each time (I have to test the
>> same
>> service on several servers...). So I have to do it this way...
>> Thanks very much anyway!
>> Any other idea?
>> 
>> 
>> Glen Mazza-2 wrote:
>> > 
>> > Comments below...
>> > 
>> > Am Dienstag, den 20.11.2007, 23:57 -0800 schrieb Tophebboy:
>> >> I don't know but I don't handle myself the BusFatory instanciation.
>> >> I just have a client in each of my plugins which looks like the
>> clients
>> >> CXF
>> >> generates automatically:
>> >> 
>> >> <code>
>> >> String wsdlUrl = "my wsdl path";
>> >> 		File wsdlFile = new File(wsdlUrl);
>> >> 
>> >> 		try {
>> >> 			if (wsdlFile.exists()) {
>> >> 				wsdlURL = wsdlFile.toURL();
>> >> 			} else {
>> >> 				wsdlURL = new URL(wsdlUrl);
>> >> 			}
>> >> 		} catch (MalformedURLException e) {
>> >> 			e.printStackTrace();
>> >> 		}
>> >> 		try {
>> >> 			System.out.println("Using WSDL: " + wsdlURL);
>> >> 			MyRequestService ss = new MyRequestService(wsdlURL,
>> >> 					SERVICE_NAME);
>> >> 			
>> >> 			MyRequest port = ss.getMyRequestPort();
>> >> 
>> > 
>> > I would try to put your port and service initialization in a
>> constructor
>> > or initialize() method or similar--so it is only done once.  Presently
>> > you are initializing these variables with every web service call, which
>> > would be slow anyway.  Let us know if that worked.
>> > 
>> > HTH,
>> > Glen
>> > 
>> > 
>> > 
>> >> 			
>> >> 			// Uses the Web Service:
>> >> 			//
>> >> 			//Then, calls the method of port
>> >> 
>> >> </code>
>> >> 
>> >> 
>> > 
>> > 
>> > 
>> > 
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problems-calling-2-different-web-services-from-the-same-Eclipse-Runtime...-tf4844258.html#a13893315
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Problems calling 2 different web services from the same Eclipse Runtime...

Posted by Glen Mazza <gl...@verizon.net>.
BTW, may I ask, why do you need a different wsdl "each time"?  As far as
I can see you just need two WSDLs, one for each service.  If it is
because the endpoint changes, you can change the endpoint URL
programmatically--see Step #7 here[1].

Also, you said you are calling a different web service from two
different places.  What happens if you call the *same* web service from
those two different places--does it work then or break?  If the latter,
the fact that you are calling two different services may be just an
irrelevant distraction to finding the real problem.

What we will probably need from you next is a very simple one-class Java
application that iteratively asks a user if they want to call web
service #1 or #2, and then have two methods, one that calls each web
service.  Use the CXF samples in the /samples directory for web services
to call (call "ant server" on two of our web services).  If you can get
this program to work, that would mean the problem is somewhere else.  If
you cannot get the simple program to work, then send the program to us
in a JIRA report--it would be easier to then duplicate and then hunt
down the problem.

HTH,
Glen

[1] http://www.jroller.com/gmazza/date/20070817

Am Mittwoch, den 21.11.2007, 08:34 -0800 schrieb Tophebboy:
> I can call the same service 10 times, so I don't think it could come from
> that...The problem only comes when I call one service, the another one...
> On top of that, I'm currently doing tests to use CXF, and I need to be able
> to call the service with a different wsdl each time (I have to test the same
> service on several servers...). So I have to do it this way...
> Thanks very much anyway!
> Any other idea?
> 
> 
> Glen Mazza-2 wrote:
> > 
> > Comments below...
> > 
> > Am Dienstag, den 20.11.2007, 23:57 -0800 schrieb Tophebboy:
> >> I don't know but I don't handle myself the BusFatory instanciation.
> >> I just have a client in each of my plugins which looks like the clients
> >> CXF
> >> generates automatically:
> >> 
> >> <code>
> >> String wsdlUrl = "my wsdl path";
> >> 		File wsdlFile = new File(wsdlUrl);
> >> 
> >> 		try {
> >> 			if (wsdlFile.exists()) {
> >> 				wsdlURL = wsdlFile.toURL();
> >> 			} else {
> >> 				wsdlURL = new URL(wsdlUrl);
> >> 			}
> >> 		} catch (MalformedURLException e) {
> >> 			e.printStackTrace();
> >> 		}
> >> 		try {
> >> 			System.out.println("Using WSDL: " + wsdlURL);
> >> 			MyRequestService ss = new MyRequestService(wsdlURL,
> >> 					SERVICE_NAME);
> >> 			
> >> 			MyRequest port = ss.getMyRequestPort();
> >> 
> > 
> > I would try to put your port and service initialization in a constructor
> > or initialize() method or similar--so it is only done once.  Presently
> > you are initializing these variables with every web service call, which
> > would be slow anyway.  Let us know if that worked.
> > 
> > HTH,
> > Glen
> > 
> > 
> > 
> >> 			
> >> 			// Uses the Web Service:
> >> 			//
> >> 			//Then, calls the method of port
> >> 
> >> </code>
> >> 
> >> 
> > 
> > 
> > 
> > 
> 


Re: Problems calling 2 different web services from the same Eclipse Runtime...

Posted by Tophebboy <cb...@free.fr>.
I can call the same service 10 times, so I don't think it could come from
that...The problem only comes when I call one service, the another one...
On top of that, I'm currently doing tests to use CXF, and I need to be able
to call the service with a different wsdl each time (I have to test the same
service on several servers...). So I have to do it this way...
Thanks very much anyway!
Any other idea?


Glen Mazza-2 wrote:
> 
> Comments below...
> 
> Am Dienstag, den 20.11.2007, 23:57 -0800 schrieb Tophebboy:
>> I don't know but I don't handle myself the BusFatory instanciation.
>> I just have a client in each of my plugins which looks like the clients
>> CXF
>> generates automatically:
>> 
>> <code>
>> String wsdlUrl = "my wsdl path";
>> 		File wsdlFile = new File(wsdlUrl);
>> 
>> 		try {
>> 			if (wsdlFile.exists()) {
>> 				wsdlURL = wsdlFile.toURL();
>> 			} else {
>> 				wsdlURL = new URL(wsdlUrl);
>> 			}
>> 		} catch (MalformedURLException e) {
>> 			e.printStackTrace();
>> 		}
>> 		try {
>> 			System.out.println("Using WSDL: " + wsdlURL);
>> 			MyRequestService ss = new MyRequestService(wsdlURL,
>> 					SERVICE_NAME);
>> 			
>> 			MyRequest port = ss.getMyRequestPort();
>> 
> 
> I would try to put your port and service initialization in a constructor
> or initialize() method or similar--so it is only done once.  Presently
> you are initializing these variables with every web service call, which
> would be slow anyway.  Let us know if that worked.
> 
> HTH,
> Glen
> 
> 
> 
>> 			
>> 			// Uses the Web Service:
>> 			//
>> 			//Then, calls the method of port
>> 
>> </code>
>> 
>> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problems-calling-2-different-web-services-from-the-same-Eclipse-Runtime...-tf4844258.html#a13880902
Sent from the cxf-user mailing list archive at Nabble.com.