InteliJ Web Service Client Problem
First post, please excuse my ignorance. This is my first Java app. At long last I've given up C++!!.
I created a simple 'HelloWorld' web service, and tested it within Glassfish, and it seems ok, so I created a client application. However, intelliJ takes the WSDL and doesn't generate valid Java code for the client.
I have a very simple 'HelloWorld' service with a single method 'string <- sayHelloWorldFrom string: '
yet, intelliJ seems to generate invalid Java e.g:
mypackage.HelloWorld service = new HelloWorldService().();
//invoke business method
service.sayHelloWorldFrom();
'HelloWorld' is the Interface, , 'sayHelloWorldFrom' is the method on this class. But the constructor won't compile at all... any ideas, I'm sure it simple to someone who understands Java....
请先登录再写评论。
Discovered the problem, the client code should have generated:
mypackage.HelloWorld service = new mypackage.HelloWorldService().getHelloWorldPort();
Hello Michael!
Yeah. It should be.
Could you please send me your wsdl to look at? It shouldn't be huge. Also,
you can send me your java classes.
How did you create wsdl? Using "Tools -> WS -> Generate WSDL from Java Code"
action?
With best regards,
Konstantin Bulenkov
JetBrains Inc.
"Michael Lewis" <no_reply@jetbrains.com> wrote in message
news:12247098.58141219360045003.JavaMail.jive@app4.labs.intellij.net...
>
Try to load wsdl from your server. You probably loaded wsdl from disk and
this is the problem.
Konstantin Bulenkov
JetBrains, Inc
"Michael Lewis" <no_reply@jetbrains.com> wrote in message
news:12247098.58141219360045003.JavaMail.jive@app4.labs.intellij.net...
>
I have the same problem. My web service client code as below:
But I cannot run the web service client. My Intellij version is 2018.2.5.
HelloWorldServiceLocator locator = new HelloWorldServiceLocator();
example.HelloWorld_PortType port = locator.getHelloWorld();
String str = port.sayHelloWorldFrom("hi");
System.out.println("str=" + str);
These are my complete source code:
TestWebService.zip
https://onedrive.live.com/embed?cid=FBEB6373D9321A7F&resid=FBEB6373D9321A7F%21787476&authkey=AOU3rhSTFePTLc8
TestWebServiceClient.zip
https://onedrive.live.com/embed?cid=FBEB6373D9321A7F&resid=FBEB6373D9321A7F%21787475&authkey=AF3syG4klfj0Cn0
Answered in the related thread: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360001522479-How-to-call-web-services-by-java-web-application-?page=1#community_comment_360000249059