Help me with my client!!! [message #119888] |
Tue, 12 July 2005 13:24 |
Eclipse User |
|
|
|
Originally posted by: andreas140983.libero.it
Hi, I want create a generic soap client that can be useful in order to
invoke every web service...may it be possible?
For example this is my web service method interface:
public ProductInfo ActorSearchRequest(String author, int number);
where ProductInfo is so defined:
public class ProductInfo{
String TotalResults;
String TotalPages;
String ListName;
}
My client is defined in this way:
clientWS(Vector params, String urn, String methodName, URL url)
{
//params contain the parameter elements
Call call = new Call ();
// Service uses standard SOAP encoding
String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
call.setEncodingStyleURI(encodingStyleURI);
// Set service locator parameters
call.setTargetObjectURI (urn);
call.setMethodName (methodName);
// Create input parameter vector
call.setParams (params);
// Invoke the service ....
Response resp = call.invoke (url,"");
// ... and evaluate the response
if (resp.generatedFault ()) {
throw new Exception();
} else {
// Call was successful. Extract response parameter and return
result
Parameter result = resp.getReturnValue ();
At this point, how I can return a ProductInfo object and use its
elements(TotalResults, TotalPages,...)?
In other words...I want have:
ProductInfo element = (ProductInfo) result.getValue();
This object isn't defined in the java.lang.class and I want to pass it
when I call my client!
I won't to insert directly the previous line of code because I must create
a generic client!
Excuse me for my bad English but I 'm an italian boy!
Help me please!!!!!!
Andrea
|
|
|
Powered by
FUDForum. Page generated in 0.03215 seconds