Re: Lazy instantiation of Web Service Client

2008-02-12 Thread rsheldon


Thanks to everyone for their help on this. It turns out that despite some
logging that made me think it was connecting to the web service, CXF
actually doesn't talk to the remote server until it's first used. I double
checked this with wireshark/ethereal.

Thanks again,
Richard

-- 
View this message in context: 
http://www.nabble.com/Lazy-instantiation-of-Web-Service-Client-tp15427056p15446405.html
Sent from the cxf-user mailing list archive at Nabble.com.



Re: Lazy instantiation of Web Service Client

2008-02-12 Thread rsheldon

Thanks for your quick response. I took a look at the link you posted, and
actually didn't gain much insight from it. Can you please clarify what you
wrote a little bit more:

I am not specifying a link to the wsdl in my bean. I wasn't clear whether
you were saying I should add this property to get this to not initiate on
startup, or that I shouldn't add it. 

Thanks
Richard



willem.jiang wrote:
> 
> Hi Richard
> Hi
> 
> For the client instantiation, it just need to create the service 
> model[1] first.
> 
>  If you add the wsdlLocation attribute in your SEI's WebService 
> annotation or specify the wsdlLocation property for the 
> JaxWsProxyFactoryBean with your service endpoint's address, the client 
> will hit the service before you call the proxy's operation.
> 
> Otherwise the client will not access service endpoint the before your 
> start to call the proxy's operation.
> 
> [1]http://cwiki.apache.org/CXF20DOC/cxf-architecture.html#CXFArchitecture-TheServiceModel
> 
> Willem
> 
> rsheldon wrote:
>> I've just started using CXF with Spring. I'm only using it to create SOAP
>> WS
>> clients (code generated from WSDL using CXF maven tools). 
>>
>> I'd like to be able to have the services not connect on startup, but wait
>> until they are first used - ie. lazy instantiation. Can this be done in
>> CXF?
>> Here's my very simple client configuration:
>>
>> > class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>>   > value="my.web.service.AccountService"/>
>>   
>> 
>>
>> >   factory-bean="accountProxyFactory" factory-method="create"/>
>>
>> I can't see any attribute I can set on JaxWsProxyFactoryBean or it's
>> parent
>> ClientProxyFactoryBean that looks like it would work. There is a
>> "properties" property, but I can't find a reference to the valid
>> properties/values I can put into this map. 
>>
>> Can anyone help?? Is there an attribute or property I can set to prevent
>> immediate creation of the service?  
>>
>> Many thanks,
>> Richard
>>
>> Thanks
>> Richard
>>   
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Lazy-instantiation-of-Web-Service-Client-tp15427056p15434534.html
Sent from the cxf-user mailing list archive at Nabble.com.



CXF 2.0.3/2.0.4 Build problems with Maven and wsdl2java

2008-02-11 Thread rsheldon

This is driving me nuts, so hopefully somebody wiser than me can enlighten
me. Here are the problems I've been having trying to use maven/cxf to
generate code from a wsdl, then wire up a simple client via spring.
Different versions of CXF have different behaviours/features/bugs:

2.0.2 - Generates code from WSDL with no error. When starting the client I
get the following error:

2008-02-11 10:04:21,316 FATAL
com.localmatters.ds.controller.search.WWWSearchController - No conduit
initiator was found for the namespace http://schemas.xmlsoap.org/soap/http.
javax.xml.ws.soap.SOAPFaultException: No conduit initiator was found for the
namespace http://schemas.xmlsoap.org/soap/http.
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:175)

If I add cxf-rt-transports-http-jetty.jar to my build (maven) then it works
OK. However, I don't want to do this as I'm using tomcat, and don't want
this dependency. So, I thought I would upgrade to 2.0.3 and see what
happens.

2.0.3 gives me the following error when generating the code from wsdl, but
stills runs and says it's successful (from maven):

INFO: Refreshing [EMAIL PROTECTED]:
display name [EMAIL PROTECTED];
startup date [Mon Feb 11 23:57:02 GMT-07:00 2008]; root of context hierarchy
Feb 11, 2008 11:57:03 PM
org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver
initHandlerMappings
WARNING: Ignoring namespace handler
[org.apache.cxf.jaxws.spring.NamespaceHandler]: problem with handler class
file or dependent class
java.lang.IncompatibleClassChangeError: class
org.apache.cxf.jaxws.EndpointImpl has interface javax.xml.ws.Endpoint as
super class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at
org.apache.cxf.jaxws.spring.EndpointDefinitionParser.(EndpointDefinitionParser.java:50)
at
org.apache.cxf.jaxws.spring.NamespaceHandler.init(NamespaceHandler.java:29)

As maven completed successfullly (it said so at least, despite the errors),
I tried it in my application and it seems to work.

2.0.4 - I decided to try 2.0.4 out to see if it gave me the same errors
generating code as 2.0.3. It DID, but this time the maven build fails with
this cryptic message:
[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] javax/xml/ws/RequestWrapper


So I'm at a loss really. Am I missing some dependency, or have a wrong
version of a library? I'd like to be using 2.0.4 if possible, but I can't
even get the client generated code to compile! I've attached the relevant
parts of the pom below, in case somebody can see any stupid mistakes.

Thanks a lot, hope somebody can help this CXF newbie. I've been surfing the
web for most of the day trying to work around these different issues.

Richard



org.apache.cxf
cxf-rt-frontend-jaxws
2.0.4-incubator


org.apache.cxf
cxf-rt-transports-http
2.0.4-incubator



javax.xml.ws
jaxws-api
2.1





org.apache.cxf
cxf-codegen-plugin
2.0.4-incubator


generate-sources
generate-sources

   
${basedir}/target/generated/src/main/java


   
${basedir}/src/main/wsdl/AccountService.wsdl




wsdl2java




 



apache-snapshots
Apache SNAPSHOT Repository
http://people.apache.org/repo/m2-snapshot-repository/

true



apache-incubating
Apache Incubating Repository
   
http://people.apache.org/repo/m2-incubating-repository/



java.net
h

Lazy instantiation of Web Service Client

2008-02-11 Thread rsheldon

I've just started using CXF with Spring. I'm only using it to create SOAP WS
clients (code generated from WSDL using CXF maven tools). 

I'd like to be able to have the services not connect on startup, but wait
until they are first used - ie. lazy instantiation. Can this be done in CXF?
Here's my very simple client configuration:


  
  




I can't see any attribute I can set on JaxWsProxyFactoryBean or it's parent
ClientProxyFactoryBean that looks like it would work. There is a
"properties" property, but I can't find a reference to the valid
properties/values I can put into this map. 

Can anyone help?? Is there an attribute or property I can set to prevent
immediate creation of the service?  

Many thanks,
Richard

Thanks
Richard
-- 
View this message in context: 
http://www.nabble.com/Lazy-instantiation-of-Web-Service-Client-tp15427056p15427056.html
Sent from the cxf-user mailing list archive at Nabble.com.