Skip to content

Instantly share code, notes, and snippets.

@juaoose
Last active November 20, 2018 02:42
Show Gist options
  • Save juaoose/8e5b4ae70ad633ed4bab5eb874b894d3 to your computer and use it in GitHub Desktop.
Save juaoose/8e5b4ae70ad633ed4bab5eb874b894d3 to your computer and use it in GitHub Desktop.

wsimport

If you need the w3 schema:

Go to the folder where you want to generate the service.

Create this file: xsd.xjb

Then run wsimport

"< wsimportpath >" -b http://www.w3.org/2001/XMLSchema.xsd -b xsd.xjb -Xnocompile service.wsdl

If you then want to generate a jar with this client:

  1. Create the folder META-INT/wsdl
  2. Copy your wsdl and xsd to that new folder.
  3. Use jar.exe (in java path) to create a jar C:\IBM\WebSphere\AppServer\java\bin\jar.exe cvf .jar <classes_folder> META-INF

If you are generating the client with RAD

Switch to the Java EE perspective (Window > Open Perspective > Java EE). Click File > New > Other. Select Web Services to display the various web service wizards. Select the Web Service Client wizard. Click Next. Web Services page: select the WSDL file that you use to generate the client. You can optionally choose to do the following: Select the stages of web service client development that you want to complete by using the slider. This sets several default values on the remaining wizard panels. Develop: develops the WSDL definition and implementation of the web service client. This includes such tasks as creating the modules, which contain the generated code, WSDL files, deployment descriptors, and Java files when appropriate. Assemble: ensures the project that hosts the web service client gets associated to an EAR when required by the target application server. Deploy: creates the deployment code for the client. Install: installs and configure the web module and EARs on the target server. If any changes to the endpoints of the WSDL file are required, they are made in this stage. Start: starts the server once the client has been installed on it. Test: provides various options for testing the service, such as using the Web Service Explorer or sample JSPs. Select your server: the default server is displayed. If you want to deploy your service to a different server click the link to specify a different server. This task supports the following server runtime environments: WebSphere Application Server V7.0 or later WebSphere Application Server Liberty V8.5.5 Select your runtime: the default runtime is displayed. If you want to deploy your service to a different runtime click the link to specify a different runtime. Select the client project: the project that is selected in your workspace is displayed. To select a different project and EAR click the project link. You can select a web project, an EJB project, a Java project, or a Java EE application client project as the location for the client code. Ensure that the project selected as the Client Web Project is different from the Service Web Project, or the service is overwritten by the client's generated artifacts. For JAX-WS web services, the server and client projects can share the same EAR. Monitor the web service: sends the web service traffic through the TCP/IP Monitor, which enables you to watch the SOAP traffic that is generated by the web service and to test this traffic for WS-I compliance. Alternately you can manually set up a TCP/IP monitor as described in Using the TCP/IP Monitor to test web services. WebSphere JAX-WS Web Service Client Configuration page: Output folder: Select the folder where you want the client's Java classes to be generated or accept the default. Target package: The web services client wizard generates a number of Java files from the specified WSDL. By default it creates a package name that is based on the namespace that is specified in the WSDL file. To override this default behavior, you can specify your own package name for the namespace in the WSDL file. Generate portable client: Selecting this check box would enable you to move your web service client code from one machine to another or from one instance of WebSphere Application Server to another. If this option is selected, the WSDL document and all the XML schema and other WSDL documents that it depends upon is copied into the client project under WEB-INF/wsdl and a file:relativeURL pointing to this copy is then iinjected into the JAX-WS Service class's static initialization block. Enable asynchronous invocation for generated client: If you select to enable an asynchronous client, for each method in the web service two more methods are created. These methods are polling and callback methods, which allow the client to function asynchronously. Specify JAX-WS or JAXB binding files: If you created JAX-WS or JAXB custom binding files, select this check box to use them to create this web service. Customize client proxy class name: You can accept the default proxy name or enter your own. Generate web service deployment descriptor: For JAX-WS web services deployment information is generated dynamically by the runtime; static deployment descriptors are no longer required. Selecting this check box generates them. Allow vendor extensions: If you select this check box, the -extension option is added to the wsgen or wsimport command. The -extension option specifies whether to enable or accept custom extensions for functionality not specified by the JAX-WS specification. Use of the extensions can result in applications that are not portable or do not interoperate with other implementations. For details, see wsgen command for JAX-WS applications and wsimport command for JAX-WS applications topics available in the Information Center for WebSphere Application Server. Custom binding declaration page: If you selected to supply a JAX-WS or JAXB binding file on the previous page, you can browse to where they are located. Proxy generation configuration page: If you selected to customize the client proxy class name, use this page to specify a proxy class name for each port. Web Service Client Test page: Test the generated proxy: If selected, the sample client is launched in a web browser which enables you to test the function. Select your test facility. You can test the generated proxy in the Web Service Explorer, or you can generate sample JAX-WS 2.0 JSPs. Folder: If you selected to test the proxy through a JSP, you can select the folder where the JSP is located, and you can select the methods that are included in the JSP. Methods: Select the methods to expose. If you selected to enable asynchronous invocation, the asynchronous methods should be listed as well. Run test on server: starts the server for you automatically. Click Finish. If you selected to test the proxy, the test client opens in a browser window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment