- This topic has 2 replies, 2 voices, and was last updated 18 years, 2 months ago by Greg.
-
AuthorPosts
-
jhmMemberThe generated web service client is missing the library Apache Jakarta Commons HttpClient, maybe a dependency of XFire itself…
Version: MyEclipse 5.1 (FullStack)
Scenario
<pre>
1) Create new JavaProject
name = WSTest
new project in workspace
default JRE (MyEclipse5.1.0 = Java 1.5.0_08-b03)
seperate source and output (default=src + bin)2) Add Web Service Capabilities
(MyEclipse | Add Web Service Capabilities)
Configuration as provided
XFire Web Services Configuration
services.xml file = new
configuration folder = WebServices
configuration file name = services.xml
Library Configuration (as suggested)
XFire 1.2 Core Libraries – <MyEclipse-Library>3) Create Web Service Client
(File | New | Other | MyEclipse::Web Services::Web Services Client)
project : WSTest
Service Definition
wsdl url : <wsdl of one of our webservices in production>
java source folder : src
java package : <NEW “plzclient”>
Required MyEclipse XFire libraries
XFire 1.2 JAXB2 Libraries – <MyEclipse-Library>= Class Files are generated
* some classes according to the specification inside the wsdl in
package de.rzf.ddv.services.postdienste
* two classes in package plzclient
interface PostDienste
class PlzOrtServiceClient4) Use the client in *ServiceClient.main(String[]) directly after “//TODO: Add custom client code here”
//create a default service endpoint
PostDienste postDienste = client.getPostDiensteLocalEndpoint();//TODO: Add custom client code here
postDienste = client.getPostDienste(); // change to production webservice
PlzOrtAntwort plzOrt = postDienste.getPlzOrt(40476); // access to webservice
System.out.println( plzOrt.getORTNAME() ); // print the result5) Then I started that class as Java application and got the stacktrace
Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEntity
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:108)
at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
at org.codehaus.xfire.client.Client.invoke(Client.java:335)
at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
at $Proxy12.getPlzOrt(Unknown Source)
at plzclient.PlzOrtServiceClient.main(PlzOrtServiceClient.java:122)Notes
========
1. RFE: In step 2) “creating the ws-client” you cant insert a new package name without the dialog via button “new”. It would be easier (for the user 😉 if the user just types in the package name and MyEclipse does a check (spellcheck against existing packages) and asks for creating a new package or renaming to another one (if spellcheck had found one).2. RFE: In the *ServiceClient class after generation in step 3) there are some Eclipse warnings:
public PlzOrtServiceClient() {
create0();
…
endpoints.put(new QName( … ===> safety warning “raw type”
…
}
private void create0() {
…
props.put(“annotations.allow.interface”, true); ===> safety warning “raw type”
…
service0 = asf.create( … ) ;
{
AbstractSoapBinding soapBinding = ===> local variable never read
asf.createSoap11Binding(service0, …)These warnings should be eliminated. Simplest form would be using
@SuppressWarnings(“unchecked”)
@SuppressWarnings(“unused”)
annotations. Better – if possible – would be changing the template code.3. Workaround: It seems that there is one library missing (Apache Jakarta Commons HTTPClient).
I had a 3.0rc1 on my harddisk so I added that to the project and then it worked.
So I think there is an error in MyEclipse5.1’s library bunding (XFire 1.2 Core Libraries) or in the wizard in step 3.</pre>
jhmMemberBTW, how to I post coding? As you can see <pre> tags insert an additional blank line ….
GregMemberYou can use the code tags, [ code ] …. [/ code ], but just without the spaces because I used those for demonstration. At the beginning that is an option for including the XFire HTTP Client library. Then that library would be bundled in your webapplication deployment. You can also add the XFire HTTP Client libraries to your existing project from the java Build path property page. Go to the project property, under Java Build Path select the Libraries tab and then select the “Add Library” button and choose MyEclipse Libraries > XFire 1.2 HTTP Client.
-
AuthorPosts