The client and impl that the "-all" flag generates are simple skeletons to 
help you get started.   You need to edit them to fill in the details.   
Specifically, in your case, for the client:


        org.oasis_open.docs.wsn.b_2.Notify _notify_notify = null;
        port.notify(_notify_notify);

You need to edit the code to instantiate the Notify object and fill in 
whatever details you need.

When you run the wsdl2java, you can add the -defaultValues flag which would 
create instances and fill in some random data, but that's likely not what you 
REALLY want to do.

Dan



On Wednesday 16 March 2011 10:00:37 AM Stefan wrote:
> Hi,
> I have met a problem when I tried to run the server and client.
> This is NotificationConsumerService.wsdl:
> http://cxf.547215.n5.nabble.com/file/n3782127/NotificationConsumerService.w
> sdl NotificationConsumerService.wsdl
> I use this command to generate Java code and build.xml :
> wsdl2java -d %my_path% -all %my_path%/NotificationConsumerService.wsdl
> And it generate the Java Code and a build.xml
> http://cxf.547215.n5.nabble.com/file/n3782127/build.xml build.xml
> then I run this command under %my_path% :ant build, it works
> After that use the command ant NotificationConsumerServer to run the
> service, it is running and ready.But when I try to run the client using
> this command ant NotificationConsumerClient, there are some faults like
> this:
> 
> D:\Hiwi\Document\DocumentForService>ant NotificationConsumerClient
> Buildfile: D:\Hiwi\Document\DocumentForService\build.xml
> 
> compile:
>     [javac] D:\Hiwi\Document\DocumentForService\build.xml:112: warning:
> 'include
> antruntime' was not set, defaulting to build.sysclasspath=last; set to
> false for
>  repeatable builds
> 
> NotificationConsumerClient:
>      [java] Invoking notify...
>      [java] 2011-3-16 14:43:22 org.apache.cxf.phase.PhaseInterceptorChain
> doDefa
> ultLogging
>      [java] 警告: Interceptor for
> {http://stefan.cxf/NotificationService}Notific
> ationConsumerService#{http://docs.oasis-open.org/wsn/bw-2}Notify has thrown
> exce
> ption, unwinding now
>      [java] org.apache.cxf.interceptor.Fault: Could not send Message.
>      [java]     at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSe
> nderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
>      [java]     at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseI
> nterceptorChain.java:255)
>      [java]     at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516
> )
>      [java]     at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313
> )
>      [java]     at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265
> )
>      [java]     at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.ja
> va:73)
>      [java]     at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy
> .java:124)
>      [java]     at $Proxy40.notify(Unknown Source)
>      [java]     at
> org.oasis_open.docs.wsn.bw_2.NotificationConsumer_Notificatio
> nConsumerPort_Client.main(NotificationConsumer_NotificationConsumerPort_Cli
> ent.j ava:55)
>      [java] Caused by: java.io.IOException: Server returned HTTP response
> code:
> 500 for URL:
> http://localhost:8055/CXFExample3/services/NotificationConsumerPort
> 
>      [java]     at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>  Method)
>      [java]     at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeC
> onstructorAccessorImpl.java:39)
>      [java]     at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Del
> egatingConstructorAccessorImpl.java:27)
>      [java]     at
> java.lang.reflect.Constructor.newInstance(Constructor.java:51
> 3)
>      [java]     at
> sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConn
> ection.java:1368)
>      [java]     at java.security.AccessController.doPrivileged(Native
> Method)
>      [java]     at
> sun.net.www.protocol.http.HttpURLConnection.getChainedExcepti
> on(HttpURLConnection.java:1362)
>      [java]     at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(Ht
> tpURLConnection.java:1016)
>      [java]     at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream
> .handleResponseInternal(HTTPConduit.java:2267)
>      [java]     at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream
> .handleResponse(HTTPConduit.java:2193)
>      [java]     at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream
> .close(HTTPConduit.java:2037)
>      [java]     at
> org.apache.cxf.transport.AbstractConduit.close(AbstractCondui
> t.java:56)
>      [java]     at
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.j
> ava:697)
>      [java]     at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSe
> nderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
>      [java]     ... 8 more
>      [java] Caused by: java.io.IOException: Server returned HTTP response
> code:
> 500 for URL:
> http://localhost:8055/CXFExample3/services/NotificationConsumerPort
> 
>      [java]     at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(Ht
> tpURLConnection.java:1313)
>      [java]     at
> java.net.HttpURLConnection.getResponseCode(HttpURLConnection.
> java:373)
>      [java]     at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream
> .handleResponseInternal(HTTPConduit.java:2224)
>      [java]     ... 13 more
>      [java] Exception in thread "main" javax.xml.ws.WebServiceException:
> Could n
> ot send Message.
>      [java]     at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy
> .java:135)
>      [java]     at $Proxy40.notify(Unknown Source)
>      [java]     at
> org.oasis_open.docs.wsn.bw_2.NotificationConsumer_Notificatio
> nConsumerPort_Client.main(NotificationConsumer_NotificationConsumerPort_Cli
> ent.j ava:55)
>      [java] Caused by: java.io.IOException: Server returned HTTP response
> code:
> 500 for URL:
> http://localhost:8055/CXFExample3/services/NotificationConsumerPort
> 
>      [java]     at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>  Method)
>      [java]     at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeC
> onstructorAccessorImpl.java:39)
>      [java]     at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Del
> egatingConstructorAccessorImpl.java:27)
>      [java]     at
> java.lang.reflect.Constructor.newInstance(Constructor.java:51
> 3)
>      [java]     at
> sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConn
> ection.java:1368)
>      [java]     at java.security.AccessController.doPrivileged(Native
> Method)
>      [java]     at
> sun.net.www.protocol.http.HttpURLConnection.getChainedExcepti
> on(HttpURLConnection.java:1362)
>      [java]     at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(Ht
> tpURLConnection.java:1016)
>      [java]     at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream
> .handleResponseInternal(HTTPConduit.java:2267)
>      [java]     at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream
> .handleResponse(HTTPConduit.java:2193)
>      [java]     at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream
> .close(HTTPConduit.java:2037)
>      [java]     at
> org.apache.cxf.transport.AbstractConduit.close(AbstractCondui
> t.java:56)
>      [java]     at
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.j
> ava:697)
>      [java]     at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSe
> nderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
>      [java]     at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseI
> nterceptorChain.java:255)
>      [java]     at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516
> )
>      [java]     at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313
> )
>      [java]     at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265
> )
>      [java]     at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.ja
> va:73)
>      [java]     at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy
> .java:124)
>      [java]     ... 2 more
>      [java] Caused by: java.io.IOException: Server returned HTTP response
> code:
> 500 for URL:
> http://localhost:8055/CXFExample3/services/NotificationConsumerPort
> 
>      [java]     at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(Ht
> tpURLConnection.java:1313)
>      [java]     at
> java.net.HttpURLConnection.getResponseCode(HttpURLConnection.
> java:373)
>      [java]     at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream
> .handleResponseInternal(HTTPConduit.java:2224)
>      [java]     ... 13 more
>      [java] Java Result: 1
> 
> BUILD SUCCESSFUL
> Total time: 34 seconds
> D:\Hiwi\Document\DocumentForService>
> 
> Is there anybody know the reason ? Thanks~~
> 
> PS: I have done the same things before, and this no fault, and the server
> can successfully receive the SOAP message.But this time I don't know why it
> has problem...
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/problem-when-run-the-client-which-is-gener
> ate-from-wsdl2java-tp3782127p3782127.html Sent from the cxf-user mailing
> list archive at Nabble.com.

-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog
Talend - http://www.talend.com

Reply via email to