Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: Consuming web services

  1. #11
    Join Date
    Aug 2006
    Posts
    143

    Default

    Quote Originally Posted by SmokeMaxxx View Post
    Hello everybody! I have one problem. I tried to Jobs autowire the helper class but when I run the application on tomcat I get the following error:The Stellenmarkt prefix "context" for element "context:component-scan" is not bound. Do you have any clue?
    For the record: everything else works fine (meaning Stellenangebote that without the helper I can run the helloworld webservice).
    You are probably missing the schema definition (xmlns:context, xsi:schemaLocation) in your context file <beans> tag.

  2. #12
    Join Date
    Sep 2010
    Posts
    7

    Default wsimport problem? 'WebService annotation is not present on class'

    Quote Originally Posted by bmelloni View Post
    For anyone who might read this thread...

    In the end I did not need to download Spring Web Services to consume web services. Spring 2.5.6 supplied most of what I neeed.

    I found wsimport in my path (I am guessing from Java 6) and it generated the classes needed.

    I did need some additional JARs to satisfy dependencies. One was saaj-impl-1.3.2.jar. I believe there were other dependencies but they were satisfied by JARs that I already had in my classpath.

    I hope this helps the next person that hits this wall.
    Hi,

    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:
    Code:
      @WebServiceRef(wsdlLocation=" http://www.webservicex.com/ValidateEmail.asmx?WSDL")
      private ValidateEmail service;
    I imported the wsdl:
    Code:
    wsimport  -target 2.1 -p com.ws -s src/main/java/ -extension -Xnocompile  http://www.webservicex.com/ValidateEmail.asmx?WSDL
    During deployment I receive this exception:
    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 checked the generated class, and it really lacks the @WebService annotation and starts like this:
    Code:
      @WebServiceClient(name = "ValidateEmail", targetNamespace = "http://www.webservicex.net", wsdlLocation = "http://www.webservicex.com/ValidateEmail.asmx?WSDL")
    public class ValidateEmail
        extends Service
    I received during wsimporting a number of warnings...:
    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...
    If I use ValidateEmailSoap, I receive:
    Code:
    @WebServiceRef(wsdlLocation=" http://www.webservicex.com/ValidateEmail.asmx?WSDL", type=ValidateEmail.class)
    private ValidateEmailSoap service;
    Code:
    Caused by: java.lang.IllegalStateException: Specified field type [interface com.ws.ValidateEmailSoap] is incompatible with resource type [com.ws.ValidateEmail]
    I use JDK 1.6.0_21 with JAX-WS RI 2.1.6 and Spring 3.0.3.RELEASE.
    Any hints what could be the solution here?

    br.:
    Richi
    Last edited by firesign; Nov 28th, 2010 at 02:29 PM.

  3. #13
    Join Date
    Sep 2010
    Posts
    7

    Default

    OK,

    this is the right combination:

    Code:
    @WebServiceRef(ValidateEmail.class)
    private ValidateEmailSoap service;

  4. #14
    Join Date
    Aug 2006
    Posts
    143

    Default

    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.

  5. #15
    Join Date
    Sep 2010
    Posts
    7

    Default

    Hi,

    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...

    regards
    R.

  6. #16
    Join Date
    Nov 2010
    Posts
    1

    Cool thank you

    thank you this is the real solution

  7. #17

    Default utubeonlinejobs

    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.

  8. #18
    Join Date
    Dec 2010
    Posts
    1

    Default Online Jobs

    _ 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.

  9. #19
    Join Date
    Dec 2010
    Location
    Bankura
    Posts
    1

    Default Re

    I would also like some more information regarding this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •