You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Christopher Cheng <ch...@gmail.com> on 2009/02/24 09:30:58 UTC

CXF webservice overhead

After migration from Axis 1.2 to CXF 2.1, I found that CXF has an overhead
of loading wsdl definition during Runtime.
That means it will take much longer for the first call of every web service.
For a big wsdl, it may take more than 250 secs.
It has not been the case for Axis, because the definiton seems to be
generated in the stub with wsdl2java.
Is it possible for CXF to have the wsdl definition to generated into the
stub?

Re: CXF webservice overhead

Posted by Christopher Cheng <ch...@gmail.com>.
Hi Daniel,
Here's the fragment of the code generated by wsdl2java. What you mean is
that "wsdlLocation" in the annotation and the variable WSDL_LOCATION can all
be null?
If I set them to null, that could speed up the first web service calls?


@WebServiceClient(name = "VehResModifyService",
                  wsdlLocation =
"classpath:com/sabre/webservices/wsdl/VehResModifyLLS1.3.1RQ.wsdl",
                  targetNamespace = "https://webservices.sabre.com/websvc")
public class VehResModifyService extends Service {

    public final static URL WSDL_LOCATION;
    public final static QName SERVICE = new QName("
https://webservices.sabre.com/websvc", "VehResModifyService");
    public final static QName VehResModifyPortType = new QName("
https://webservices.sabre.com/websvc", "VehResModifyPortType");
    static {
        URL url = null;
        try {
            url =
((java.net.URLClassLoader)Thread.currentThread().getContextClassLoader()).findResource("com/sabre/webservices/wsdl/VehResModifyLLS1.3.1RQ.wsdl");
        } catch (Exception e) {
            System.err.println("Can not initialize the default wsdl from
classpath:com/sabre/webservices/wsdl/VehResModifyLLS1.3.1RQ.wsdl");
            // e.printStackTrace();
        }
        WSDL_LOCATION = url;
    }

On Wed, Feb 25, 2009 at 12:27 AM, Daniel Kulp <dk...@apache.org> wrote:

> On Tue February 24 2009 3:30:58 am Christopher Cheng wrote:
> > After migration from Axis 1.2 to CXF 2.1, I found that CXF has an
> overhead
> > of loading wsdl definition during Runtime.
> > That means it will take much longer for the first call of every web
> > service. For a big wsdl, it may take more than 250 secs.
>
> Jeesh...   that's got to be a HUGE wsdl.   Wow....
>
> > It has not been the case for Axis, because the definiton seems to be
> > generated in the stub with wsdl2java.
> > Is it possible for CXF to have the wsdl definition to generated into the
> > stub?
>
> Well, not really.   However, CXF doesn't HAVE to use the wsdl in many
> cases.
> You can get it to work by not specifying a wsdl.   However, you will need
> to
> provide the URL of the service at runtime.   That's the main thing that
> isn't
> burned into the code anywhere.
>
>        QName portName = new QName(....);
>        Service service = Service.create(new QName(.....));
>        service.addPort(portName,
>                         SOAPBinding.SOAP11HTTP_BINDING,
>                        "http://localhost/blah/blah/blah");
>        MySoapService port = service.getPort(portName,
>                                  MySoapService.class);
>
>
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>

Re: CXF webservice overhead

Posted by Daniel Kulp <dk...@apache.org>.
On Tue February 24 2009 3:30:58 am Christopher Cheng wrote:
> After migration from Axis 1.2 to CXF 2.1, I found that CXF has an overhead
> of loading wsdl definition during Runtime.
> That means it will take much longer for the first call of every web
> service. For a big wsdl, it may take more than 250 secs.

Jeesh...   that's got to be a HUGE wsdl.   Wow....

> It has not been the case for Axis, because the definiton seems to be
> generated in the stub with wsdl2java.
> Is it possible for CXF to have the wsdl definition to generated into the
> stub?

Well, not really.   However, CXF doesn't HAVE to use the wsdl in many cases.   
You can get it to work by not specifying a wsdl.   However, you will need to 
provide the URL of the service at runtime.   That's the main thing that isn't 
burned into the code anywhere.  

        QName portName = new QName(....);
        Service service = Service.create(new QName(.....));
        service.addPort(portName, 
                         SOAPBinding.SOAP11HTTP_BINDING, 
                        "http://localhost/blah/blah/blah");
        MySoapService port = service.getPort(portName,
                                  MySoapService.class);



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