Forums Register Login

CXF and Maven

+Pie Number of slices to send: Send
I'm totally new to CXF (and web services for that matter) and this is what I'm trying to figure out. My maven creates the classes for me. But how do I determine which class is the one I really need to use? My understanding is the one extending Service? Is that right?

Now if that's the case, the class I see after generating the code though CXF and Maven, i do not see how to implement this class in my code to make use of the service. While, when I tried to use xFire, it created a client class for me for the same WSDL and I just had to start from there and it was easy...

CXF is supposed to be easier than xFire I am told. Please help me to see that argument clearly...
+Pie Number of slices to send: Send
You can do something like this ,

//Look-up the client (it is the one which will have @Webservice annotation
//If not using spring just create the instance
IMyService client = (IMyService) context.getBean("client");
.........

Then call the ws .

// Invoke the Service
logger.info("Client invoking WS:");
ObjectFactory factory = new ObjectFactory();
NameDataContract name = factory.createNameDataContract();
name.setFirstName( factory.createNameDataContractFirstName("Java"));
name.setLastName(factory.createNameDataContractLastName("Client"));
String response = client.sayHello(name);
logger.info("Response: " + response);

Cheers,
Sangram M
+Pie Number of slices to send: Send
Thank you. I was able to get this to run. Although in a slightly different way. Now I'm facing another problem. The end-point for the service I'm writing the client for is supposed to be different for the dev/testing and the production environment.

I'm using Maven. It is looking for the WSDL in the path mentioned in the POM.


Now when this migrates to the testing region, I'd need it to use a different end-point. But since it will still have the same WSDL pointed to via the POM, it'll pick up the end-point for the dev environment.

What is the best way to handle this?
+Pie Number of slices to send: Send

This is how had done it


But i have used simple bean , not the generated code by java2wsdl .


+Pie Number of slices to send: Send
Thank you Sangram... I will give this a try...
There were millions of the little blood suckers. But thanks to this tiny ad, I wasn't bitten once.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1944 times.
Similar Threads
Get the body content in SOAP message
Which web service tool/tech to use for consuming ?
How does Apache CXF compares to Axis 2 today?
Mark Hansen: Data Binding Approaches
contract first web service
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:00:31.