On Friday, April 13, 2012 04:21:27 AM imiten wrote:
> Hi,
>
> Its working !
>
> I added url in dispatcher client code as:
> Service service = Service.create(new
> URL("http://localhost:8080/WebServiceProject/wsdl/productwebservice.wsdl")
> , serviceName);
>
> Now it fetches wsdl and invokes service fine. I also changed mode from
> payload to message.
>
> I have few questions below.
>
> 1) will I have to hardcode the wsdl url, qname in servlet if I have to
> invoke the webservice from web page ? Actually I wanted to have web page
> on submit, triggers servlet which then contacts web service. I would
> want form submit directly trigger web service but not sure how to handle
> soap communication in html client. need ajax ?
CXF does have a Javascript based client. You can run wsdl2js to generate a
Javascript client that can be used for very basic SOAP things directly.
That said, enabling a REST based interface with CXF's JAX-RS implementation
and using that from the HTML client is likely the better option for most
things.
That said, your original code may have worked if you added a addPort call in
there:
Service service = Service.create(serviceName);
service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
"http://servername.com/foo")
Dispatch<SOAPMessage> dispatch = service.createDispatch(portName,
SOAPMessage.class, Service.Mode.PAYLOAD);
> 2) When I try payload mode it complains (I made the request to but xml
> message removing soap tags):
> SOAPMessage is not valid in PAYLOAD mode with SOAP/HTTP binding.
> It seems I need to change service provider type to use DOMSource instead
> of SOAPMessage. any ideas ?
A SOAPMessage always represents the entire message and thus must be MESSAGE
mode. If you just want the payload (contents of the Body), you need a type
that can represent just that such as DOMSource (or just Source).
> 3) eclipse is generating WebServiceProject with the web service wizard
> from my implementation (provider) class. will it generate such generic
> names ? I was wanting to use some ant script etc. to generate war and was
> hoping that eclipse will help me with that ? any idea if its possible ?
No idea on that one.
Dan
>
> Regards,
>
> Miten.
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/dispatch-api-cannot-find-port-tp5637843p5
> 638013.html Sent from the cxf-user mailing list archive at Nabble.com.
--
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com