View Single Post
Old 06-19-2009, 10:42 AM   #42 (permalink)
koic
Thumbs Must Hurt
 
Join Date: Feb 2009
Location: CANADA
Model: 9000
PIN: N/A
Carrier: Rogers
Posts: 64
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK,
this thing works now.
Example is extremly simple 'though.
Service (ServiceHello.asmx.cs):
PHP Code:
xxx91;WebMethodxxx93;
public 
string HelloWorld()
{
       return 
"HelloWorld!";

Method to use it BlackBerry:
PHP Code:
String serviceNamespace "http://tempuri.org/";
String serviceAsmx "ServiceHello.asmx";
String serviceURL serviceNamespace serviceAsmx;
String serviceMethod "HelloWorld";
String soapAction serviceNamespace serviceMethod;
                            
HttpTransport ht = new HttpTransport(serviceURL);
ht.debug true;
                                
SoapObject request = new SoapObject(serviceNamespaceserviceMethod);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut request;
                        
ht.call(soapActionenvelope);
                                
String getRsp envelope.getResponse().toString(); 
Important things were (IMHO):
1. Use asmx file instead of wsdl in HttpTransport call.
Maybe because that was MS Web service (?)
2. To set soapAction.
3. Direct use of toString() instead of
PHP Code:
SoapObject result = (SoapObject)envelope.getResponse();
String getResp result.toString(); 
which caused (for me) that ClassCastException.

Last edited by koic : 06-19-2009 at 10:45 AM.
Offline   Reply With Quote