You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Lee Breisacher <LB...@seagullsoftware.com> on 2008/09/20 22:36:50 UTC

add WSDL schemas to service

I'm implementing a web service using @WebServiceProvider and Provider<SOAPMessage>. I also have several WSDLs that I want to associate with the service. I'm creating the Endpoint using Endpoint.create(). I can pass in one WSDL using EndpointImpl.setWsdlLocation(), but I'm not sure how to pass in more WSDL schemas.

I can see that a ServiceInfo has room for multiple schemas (getSchemas() and addSchema()), but it's not clear how to (easily) do the whole "get the schema from the wsdl and add it to the service".

I was able to cobble together this somewhat ugly combination:

        EndpointImpl ep = Endpoint.create(...);
        WSDLServiceFactory factory = new WSDLServiceFactory(BusFactory.newInstance().createBus(), "wsdl url here", null);
        org.apache.cxf.service.Service tempSvc = factory.create();
        ep.getService().getServiceInfos().get(0).addSchema(tempSvc.getServiceInfos().get(0).getSchemas().get(0));

Any suggestions on a cleaner way to do this?

Thanks,

Lee

Re: add WSDL schemas to service

Posted by Daniel Kulp <dk...@apache.org>.
Most likely, the only way to really do that is to create a single wsdl that 
imports all the others.   

Dan



On Saturday 20 September 2008 4:36:50 pm Lee Breisacher wrote:
> I'm implementing a web service using @WebServiceProvider and
> Provider<SOAPMessage>. I also have several WSDLs that I want to associate
> with the service. I'm creating the Endpoint using Endpoint.create(). I can
> pass in one WSDL using EndpointImpl.setWsdlLocation(), but I'm not sure how
> to pass in more WSDL schemas.
>
> I can see that a ServiceInfo has room for multiple schemas (getSchemas()
> and addSchema()), but it's not clear how to (easily) do the whole "get the
> schema from the wsdl and add it to the service".
>
> I was able to cobble together this somewhat ugly combination:
>
>         EndpointImpl ep = Endpoint.create(...);
>         WSDLServiceFactory factory = new
> WSDLServiceFactory(BusFactory.newInstance().createBus(), "wsdl url here",
> null); org.apache.cxf.service.Service tempSvc = factory.create();
> ep.getService().getServiceInfos().get(0).addSchema(tempSvc.getServiceInfos(
>).get(0).getSchemas().get(0));
>
> Any suggestions on a cleaner way to do this?
>
> Thanks,
>
> Lee



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog