I have a simple web service operation like so:
@WebService(endpointInterface = "soap.service.sei.HelloWorldSei")
public class Sib {
public String sayHello() {
return "Hello World!";
}
}
I’m using the ksoap2 library for android.
In my android activity, I have:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive resultsRequestSOAP = (SoapPrimitive) envelope.getResponse();
lblResult.setText(resultsRequestSOAP.toString());
} catch (Exception e) {
System.out.println("******* THERE WAS AN ERROR ACCESSING THE WEB SERVICE");
e.printStackTrace();
}
}
My question is – Since the ‘sayHello’ operation takes no parameters, do I need to include any ‘PropertyInfo’ instances?
Yes, it seems that you can. Here’s a working android soap client:
As you can see, no PropertyInfo objects required 😉 On the service side, I’m using Jax-ws. Hope this helps somebody else out. Oh, and it’s also worth mentioning, that if you are using Jax-ws to build a soap service, I find that I get the dreaded “cannot find dispatch method” exception in android if I don’t use the following elements in the @WebService annotation for my service endpoint interface and service implementation bean: Here is the service endpoint interface
Here is my service implementation bean
As you can see, this service reads an image as a series of bytes and sends it to the android device as a byte array.