Hi Martin,
yes exactly and that's the reason we switched over to REST services and
particularly for
mobile devices. Even though ksoap2 on Android seems to be fairly
efficient it's still a bit
heavier that the REST/HTTP mechanisms.
Regarding the publishing of the REST service, as you pointed out there's
not a standard
method to publish them - some ideas I saw generate documents that
describe the directory
hierarchy for the server side along with the URL specifications on how
to reach the various
resources. I use Ajax for building clients for these services. But I can
certainly work with you
on coming up with may be a more general architecture.
In any case, thanks for the feedback and I will let you know about this
once I give it a bit
more thought. I appreciate the information and help Martin.
On 4/21/2011 11:30 AM, Martin Gainty wrote:
not yet here is their doc
Please note that SOAP introduces some significant overhead for web
services that may be problematic for mobile devices. If you have full
control over the client and the server, a REST based architecture may
be more adequate.
maybe you can create a testcase and we can come up with an
architecture to
1)publish the REST service
2)create a Stub client which will consume the REST message
did you have anything specific in mind?
Martin
______________________________________________
Do not alter or disrupt this transmission.
------------------------------------------------------------------------
Date: Thu, 21 Apr 2011 10:00:15 -0400
From: [email protected]
To: [email protected]
Subject: Re: Woden on mobile devices
Hi Martin,
apologies for re-posting this one - do you have an idea on whether the
segment you sent below
can handle REST-annotated WSDL files?
Thanks
On 4/16/2011 10:54 AM, Demetris wrote:
Hi Martin,
isn't this parsing a SOAP WSDL file using the ksoap2 libs? Can it
handle documents that describe
REST as well? I guess it should but i am not sure. I will need to
look into a bit more carefully.
I appreciate the feedback
On 4/15/2011 12:12 PM, Martin Gainty wrote:
http://sourceforge.net/projects/ksoap2/files/ksoap2/2.1.2/ksoap2-j2me-core-2.1.2.jar/download
take a look at org.ksoap2.transport.HttpTransport
ksoap2\target\classes>javap .\org\ksoap2\transport\HttpTransport
public class org.ksoap2.transport.HttpTransport extends
org.ksoap2.transport.Transport{
org.ksoap2.transport.ServiceConnection connection;
java.io.OutputStream os;
java.io.InputStream is;
public org.ksoap2.transport.HttpTransport(java.lang.String);
public void call(java.lang.String,
org.ksoap2.SoapEnvelope) throws java.io.IOException,
org.xmlpull.v1.XmlPullParserException;
public void reset();
protected org.ksoap2.transport.ServiceConnection
getServiceConnection()
throws java.io.IOException;
}
//vs the axis HttpTransportReceiver
public class
org.apache.axis2.transport.http.HTTPTransportReceiver {
public static Map getGetRequestParameters(String requestURI) {
Map map = new HashMap();
if (requestURI == null || "".equals(requestURI)) {
return map;
}
char[] chars = requestURI.toCharArray();
final int NOT_BEGUN = 1500;
final int INSIDE_NAME = 1501;
final int INSIDE_VALUE = 1502;
int state = NOT_BEGUN;
StringBuffer name = new StringBuffer();
StringBuffer value = new StringBuffer();
for (int index = 0; index < chars.length; index++) {
if (state == NOT_BEGUN) {
if (chars[index] == '?') {
state = INSIDE_NAME;
}
} else if (state == INSIDE_NAME) {
if (chars[index] == '=') {
state = INSIDE_VALUE;
} else {
name.append(chars[index]);
}
} else if (state == INSIDE_VALUE) {
if (chars[index] == ',') {
state = INSIDE_NAME;
map.put(name.toString(), value.toString());
name.delete(0, name.length());
value.delete(0, value.length());
} else {
value.append(chars[index]);
}
}
}
if (name.length() + value.length() > 0) {
map.put(name.toString(), value.toString());
}
return map;
}
public static String getServicesHTML(ConfigurationContext
configurationContext) {
String temp = "";
Map services =
configurationContext.getAxisConfiguration().getServices();
Hashtable erroneousServices =
configurationContext.getAxisConfiguration().getFaultyServices();
boolean status = false;
if ((services != null) && !services.isEmpty()) {
status = true;
Collection serviceCollection = services.values();
temp += "<h2>" + "Deployed services" + "</h2>";
for (Iterator it = serviceCollection.iterator();
it.hasNext();) {
AxisService axisService = (AxisService) it.next();
Iterator iterator = axisService.getOperations();
temp += "<h3><a href=\"" +
axisService.getName() + "?wsdl\">" +
axisService.getName() + "</a></h3>";
if (iterator.hasNext()) {
temp += "Available operations <ul>";
for (; iterator.hasNext();) {
AxisOperation axisOperation =
(AxisOperation) iterator.next();
temp += "<li>" +
axisOperation.getName().getLocalPart() + "</li>";
}
temp += "</ul>";
} else {
temp += "No operations specified for this
service";
}
}
}
if ((erroneousServices != null) &&
!erroneousServices.isEmpty()) {
temp += "<hr><h2><font color=\"blue\">Faulty
Services</font></h2>";
status = true;
Enumeration faultyservices = erroneousServices.keys();
while (faultyservices.hasMoreElements()) {
String faultyserviceName = (String)
faultyservices.nextElement();
temp += "<h3><font color=\"blue\">" +
faultyserviceName + "</font></h3>";
}
}
if (!status) {
temp = "<h2>There are no services deployed</h2>";
}
temp = "<html><head><title>Axis2:
Services</title></head>" + "<body>" + temp
+ "</body></html>";
return temp;
}
public static String printServiceHTML(String serviceName,
ConfigurationContext
configurationContext) {
String temp = "";
try {
AxisConfiguration axisConfig =
configurationContext.getAxisConfiguration();
AxisService axisService =
axisConfig.getService(serviceName);
Iterator iterator = axisService.getOperations();
temp += "<h3>" + axisService.getName() + "</h3>";
temp += "<a href=\"" + axisService.getName() +
"?wsdl\">wsdl</a> <br/> ";
temp += "<i>Service Description : " +
axisService.getServiceDescription() +
"</i><br/><br/>";
if (iterator.hasNext()) {
temp += "Available operations <ul>";
for (; iterator.hasNext();) {
AxisOperation axisOperation =
(AxisOperation) iterator.next();
temp += "<li>" +
axisOperation.getName().getLocalPart() + "</li>";
}
temp += "</ul>";
} else {
temp += "No operations specified for this
service";
}
temp = "<html><head><title>Axis2:
Services</title></head>" + "<body>" + temp
+ "</body></html>";
}
catch (AxisFault axisFault) {
temp = "<html><head><title>Service has a
fualt</title></head>" + "<body>"
+ "<hr><h2><font color=\"blue\">" +
axisFault.getMessage() +
"</font></h2></body></html>";
}
return temp;
}
}
//since neither class is an interface we would need to
refactor our
public class
org.apache.axis2.transport.http.NewHTTPTransportReceiver
extends org.ksoap2.transport.HttpTransport
{
//all of the legacy HttptransportReceiver code
//add in overrides for attrs and methods from HttpTransport
}
//assuming we setup a simple client which implements
org.ksoap2.transport.HttpTransport
public class org.ksoap2.SoapEnvelope extends java.lang.Object{
public static final int VER10;
public static final int VER11;
public static final int VER12;
public static final java.lang.String ENV2001;
public static final java.lang.String ENC2001;
public static final java.lang.String ENV;
public static final java.lang.String ENC;
public static final java.lang.String XSD;
public static final java.lang.String XSI;
public static final java.lang.String XSD1999;
public static final java.lang.String XSI1999;
public java.lang.Object bodyIn;
public java.lang.Object bodyOut;
public org.kxml2.kdom.Element[] headerIn;
public org.kxml2.kdom.Element[] headerOut;
public java.lang.String encodingStyle;
public int version;
public java.lang.String env;
public java.lang.String enc;
public java.lang.String xsi;
public java.lang.String xsd;
public static boolean stringToBoolean(java.lang.String);
public org.ksoap2.SoapEnvelope(int);
public void parse(org.xmlpull.v1.XmlPullParser)
throws java.io.IOExcep
tion, org.xmlpull.v1.XmlPullParserException;
public void
parseHeader(org.xmlpull.v1.XmlPullParser) throws java.io.I
OException, org.xmlpull.v1.XmlPullParserException;
public void parseBody(org.xmlpull.v1.XmlPullParser)
throws java.io.IOE
xception, org.xmlpull.v1.XmlPullParserException;
public void write(org.xmlpull.v1.XmlSerializer)
throws java.io.IOExcep
tion;
public void
writeHeader(org.xmlpull.v1.XmlSerializer) throws java.io.I
OException;
public void writeBody(org.xmlpull.v1.XmlSerializer)
throws java.io.IOE
xception;
public void setOutputSoapObject(java.lang.Object);
}
vs our own javax.xml.soap.SOAPEnvelope
public interface SOAPEnvelope extends SOAPElement {
/**
* Creates a new <CODE>Name</CODE> object initialized with
the given local name, namespace
* prefix, and namespace URI.
* <p/>
* <P>This factory method creates <CODE>Name</CODE>
objects for use in the SOAP/XML document.
*
* @param localName a <CODE>String</CODE> giving the local
name
* @param prefix a <CODE>String</CODE> giving the
prefix of the namespace
* @param uri a <CODE>String</CODE> giving the URI
of the namespace
* @return a <CODE>Name</CODE> object initialized with the
given local name, namespace prefix,
* and namespace URI
* @throws SOAPException if there is a SOAP error
*/
public abstract Name createName(String localName,
String prefix,
String uri)
throws SOAPException;
public abstract Name createName(String localName) throws
SOAPException;
public abstract SOAPHeader getHeader() throws SOAPException;
public abstract SOAPBody getBody() throws SOAPException;
public abstract SOAPHeader addHeader() throws SOAPException;
public abstract SOAPBody addBody() throws SOAPException;
}
//so you would need a new uber SOAPEnvelope class which
extends base class SoapEnvelope implements SOAPEnvelope
public class NewSOAPEnvelope extends org.ksoap2.SoapEnvelope
implements javax.xml.soap.SOAPEnvelope
newHttpTransportReceiver would reference the new uber
SOAPEnvelope class
public void call(java.lang.String, NewSoapEnvelope)
throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
does this conform to your understanding?
Martin Gainty
______________________________________________
Note de déni et de confidentialité
Ce message est confidentiel et peut être privilégié. Si vous
n'êtes pas le destinataire prévu, nous te demandons avec bonté
que pour satisfaire informez l'expéditeur. N'importe quelle
diffusion non autorisée ou la copie de ceci est interdite. Ce
message sert à l'information seulement et n'aura pas n'importe
quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne
pouvons accepter aucune responsabilité pour le contenu fourni.
> Date: Fri, 15 Apr 2011 11:02:37 -0400
> From: [email protected] <mailto:[email protected]>
> To: [email protected] <mailto:[email protected]>
> Subject: Woden on mobile devices
>
> Hi all,
>
> I think Woden can parse WSDL 2.0 that describe REST services
correct?
> Is there a mobile version of Woden for parsing such WSDL
documents on
> Android?
>
> Thanks
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
<mailto:[email protected]>
> For additional commands, e-mail: [email protected]
<mailto:[email protected]>
>