• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can't generate java classes from WSDL file

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone, I'm new in this forum, I'm from Poland and I'm studing informatic. I wan't to generate classes from WSDL given from WS in Internet Shop.

I'm using NetBeans 6.5 and trying generate code with JAXB. When i'm doing it an error occurs:



This is the wsdl file:


[PR Edit: added line breaks to various elements]
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the CodeRanch!

  • JAXB can only process XML schema - not WSDL files. The WSDL file is processed by the JAX-WS wsimport tool.
  • The WSDL uses the rpc/encoded messaging mode (Which style of WSDL should I use?) with SOAP encoding which is not supported by current generation SOAP stacks like JAX-WS, Axis2, or Apache CXF. Previous generation web service stacks like JAX-RPC or Axis 1.x may be able to process the WSDL and the associated SOAP messages. However SOAP encoding had lots of interoperability issues (which is why it is no longer supported).
  •  
    Oskar Otw
    Greenhorn
    Posts: 4
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks for reply, i read links, which You gave me, and tried to make, with wsmiport, Client Side Skeleton without success
    New errors occured:

    typed simply: wsmiport c:\api\api.wsdl

    Maybe were something missing? Can You write me step by step what i should do, please?

     
    Oskar Otw
    Greenhorn
    Posts: 4
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hmm, maybe i don't understand what i should do...

    I have WS in webshop and I'm trying to get orders via SOAP. I'm sending request and getting error:



    I need to write my own Deserializer or what? Thanks in advance for any clue.

    My 1st SOAP Client program:



    //Edit:

    I used wscompile.bat and i generated classes from WSDL file. My WebService is using RPC style, what should i do now with this classes, write something familiar to my program above? Or I'm completely lost? I want to send request to WS and get info about Orders. Thanks in advance for clues and replies.
     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Oskar Otw wrote:tried to make, with wsmiport, Client Side Skeleton without success



    Peer Reynders wrote:

  • The WSDL uses the rpc/encoded messaging mode with SOAP encoding which is not supported by current generation SOAP stacks like JAX-WS, Axis2, or Apache CXF.


  • In other words: JAX-WS's wsimport cannot process a WSDL that uses the rpc/encoded messaging mode.


    Oskar Otw wrote:Hmm, maybe i don't understand what i should do...
    I have WS in webshop and I'm trying to get orders via SOAP. I'm sending request and getting error:

    ...

    I need to write my own Deserializer or what? Thanks in advance for any clue.



    It is likely that the SOAP stack doesn't support SOAP encoding at all.
    You can try Apache Axis 1.4 and its WSDL2Java code generation tool.

    Creating Web Services with Apache Axis: 3. WSDL2Java: Generate the Server-side Wrapper Code and Stubs For Easy Client Access

    However there still is a good chance that communication between the Axis Client and the SOAP encoded web service will still fail because of potentially divergent interpretations of the SOAP encoding "specification".
     
    Oskar Otw
    Greenhorn
    Posts: 4
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hmm but like I said I had used wscompile.bat to generate code. Now i have planty of classes, and I want to connect with WS and get response, but when I'm trying simply code i need to implement all abstract methods, and i don't have any idea what should i put into them, my main.class:

     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Oskar Otw wrote:Hmm but like I said I had used wscompile.bat to generate code. Now i have planty of classes, and I want to connect with WS and get response, but when I'm trying simply code i need to implement all abstract methods, and i don't have any idea what should i put into them, my main.class:



    But JAX-WS's wscompile aborted with errors so the code generation is incomplete. A web service consumer should not have to add any code to any abstract methods.

    The Java API for XML-Based Web Services (JAX-WS) 2.1 (JSR 224) maintenance release 2 specification wrote:
    1.2 Non-Goals

    The following are non-goals:
    ...
    SOAP Encoding Support Use of the SOAP encoding is essentially deprecated in the web services community, e.g., the WS-I Basic Profile excludes SOAP encoding. Instead, literal usage is preferred, either in the RPC or document style. SOAP 1.1 encoding is supported in JAX-RPC 1.0 and 1.1 but its support in JAX-WS 2.0 runs counter to the goal of delegation of data binding to JAXB. Therefore JAX-WS 2.0 will make support for SOAP 1.1 encoding optional and defer description of it to JAX-RPC 1.1. Support for the SOAP 1.2 Encoding is optional in SOAP 1.2 and JAX-WS 2.0 will not add support
    for SOAP 1.2 encoding
    .



    No JAX-WS implementation is under any obligation to attempt SOAP encoding support. So basically if you are looking for SOAP encoding support you have to use a JAX-RPC based SOAP stack like Apache Axis 1.4.
    See also Web services hints and tips: JAX-RPC versus JAX-WS, Part 1
    RPC/Encoded web services on Java 1.6
     
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Witaj Oskar.
    Netbeans 6.5 will download and generate everything you need. Do a right click on a project in the leftside menu, and choose to create a new Client Webservice. In the window that pops up, enter the url of the site you want to get the wsdl from. If Netbeans can find it, it will retrieve the wsdl file, and then put a Web Service References icon in your project. The problem isn't getting it the first time, the problem is that Netbeans wants to retrieve it every time you compile something. Fiddle with the jaxws-build.xml in nbprojects to stop the constant retrieval.

    szczecia!
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic