• 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

using custom class in JWSDP

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could anyone who knows this help me?
I'm setting up a web service using jaxrpc and a client using dynamic proxy, just like the helloservice and helloclient in the JWSDP tutorial, only that I added a class of my own (MyClass) and both the service and client need to access this class. I put the jar file of MyClass in the compile and run path of both service and client. It works for the service, but whenever I ant build the client, a copy of MyClass will be put under the build folder, and when I run the client, it says it cannot find MyClass.
I've tried everything I could think of, so thanks so much whoever can help!
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you post some more details like the commands you run the client with, etc.?
 
Ranch Hand
Posts: 120
IntelliJ IDE Hibernate Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm :-)
The server and client use different classes to the web service call. Probably from the your point of view they look the same but in fact it is
different classes (probably belonging to the same package). The reason
is that client does not know about server implemenation. You can use .NET
as webservice implementation (not java). You should generate client
stub code. Using ant target from JWSDP examples
<target name="generate-stubs"
description="Runs wscompile to generate the client stub classes">
<antcall target="run-wscompile">
<param name="param1" value="-gen:client -d ${build}
-classpath ${build}/${mpas} ${config.wsdl.file}"/>
</antcall>
</target>
It will create a copy (but not original) of paramter class that you should
use. Package name may or may not be the same like you used on server - depend on namespace
 
Anita Wang
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for helping! Here is the error message when I run the client:
***************************************************************************
Buildfile: build.xml
run-client:
[java] nameSpaceUri= http://localhost:8080/shippingarrangementservice-masterproject/shippingarrangementservice?WSDL
[java] java.lang.NoClassDefFoundError: shippingarrangementclient/ShippingArrangement
[java] at java.lang.Class.getDeclaredMethods0(Native Method)
[java] at java.lang.Class.privateGetDeclaredMethods(Class.java:1647)
[java] portName= ShippingArrangementIFPort
[java] at java.lang.Class.privateGetPublicMethods(Class.java:1770)
[java] at java.lang.Class.getMethods(Class.java:824)
[java] at com.sun.xml.rpc.client.dii.ConfiguredService.getPortNameForIn
terface(ConfiguredService.java:140)
[java] at com.sun.xml.rpc.client.dii.ConfiguredService.getPort(ConfiguredService.java:127)
[java] at shippingarrangementclient.ShippingArrangementClient.main(Unknown Source)
[java] Exception in thread "main"
[java] Java Result: 1
run:
BUILD SUCCESSFUL
Total time: 2 seconds
**************************************************************************
ShippingArrangement is the class I defined. In my client targets.xml, I used the following target:
**************************************************************************
<target name="generate-interface" description="Runs wscompile to generate the service endpoint interface">
<echo message="Generating the service endpoint interface...."/>
<antcall target="run-wscompile">
<param name="param1" value="-import -d ${build} -nd ${build} -f:norpcstructures -verbose -classpath ${build} ${config.wsdl.file}"/>
</antcall>
</target>
 
Anita Wang
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Forgot to say, the client build with no problem. After the build, there is a ShippingArrangement class file generated in the build file under the shippingarrangementclient folder. So I don't know why it says it cannot find the shippingarrangementclient/ShippingArrangement class.
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Anita Wang:
Forgot to say, the client build with no problem. After the build, there is a ShippingArrangement class file generated in the build file under the shippingarrangementclient folder. So I don't know why it says it cannot find the shippingarrangementclient/ShippingArrangement class.

Are you telling the JVM to include it into the classpath? Have you double-checked for typos in your classpath?
 
Catch Ernie! Catch the egg! And catch this tiny ad too:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic