Forum Discussion

Aman85's avatar
Aman85
Occasional Contributor
7 years ago

Generating a WSDL-first web service using SoapUI tool

Hi,

i have made the following set up as mentioned in Soapui-Cookboook by rupert anderson,to generate a WSDL-first web serviceusing SoapUI tool , but on trying to 'Generate' i get an error:

 

Error message::
Unexpected argument: invoice_v1.wsdl


WSDLToJava Error: org.apache.cxf.tools.common.toolspec.parser.BadUsageException: Unexpected argument: invoice_v1.wsdl


org.apache.cxf.tools.common.ToolException: org.apache.cxf.tools.common.toolspec.parser.BadUsageException: Unexpected argument: invoice_v1.wsdl

 

Set-Up in SOAPUI:

 

1. In SoapUI, go to Tools | Apache CXF, and when the Apache CXF Stubs window
appears, click on the Tools button to bring up the SoapUI Preferences window.
Here, browse to the location where you downloaded Apache CXF, select the bin
directory, and then click on OK:
2. Next, we need to configure the generation options under the Basic tab. The main
points are:
WSDL location: For example, <chapter1
samples>/soap/invoicev1/wsdl/invoice_v1.wsdl.
Output directory: This is where the generated source code will end up; for
example; <chapter1 samples>/soap/invoicev1/src/main/java.
Package Structure: This is for the generated source code; for example,
ws.invoice.v1.
Artifact Options: Only tick Server and Implementation. However, the client
and Ant build file options are also available. We will be using SoapUI as our
client and won’t require Ant.
3. To automatically compile our generated service code, under the Advanced tab, do the
following:
Tick Compile.
Supply a Class Folder value for the resulting Java class files, for example,
<chapter1 samples>/soap/invoicev1/target/classes.
Tick Validate WSDL (optional) under the advanced tab to check the structure
and get basic WS-I compliance checks on your WSDL. Note that the
invoice_v1.wsdl should not produce any output with this option.
Leave all other fields and checkboxes unchanged.


4. Under the Custom Args tab, enter –wsdlLocation invoice_v1.wsdl in Tool Args.
This tells the web service code where to look for the WSDL file at runtime. Setting
the value like this means that invoice_v1.wsdl is expected to be the root of the
classes directory. More on this in the next section.


5. Now, we are ready to click on Generate

2 Replies

  • Greetings.

     

    1 - Open the "Apache CXF Stubs" window.

     

    2 - In the "Apache CXF Stubs" window, click on the "Custom Args" tab

     

    3 - If you go in the book, you will notice that the author said this:

    "Under the Custom Args tab, enter –wsdlLocation invoice_v1.wsdl in Tool Args.
    This tells the web service code where to look for the WSDL file at runtime."

    This is where the the error is.You should not enter –wsdlLocation invoice_v1.wsdl in Tool Args,

    you should leave Tool Args empty.I attached a picture to show you the configuration in the "Custom Args" tab.

     

    4 - You can click on the "Generate" button.

     

     

    Do this and it will works.

    Sincerely.

    • rupert_anderson's avatar
      rupert_anderson
      Valued Contributor

      Hi,

       

      Thank you fromltow ! And sorry Aman85 that I didn't spot this question!

       

      I do try to scan the posts (as I still care a lot about SoapUI), but am not as active on the community as I used to be due to work pressures - please also consider sending me private messages if you need any help on the book's recipes.

       

      Nice to know someone actually tried that recipe too, not one of my favourites.

       

      Thanks,

      Rupert