SOAP Web Services 03 - Writing a Web service Client: Stub generation

Share
Embed
  • Published on Jun 21, 2013
  • In this video, we'll learn how to use the wsimport utility to create stubs that can be used to make web service calls.
    Website: javabrains.koushik.org/2013/06/writing-web-service-client-stub.html

Comments • 137

  • alekhya rupa
    alekhya rupa 2 months ago

    I wonder who the dumbass disliked this video 😶

  • biophr34k
    biophr34k 3 months ago

    Excellent stuff! Thanks a lot!

  • Nekoromancer
    Nekoromancer 6 months ago

    is there something like this but for php?

  • Rajashekhar Pattar
    Rajashekhar Pattar 9 months ago

    hi kaushik,
    i liked your teaching and i just wanted to try this example practically but now the problem is, the link for generating stub is not available any more, can anyone suggest other links.
    www.webservicex.net/geoipservice.asmx?WSDL - is not available.

    • pavankumar Gajavalli
      pavankumar Gajavalli 8 months ago +2

      Temp Converter: www.w3schools.com/xml/tempconvert.asmx and Calculator: www.dneonline.com/calculator.asmx

  • clid saniny
    clid saniny 9 months ago

    I need the url for webservices, please? There is no webservice available on webservicex site

  • boi dats Tight
    boi dats Tight 9 months ago

    You saved a student today, give a treat to yourself

  • striuncekf
    striuncekf 11 months ago

    the geoipservice is no longer working :(

  • Sivabalakrishnan M
    Sivabalakrishnan M 11 months ago

    Hi sir, can I consume a SOAP service through jQuery(AJAX call)?
    Keep doing the good work of sharing the knowledge.

  • Gautam Soundar
    Gautam Soundar 11 months ago

    Is there any other webserice site geoipservice is not working

  • Nikhil Bhavsar
    Nikhil Bhavsar Year ago

    that wsdl is not working

  • Bipika Amatya
    Bipika Amatya Year ago

    hello, I am trying out this tuturial and am stucked. I am not able to access wsimport. Which command prompt did you switch to ? is the same as CMD in windows? and what is the Home path? is it the path where our Java workspace is?

  • Kali doss
    Kali doss Year ago

    The one he used is not working now, can anyone help me with a sample webservice url?

  • UBAIS ANSARI
    UBAIS ANSARI Year ago

    Hi Koushik sir, i really appreciate the way you explained it all. could please mention the link of the web service you've used in this program as the service is not available on the website, so that we can test it by our own. thanks

  • Malaykumar Ginoya

    great video It makes theory to understand it practical way. Can you please give me link, which is follow up of current video ? Thanks

  • Potla Saisrinivas

    i did't find the geoipaddress

  • ritika jhamb
    ritika jhamb Year ago

    another url for the web service????

  • Giovanni Di Fronzo
    Giovanni Di Fronzo Year ago +1

    other url for webservices, please? There is no webservice available on webservicex site

    • Rene Garnica
      Rene Garnica 9 months ago +2

      a bit later but you can try with this graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl

  • Ramya R
    Ramya R Year ago

    One of the best series on web services. thank you.

  • Akash Singh
    Akash Singh Year ago

    wsimport is not able to parse the wsdl, due to error: "markup declarations contained or pointed to by the document type declaration must be well formed", wsdl url is: " www.dataaccess.com/webservicesserver/numberconversion.wso?WSDL ". Please help!!!

  • Rinkita Dhakate
    Rinkita Dhakate Year ago

    Hi teacher, when I provide wsdl to wsimport command for generating .class files, I'm getting the error, : the system cannot find the path specified.
    Can you pls help with that. I'm stuck. Can't move forward.

  • Pratap Bhanu Dhal

    I am not getting any folder in my directory. Please Help me

  • Yusuf Shoair
    Yusuf Shoair Year ago +2

    or u could import the ws directly from eclipse
    RightClick on any Project->Create New Other ->Web Services->Web Service Client->Then paste the wsdl url(or location) in Service Definition->Next->Finish

    • Rudraksh Jhalani
      Rudraksh Jhalani 7 months ago

      @Hamza MIsterio go through one of the comments, someone has replied there a link and that's working

    • Rudraksh Jhalani
      Rudraksh Jhalani 7 months ago

      @Yusuf Shoair, Thank you for your help

    • Hamza MIsterio
      Hamza MIsterio 11 months ago

      but this url in video is not working

    • Hamza MIsterio
      Hamza MIsterio 11 months ago

      thanks

  • 1991tanay
    1991tanay Year ago

    Struggling in windows ... anyone know how to generate stub in cmd prompt and use ?

  • Manjit G Ullal
    Manjit G Ullal Year ago

    link in the tutorial doesnt work, try this instead www.webservicex.net/geoipservice.asmx?WSDL

  • Ankita Gupta
    Ankita Gupta Year ago

    When I copied the stub classes in consumption application, it is not able to detect the files in eclipse, hence i'm not able to do import and create object of it!!
    Any help here ?

  • govind gupta
    govind gupta Year ago +1

    www.webservicex.net/ws/WSDetails.aspx?CATID=12&WSID=64

    • Akash Singh
      Akash Singh Year ago +1

      not found, I guess we can use any other web service wsdl and follow the same steps, right?

  • orenazuz
    orenazuz Year ago +4

    This is the solution to all the issue:
    run it in your cmd
    c:>set path=%path%;C:\Program Files\Java\jdk1.8.0_51\bin

  • gillian bc
    gillian bc 2 years ago

    Now I understand. At last! Thanks you for such clear explanations in this whole series on webservices.

  • Shivani Sabharwal
    Shivani Sabharwal 2 years ago

    I registered to your website javabrains for downloading codes and signing up for tutorials.But I cant find a simple search button to find this course. I am not able to find code for this project for which I signed up. Can't believe the UI of your site is so poor.

  • sravan kumar reddy naramreddy

    when ever i am running the Uri iam getting this error will you plz help me.

    HTTP Status [404] - [Not Found]
    Type Status Report
    Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
    Apache Tomcat/8.5.15

  • Vivek Singh
    Vivek Singh 2 years ago

    Nice video for beginners to understand!!!

  • allan johnson
    allan johnson 2 years ago

    Thanks a lot Kaushik!!! Wonderful teacher

  • SHANTANU MITRA
    SHANTANU MITRA 2 years ago

    Can I set a timeout in webservice i.e if I don't get a response within a certain time interval, I can close the connection.

  • Keya Kinan
    Keya Kinan 2 years ago

    yeah but what if you dont want a iplocater but your own..

  • venkataramana sopeti
    venkataramana sopeti 2 years ago

    i have taken another WSDL to generate the stub's, but here the problem is in the generated stub i'am getting JAXBElement, JAXBElement i'm getting this problem how to set values for this and call the service , Kindly reply ASAP.

  • gandhar vaidya
    gandhar vaidya 2 years ago

    I am getting "cannot instantiate type GeoServiceIp' error whenever I try to run the program. I do not understand why I am getting this error.

  • aniket warey
    aniket warey 2 years ago

    My Code:
    -------------------
    else{
    String ipAddress=args[0];
    GeoIPService ipService =new GeoIPService();
    GeoIPServiceSoap geoIPServiceSoap= ipService.getGeoIPServiceSoap();
    GeoIP geoIP=geoIPServiceSoap.getGeoIP(ipAddress);
    System.out.println(geoIP.getCountryName());
    }

    Error I’m getting:
    -----------------------------
    Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.
    at WebserviceX.Service.Adapter.IPAdapter.CheckIP(String IP)
    at WebserviceX.Service.GeoIPService.GetGeoIP(String IPAddress)
    --- End of inner exception stack trace ---
    at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
    at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:117)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:135)
    at com.sun.proxy.$Proxy20.getGeoIP(Unknown Source)
    at IPLocationFinder.main(IPLocationFinder.java:17)

    • aniket warey
      aniket warey 2 years ago

      OKay i got the solution …nothing was wrong with the code .. i just changed IP , and it showed me the location . In my case, it didnt work for Google.com, but found out for bbc.com.
      Looks like GeoIP webservice is not capable to find all locations.

  • rafiqul islam
    rafiqul islam 3 years ago

    I faced this exception.

    Exception in thread "main" com.sun.xml.internal.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.
    at WebserviceX.Service.Adapter.IPAdapter.CheckIP(String IP)
    at WebserviceX.Service.GeoIPService.GetGeoIP(String IPAddress)
    --- End of inner exception stack trace --- Please see the server log to find more detail regarding exact cause of the failure.
    at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
    at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:116)
    at com.sun.xml.internal.ws.client.sei.StubHandler.readResponse(StubHandler.java:238)
    at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:189)
    at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:276)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:104)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
    at com.sun.proxy.$Proxy31.getGeoIP(Unknown Source)

  • jeeves251
    jeeves251 3 years ago +1

    This was really helpful as I'm very new to web services. I'm curious though how you can consume a SOAP service without sending a payload envelope. Can someone help me understand that?

  • Mohamed Lahlou
    Mohamed Lahlou 3 years ago

    thank you very much for you videos . i have a question . the command "wsimport" is for linux or windows10 or both ?

    • Mohamed Lahlou
      Mohamed Lahlou 3 years ago +1

      when a i go to C:\Program Files\Java\jdk1.8.0_91\bin the commond work thank you

  • Alex Sun
    Alex Sun 3 years ago +1

    my cmd does not recognize the wsimport command but if I execute it in the "C:\Program Files\Java\jdk1.8.0_74\bin" I getting some result but I want to generate the stubs in my own directory. How can I manage it? since I can not create a directory in the lib folder.

    • Alex Sun
      Alex Sun 3 years ago

      @Ling Jiang: Thanks for your respose but I tried it before but it did not work. At the end I have generated the classes inside the "C:\Program Files\Java\jdk1.8.0_74\bin" and it worked.

  • Kashif Sami
    Kashif Sami 3 years ago +13

    You just saved me hours of research (and I was looking for a Python tutorial for SOAP). Your explanation is so logical and aligned to newbies. Thanks a ton Koushik!

    • JCPier
      JCPier 3 years ago +2

      +Kashif Sami So true. These tutorials are excelent entry points. I was very confused about all those acronyms SOAP RESTful WSDL and so on. And these are not just tutorials about how to do something, they also include conceptual topics well explained, and good examples.

  • Rene Jacques
    Rene Jacques 3 years ago

    my cmd prompt said generating and compiling code, but a net folder was not generated.

  • manoj G
    manoj G 3 years ago

    How can we deal with the proxy webservices .. I tried to create using eclipse somehow I got an error saying service definition is not created. This particular service under secured corporate network . Any suggestions?

  • Ranjan Kumar
    Ranjan Kumar 3 years ago

    download java 1.7 and set jdk path in Eclipse

  • Danan Joyo
    Danan Joyo 3 years ago

    why i always got this warning "Description Resource Path Location Type
    Build path specifies execution environment JavaSE-1.7. There are no JREs installed in the workspace that are strictly compatible with this environment. IPLocationFinder Build path JRE System Library Problem"
    i've already installed the jdk1.8 on my kepler eclipse..

  • 2002budokan
    2002budokan 3 years ago

    Thank you very much

  • persistence j
    persistence j 3 years ago +1

    Thanks a million for your tutorials

  • Thabetitusml Sml
    Thabetitusml Sml 3 years ago

    A very good video but unfortunately it did not work with Microsoft wsdl. It generates:
    [WARNING] src-resolve: Cannot resolve the name 's:schema' to a(n) 'element declaration' component.

  • Shekhar Prasad
    Shekhar Prasad 3 years ago

    Awesome work!!

  • kumar swamy
    kumar swamy 4 years ago

    very very nice...sir

  • veeru N
    veeru N 4 years ago

    Great Tutorials Boss..
    Thanks a lot..!!

  • rgowlikar1
    rgowlikar1 4 years ago

    How did the command line know that you needed a java SEI?

  • Lee Subiramaniyam
    Lee Subiramaniyam 4 years ago

    concept wise this explanation is good but not able to view the code clearly.Please could you do the favor for that write code and please put your websites

  • Komal Gujarathi
    Komal Gujarathi 4 years ago +1

    best series

  • sonam mas
    sonam mas 4 years ago

    Amazing series ..this made learning web services very easy !! thanks

  • Ravi Kumar
    Ravi Kumar 4 years ago

    Thank you for amazing series of technical topics. I'm learning a lot.

  • aravind aran
    aravind aran 4 years ago

    I m getting confused with webservice and module.I m using python.so i can import a module instead of calling this webservice...so is any relation with those?

    • Anurag Bisht
      Anurag Bisht 3 years ago

      +aravind aran
      I am quite late, but no "webservices" in directory structure is not a "module"(file) but a "package"(directory + _init_.py) in python. "webservices" would contain all the "Geo*.java" modules. I think you are getting confused because all ".java" files contains single class of same name whereas in python you can have multiple classes in a single module.
      java it is : webservices.GeoIpService(module and class).
      in python : webservices.GeoIpService(module).GeoIpService(class)
      hope it helps,

    • Anurag Bisht
      Anurag Bisht 3 years ago

      +aravind aran I am quite late, but no "webservices" in directory structure is not a "module"(file) but a "package"(directory + __init__.py) in python. "webservices" would contain all the "Geo*.java" modules. I think you are getting confused because all ".java" files contains single class of same name whereas in python you can have multiple classes in a single module.
      java it is : webservices.GeoIpService(module and class).
      in python : webservices.GeoIpService(module).GeoIpService(class)
      hope it helps,

  • Vipan K Singh
    Vipan K Singh 4 years ago

    An excellent series of videos!! Thank you!!

  • ashutosh nagda
    ashutosh nagda 4 years ago

    Could you make your video to be cached for offline.