aspose file tools*
The moose likes Web Services and the fly likes Can't generate java classes from WSDL file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Can Watch "Can New topic
Author

Can't generate java classes from WSDL file

Oskar Otw
Greenhorn

Joined: Jan 17, 2009
Posts: 4
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]
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
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

    Joined: Jan 17, 2009
    Posts: 4
    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

    Joined: Jan 17, 2009
    Posts: 4
    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

    Joined: Aug 19, 2005
    Posts: 2922
        
        5
    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

    Joined: Jan 17, 2009
    Posts: 4
    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

    Joined: Aug 19, 2005
    Posts: 2922
        
        5
    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 [surl='http://www.javaranch.com' class='faq' title='JavaRanch wrote:Java[/surl] API for XML-Based Web Services (JAX-WS) 2.1 (JSR 224) maintenance release 2 specification]
    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
    Gary Harris
    Greenhorn

    Joined: Jan 28, 2009
    Posts: 3
    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!
     
     
    subject: Can't generate java classes from WSDL file