I experience the same problem. Using the same webservice as in the head of this topic...:
I would like to access the Webservice from a Spring-managed bean like this:
I imported the wsdl:Code:@WebServiceRef(wsdlLocation=" http://www.webservicex.com/ValidateEmail.asmx?WSDL") private ValidateEmail service;
During deployment I receive this exception:Code:wsimport -target 2.1 -p com.ws -s src/main/java/ -extension -Xnocompile http://www.webservicex.com/ValidateEmail.asmx?WSDL
I checked the generated class, and it really lacks the @WebService annotation and starts like this:Code:ERROR - ContextLoader.initWebApplicationContext(220) | Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'emailDao': Injection of resource dependencies failed; nested exception is com.sun.xml.internal.ws.model.RuntimeModelerException: A WebService annotation is not present on class: com.ws.ValidateEmail at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:300) ... Caused by: com.sun.xml.internal.ws.model.RuntimeModelerException: A WebService annotation is not present on class: com.ws.ValidateEmail at com.sun.xml.internal.ws.model.RuntimeModeler.getPortTypeName(Unknown Source)
I received during wsimporting a number of warnings...:Code:@WebServiceClient(name = "ValidateEmail", targetNamespace = "http://www.webservicex.net", wsdlLocation = "http://www.webservicex.com/ValidateEmail.asmx?WSDL") public class ValidateEmail extends Service
If I use ValidateEmailSoap, I receive:Code:parsing WSDL... [WARNING] SOAP port "ValidateEmailSoap12": uses a non-standard SOAP 1.2 binding. line 113 of http://www.webservicex.com/ValidateEmail.asmx?WSDL [WARNING] port "ValidateEmailHttpGet" is not a SOAP port, it has no soap:address line 116 of http://www.webservicex.com/ValidateEmail.asmx?WSDL [WARNING] port "ValidateEmailHttpGet": not a standard SOAP port. The generated a rtifacts may not work with JAXWS runtime. line 116 of http://www.webservicex.com/ValidateEmail.asmx?WSDL [WARNING] port "ValidateEmailHttpPost" is not a SOAP port, it has no soap:addres s line 119 of http://www.webservicex.com/ValidateEmail.asmx?WSDL [WARNING] port "ValidateEmailHttpPost": not a standard SOAP port. The generated artifacts may not work with JAXWS runtime. line 119 of http://www.webservicex.com/ValidateEmail.asmx?WSDL generating code...
Code:@WebServiceRef(wsdlLocation=" http://www.webservicex.com/ValidateEmail.asmx?WSDL", type=ValidateEmail.class) private ValidateEmailSoap service;I use JDK 1.6.0_21 with JAX-WS RI 2.1.6 and Spring 3.0.3.RELEASE.Code:Caused by: java.lang.IllegalStateException: Specified field type [interface com.ws.ValidateEmailSoap] is incompatible with resource type [com.ws.ValidateEmail]
Any hints what could be the solution here?
Last edited by firesign; Nov 28th, 2010 at 02:29 PM.
this is the right combination:
Code:@WebServiceRef(ValidateEmail.class) private ValidateEmailSoap service;
An addition to my original post:
Even though I was successful, I tried several other ways to write and call web services.
In the end I found that the simplest and cleanest is Apache CXF, using the code-first approach:
- To write a service, you simply write a java bean, then you expose it through pretty simple configuration in your spring context.
- To call a service, again you just do some configuration in your spring context, then load the auto-generated bean that proxies the call to the web service.
- So basically writing and calling is done through POJOs. And the configuration is all in the Spring Context, plus adding the necessary libraries.
You almost don't have to worry about the fact that it is a web service.
thanks for your suggestion!
Upon your post I tried Apache CXF, and found cool (surprises, that it is documented well enough).
I have also found decent Maven plugins for WSDL->Java and XSD->Java inside, which I was longing for a while...
thank you this is the real solution
Itís a fact that there are lots of online job providers working nowadays, but I recommend you to visit www.utubeonlinejobs.org as this is a first registered company of the Pakistan. I found its setup, working environment quite elegant, friendly and smooth.
_ You must be visited several websites of online job companies but I am going to inform you about one of the reliable and trustworthy website which is dealing in online job i.e. known as www.utubeonlinejobs.org.