Skip to main content

WSDL, URI and that's it...

4 replies [Last post]
hawkini
Offline
Joined: 2007-01-10
Points: 0

I have a standalone Java application, which needs to call a webservice and several methods on that service. All I have is a WSDL file for the service, and the URI to call it. I have RAD 6, but I haven't done much work with web services. Can someone please tell me what I should be doing? I have generated two objects (a ...BindingImpl) and ...PortType, but not sure how to use them. I understand the principal of setting up a Call and Invoking it - but the WSDL stuff is confusing me!

Cheers,

Matt

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sandoz
Offline
Joined: 2003-06-20
Points: 0

Hi Matt,

I recommend going through the Web Services (JAX-WS) in Java EE 5 using NetBeans [1]. This is probably the fastest way you can get started. Exercise 3.1 [2] is likely of most interest to you as this explains how a Java SE client can invoke a Web service.

Paul.

[1] http://www.netbeans.org/kb/55/websvc-jax-ws.html
[2] http://www.netbeans.org/kb/55/websvc-jax-ws.html#Exercise_3_1

hawkini
Offline
Joined: 2007-01-10
Points: 0

Hi, many thanks for the help. I have a webservice now, but on one method it returns an UnsignedInt. My documentation tells me that the most significant 16 bits represents a status code, and the least significant 16 bits represents any error codes.

Can someone tell me what I can do to get this information? At the moment I can do a byteValue() on the UnsignedInt but it only returns the least significant 16 bits... and intValue returns a huge number which makes no sense (for obvious reasons)...

Many thanks! (and once again thanks Sandoz for the pointers)...

Matt

sandoz
Offline
Joined: 2003-06-20
Points: 0

Hi Matt,

Being a little direct: that is rather elementary Java stuff :-) I recommend getting a good Java book [1] and read up on Java bitwise and bit-shift operators (although i must admit the signed/unsigned thing can cause confusion at first).

Note that Integer.byteValue *converts* the Integer value to a byte, it does not get the least significant 16 bits.

If i understand correctly this should do it for you:

int value = ... // the unsigned int
int statusCode = (value >>> 16)
int errorCode = (value & 0xFFFF)

Paul.

[1] http://www.oreilly.com/catalog/javanut5/

oleksiys
Offline
Joined: 2006-01-25
Points: 0

Not talking specifically about RAD6, I can say that WSDL is not the thing you should care about if you want just to "call a webservice and several methods". Once you have WSDL - WebServices framework could be able to generate the WebServices client stubs, which you can use.