For the most part, you can probably just pass "null" as the wsdl
location. After getting the port, you would need to do:
((BindingProvider
)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_URL,
endpointURL);
to set the address that it hits. With JAXWS, the target address is
not burned into the code. Normally, we grab that from the WSDL, but
if you don't use the WSDL, you need to specify it.
The "proper" JAX-WS way would be:
QName serviceName = new QName(
"http://service.modulverwaltung/",
"ModuleServiceImplService");
QName portName = new QName(
"http://service.modulverwaltung/",
"ModuleServiceImplPort");
Service service = Service.create(servName);
service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
endpointURL);
ModuleServiceImplPort port = service.getPort(portName,
ModuleServiceImplPort.class);
That doesn't end up using the generated "ModuleServiceImplService" at
all. Just the annotated interface.
Dan
On Jun 2, 2008, at 5:23 AM, Abid Hussain wrote:
Hi again,
first of all, thanks for the comments to my posting.
Considering most people responded that in their eyes it's even
easier building a client with CXF compared to Axis2 I'll take
another try with CXF...
Daniel Kulp schrieb:
- No wsdl-file needed after you generated the code using WSDL2Java.
You don't need to with CXF either. Just invoke a different
constructor on the generated Service object and specify the
endpoint URL you want to hit. In anycase, this is a JAX-WS
specification thing.
Which constructor do you mean? I use this one (the service's name is
ModuleService):
ModuleService port;
ModuleServiceImplService serviceClient;
org.apache.cxf.endpoint.Client client;
URL wsdl = getClass().getResource("/ModuleService.wsdl");
service = new ModuleServiceImplService(wsdl, new QName(
"http://service.modulverwaltung/",
"ModuleServiceImplService"));
port = service.getModuleServiceImplPort();
client = ClientProxy.getClient(port);
In this case, the WSDL-file has to be in the classpath...
Regards,
Abid
--
Abid Hussain
Mail: [EMAIL PROTECTED]
Web: http://www.abid76.de
---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog