Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Sending Complex Objects Using SOAP
Sending Complex Objects Using SOAP [message #170633] Mon, 05 June 2006 16:18 Go to next message
Eclipse User
Originally posted by: yitzchok.rentmagic.ca

Hi.
I want to use Axis to return a simple class. When i try to generate the
Web Services I get 3 error messages. (Plus the error messege that TomCat 5
does not support Port Listening which is not true and I think I filed a
bug report on it - "IWAB0002I Apache Tomcat v5.5 does not support port
monitoring.")
First I get twice "Error in generating sample JSP" then an error message
window with no text message ("") with [OK/Details] and a lot of details.
Can someone just post code for me that will let me get a Complex Object
back from an Axis server using SOAP?

Using wtp-all-in-one-sdk-R-1.0.2-200604200208-win32.zip
-------------------------------------------------
Class code
-------------------------------------------------
public class MyClass
{
public MyClass() {};
protected int integer;
protected String str;
public String getStr() { return str;}
public int getInteger() { return integer;}
public void setStr(String str1) { str =str1;}
public void setInteger(int i) { integer = i;}

}
-------------------------------------------------
The servlet code (Dynamic Web Project)
-------------------------------------------------
public class serv {
public MyClass echo (int celsius)
{
MyClass t = new MyClass();
t.setInteger(celsius);
return t;
}
}
-------------------------------------------------
The client code:
-------------------------------------------------
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.ksoap2.*;
import org.ksoap2.serialization.*;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;

public class test {
public static void main(String[] args) throws IOException,
XmlPullParserException {
SoapObject soap = new SoapObject("http://wtp", "echo");
soap.addProperty("celsius", 64);
SoapSerializationEnvelope envelope =
new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = soap;
HttpTransportSE ht = new
HttpTransportSE("http://localhost:10477/serve/services/serv");
ht.call("http://schemas.xmlsoap.org/soap/envelope/", envelope);
SoapObject soapIn = (SoapObject)envelope.bodyIn;
System.out.print(soapIn.toString());
}
}
-------------------------------------------------
Re: Sending Complex Objects Using SOAP [message #170880 is a reply to message #170633] Thu, 08 June 2006 13:36 Go to previous message
Kathy Chan is currently offline Kathy Chan
Messages: 93
Registered: July 2009
Member
Hi Isaac,

It looks like you've found a bug in the sample JSP generation. Could you
please open a bugzilla with the classes you used and the steps to reproduce
the problem? Thanks!

Regards,

Kathy Chan

"Isaac Good" <yitzchok@rentmagic.ca> wrote in message
news:c258f5ca1b6a42e63dd83812496407fe$1@www.eclipse.org...
> Hi.
> I want to use Axis to return a simple class. When i try to generate the
> Web Services I get 3 error messages. (Plus the error messege that TomCat 5
> does not support Port Listening which is not true and I think I filed a
> bug report on it - "IWAB0002I Apache Tomcat v5.5 does not support port
> monitoring.")
> First I get twice "Error in generating sample JSP" then an error message
> window with no text message ("") with [OK/Details] and a lot of details.
> Can someone just post code for me that will let me get a Complex Object
> back from an Axis server using SOAP?
>
> Using wtp-all-in-one-sdk-R-1.0.2-200604200208-win32.zip
> -------------------------------------------------
> Class code
> -------------------------------------------------
> public class MyClass
> {
> public MyClass() {};
> protected int integer;
> protected String str;
> public String getStr() { return str;}
> public int getInteger() { return integer;}
> public void setStr(String str1) { str =str1;}
> public void setInteger(int i) { integer = i;}
>
> }
> -------------------------------------------------
> The servlet code (Dynamic Web Project)
> -------------------------------------------------
> public class serv {
> public MyClass echo (int celsius)
> {
> MyClass t = new MyClass();
> t.setInteger(celsius);
> return t;
> }
> }
> -------------------------------------------------
> The client code:
> -------------------------------------------------
> import java.io.BufferedReader;
> import java.io.IOException;
> import java.io.InputStreamReader;
> import org.ksoap2.*;
> import org.ksoap2.serialization.*;
> import org.ksoap2.transport.HttpTransportSE;
> import org.xmlpull.v1.XmlPullParserException;
>
> public class test {
> public static void main(String[] args) throws IOException,
> XmlPullParserException {
> SoapObject soap = new SoapObject("http://wtp", "echo");
> soap.addProperty("celsius", 64);
> SoapSerializationEnvelope envelope =
> new SoapSerializationEnvelope(SoapEnvelope.VER11);
> envelope.bodyOut = soap;
> HttpTransportSE ht = new
> HttpTransportSE("http://localhost:10477/serve/services/serv");
> ht.call("http://schemas.xmlsoap.org/soap/envelope/", envelope);
> SoapObject soapIn = (SoapObject)envelope.bodyIn;
> System.out.print(soapIn.toString());
> }
> }
> -------------------------------------------------
>
Previous Topic:Abnormal exit
Next Topic:WebServices using WTP
Goto Forum:
  


Current Time: Wed Jul 23 06:05:32 EDT 2014

Powered by FUDForum. Page generated in 0.02232 seconds