Marco Palazzini

Greenhorn
+ Follow
since Apr 18, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Marco Palazzini

Hi
I don't know what can be the problem. The only thing I can tell you is that I am working with jwddp, and the example (Hello) didn't give me any problem...
Marco
21 years ago
HI
I am developing WebServices using Sun's WSDP and xrpcc tool.
- Each WS is developed through a ServiceIF interface and a ServiceImpl implementation class.
- ServiceIF extends java.rmi.Remote
- each method (operation) is declared as throwing java.rmi.RemoteException
At this point, using stub classes, you do RPC calls to the methods.
I would like to define my own hierarchy of exceptions derived from RemoteException and use it to keep control over eventual failures of the operations.
What happens is:
- a method throws MyRemoteException (which extends RemoteException),
- on the client side I catch generic RemoteException
- on the client side the class of the caught exception results in RemoteException and not MyRemoteException
Do you know how I could get MyRemoteException on the client side?
I tried also using nested exceptions:
- the method throws an RemoteException having MyRemoteException nested
- the exception caught is RemoteException but when i try to get the nested exception using the getCause() method i get a om.sun.xml.rpc.client.SenderException.
Thanks
Marco
21 years ago
Hi
I cannot find the javadoc documentation for the package sun.com.xml.rpc and its sub-packages.
Does anybody know where I can find it?
In general, do you know of any place where this kind of information (javadoc for packages) is collected?
Thanks
Marco
21 years ago
Hi
I am using Sun's xrpcc tool (Web Services Developer Pack) to generate stubs for my web service. And some of the operatians of the web service have XML object as parameter or return type.
The types supported by JAX-RPC seem not to include any XML object (i.e. org.JDom.Document), (while, for example, WebSphere supports org.w3c.dom.Element).
Do you know of any XML object supported also by xrpcc?
Thanks
Marco
21 years ago
It works with both, good.
Thanks
Marco
21 years ago
ok, sorry guys, found spelling mistake
wrote "getInnnerBean()" with 3 "n" !!
Thanks, now it works :-)
Marco
21 years ago
Thanks William I will look up Sun's web site.
Mandan, I have tried both with WebSphere Application Studio Developer from IBM and with xrpcc tool (WSDK) from Sun. In the first case (IBM) it raised an exception at run-time telling that it doesn't find a serializer for the 'inner' bean. In the second (SUN) the 'inner' bean seems to arrive null to the WebService.
But it's good to know it should work, that is what I was hoping. Now I will find the way to make it work...
Thanks
Marco
p.s. If you have time and patience this is what I tried on Sun's WSDK but it seems not to work, maybe you can tell me why:
HelloBean.java
//////////////////////////////////////////////////
package hello;
/**
*
* @author marco
* @version
*/
public class HelloBean {
int field0;
HelloInnerBean innerBean;

/** Creates new HelloBean */
public HelloBean() {
}
public void setField0(int field0) {
this.field0 = field0;
}
public int getField0() {
return field0;
}

public void setInnerBean(HelloInnerBean innerBean) {
this.innerBean = innerBean;
}
public HelloInnerBean getInnnerBean() {
return innerBean;
}

public String toString(){
return "HelloBean [field0="+field0+",innerBean="+innerBean+"]";
}
}
//////////////////////////////////////////////////
HelloInnerBean.java
//////////////////////////////////////////////////
package hello;
/**
*
* @author marco
* @version
*/
public class HelloInnerBean {
int field0;

/** Creates new HelloInnerBean */
public HelloInnerBean() {
}
void setField0(int field0) {
this.field0 = field0;
}
int getField0() {
return field0;
}

public String toString() {
return "HelloInnerBean [field0="+field0+"]";
}

}
//////////////////////////////////////////////////
HelloIF.java
//////////////////////////////////////////////////
package hello;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface HelloIF extends Remote {
public String sayHello(String s) throws RemoteException;
public String sayHello(float f) throws RemoteException;

public String printBean(HelloBean helloBean) throws RemoteException;
}
//////////////////////////////////////////////////
HelloImpl.java
//////////////////////////////////////////////////
package hello;
public class HelloImpl implements HelloIF {
public String message = new String("Hello ");
public String sayHello(String s) {
return new String(message + s);
}
public String sayHello(float f) {
return new String(message + f);
}
public String printBean(HelloBean helloBean) {
return "HelloBean received: "+helloBean;
}

}
//////////////////////////////////////////////////
And finally the HelloClient.java
//////////////////////////////////////////////////
package hello;
public class HelloClient {
public static void main(String[] args) {
try {
HelloIF_Stub stub =
(HelloIF_Stub)(new HelloWorld_Impl().getHelloIF());
stub._setProperty(
javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,
args[0]);
System.out.println(stub.sayHello("Duke!"));

HelloBean helloBean = new HelloBean();
HelloInnerBean helloInnerBean = new HelloInnerBean();
helloInnerBean.setField0(12);
System.out.println("Created inner bean: "+helloInnerBean);
helloBean.setField0(9);
helloBean.setInnerBean(helloInnerBean);
System.out.println(stub.printBean(helloBean));
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
//////////////////////////////////////////////////
The final output is:
HelloBean received: HelloBean [field0=9,innerBean=null]
21 years ago
HI
given that it is possible to pass as parameters of a WebService operation any object according to the JavaBean specification without having to define any custom mapping (SOAP 2.2 provides a bean serializer class)
my question is: is it possible for a JavaBean to have as member field another JavaBean?
example:
///////////////////////////////////////////////
class Person { //main JavaBean
String name;
String surname;
Car myCar; //contained JavaBean
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setSurname(String surname) {
this.surname = surname;
}
public String getSurname() {
return surname;
}
public void setCar(Car myCar) {
this.myCar = car;
}
public Car getCar() {
return myCar;
}
}
class Car {
String builder;
String model;
public void setBuilder(String builder) {
this.builder = builder;
}
public String getBuilder() {
return builder;
}
public void setModel(String model) {
this.model = model;
}
public String getModel() {
return model;
}
}
///////////////////////////////////////////////
I tried with WebSphere but it seems not to be possible.
Can you also please give me a link to the JavaBean specification?
Thanks
Marco
21 years ago
Yes Kyle,
in the specifications I have been asked to have some web services accessible not using SOAP but just HTTP (GET). In the end the web service operation should be invoked just as a URL.
So I guessed you gave me the answer, the Application Developer does not support this kind of web services.
I don't know what a REST service is, can you give me any link about it?
Edit: I have found docs about REST architectural style. It may be that accessing a web service operation as a URI is in accordance with such style...
Sorry for having not been clear in my requests.
Thanks a lot
Marco
[ May 13, 2002: Message edited by: Marco Palazzini ]
21 years ago
Thanks Kyle,
I have been following the tutorials both in the Help Perspective of the Application Developer and in the red book. But all the web services in the examples seem to use SOAP/HTTP for the communication.
While I would need an example of web service for which the operations are accessible directly via HTTP GET, as URLs.
Is it possible? Should the web service be implemented as a servlet? Maybe it wouldn't be a "web service" anymore... I am quite confused.
Thanks
Marco
21 years ago
Hi,
I am using IBM's tool and I cannot see how to create a web service and make it accessible through HTTP (GET or POST).
The approach chosen is to create a web service starting from a Java Bean (a plain Java class). The tool generates proxy classes that access the web service through SOAP/HTTP.
My second need would also be to have the same operation accessible both through HTTP GET and SOAP/HTTP.
Thanks
Marco
21 years ago
Hi
I tried to do the same with Sun's Web Services Development Pack (http://java.sun.com/webservices/index.html). I overloaded a method of the tutorial example (HelloWorld) and made it generate the WSDL.
To develop a Web Service using Sun's WSDP you have to specify an interface and its implementation. The tutorial modified by me looks like this:
interface HelloIF.java
--------------------------------------------------
package hello;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface HelloIF extends Remote {
public String sayHello(String s) throws RemoteException;
public String sayHello(float f) throws RemoteException;
}
--------------------------------------------------
implementation HelloImpl.java
--------------------------------------------------
package hello;
public class HelloImpl implements HelloIF {
public String message = new String("Hello ");
public String sayHello(String s) {
return new String(message + s);
}
public String sayHello(float f) {
return new String(message + f);
}

}
--------------------------------------------------
The WSDL automatically generated:
--------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<definitions name="HelloWorldService" targetNamespace="http://hello.org/wsdl" xmlns:tns="http://hello.org/wsdl" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types />
<message name="sayHello">
<part name="float_1" type="xsd:float" />
</message>
<message name="sayHelloResponse">
<part name="result" type="xsd:string" />
</message>
<message name="sayHello2">
<part name="String_1" type="xsd:string" />
</message>
<message name="sayHello2Response">
<part name="result" type="xsd:string" />
</message>
<portType name="HelloIF">
<operation name="sayHello">
<input message="tns:sayHello" />
<output message="tns:sayHelloResponse" />
</operation>
<operation name="sayHello2">
<input message="tns:sayHello2" />
<output message="tns:sayHello2Response" />
</operation>
</portType>
<binding name="HelloIFBinding" type="tns:HelloIF">
<operation name="sayHello">
<input>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="http://hello.org/wsdl" />
</input>
<output>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="http://hello.org/wsdl" />
</output>
<soap peration soapAction="" />
</operation>
<operation name="sayHello2">
<input>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="http://hello.org/wsdl" />
</input>
<output>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="http://hello.org/wsdl" />
</output>
<soap peration soapAction="" />
</operation>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
</binding>
<service name="HelloWorld">
<port name="HelloIFPort" binding="tns:HelloIFBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL" />
</port>
</service>
</definitions>
--------------------------------------------------
So, it seems that WSDL does not support overloading as in the spec.
Or maybe there is something I am missing...
Marco
21 years ago
Hello everybody
I am working to an application that has been designed as a collection of Web Services, and I am trying to understand which implementation is most suitable. I have never been developing J2EE applications but I know that a Web Service for example may be implemented as an EJB. But it may also be implemented as a Servlet as well...
I was thinking that having some examples of real implementations in mind it would have helped me.
So I am here to ask you to send me a brief description of any 'case' you have worked on.
Thank you very much,
Marco
21 years ago