Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
DAquilina
Posts: 587
Registered: ‎01-19-2010
My Device: BOLD 9700 OS5.0.0.x on Rogers Canada
My Carrier: Rogers
Accepted Solution

Using SOAP to call ASP.NET method in J2MEq

Hi guys,

 

I currently find myself in need ot a J2ME method/class/something-or-other that mimics the functionality of SoapRequestBuilder in J2SE, used to call a method from a web service. The standard code is as follows:

 

    SoapRequestBuilder s = new SoapRequestBuilder();
s.Server = "127.0.0.1";
s.MethodName = "GetBoxId";
s.XmlNamespace = "http://www.mySite.com";
s.WebServicePath = "/Interfaces/package.asmx";
s.SoapAction = s.XmlNamespace+s.MethodName;
s.AddParameter ("userId", 0);
s.AddParameter ("boxId", ID);

Does anyone know the proper method for doing this on the BlackBerry platform? I'm working with 4.7 and later.

 

Thanks,

~Dom

 

----------------------------------------------------------------------------
chown -R us ./base
~J!NX
Developer
DAquilina
Posts: 587
Registered: ‎01-19-2010
My Device: BOLD 9700 OS5.0.0.x on Rogers Canada
My Carrier: Rogers

Re: Using SOAP to call ASP.NET method in J2ME

Any thoughts? This is rather important to initializing my application, and I've found no related documentation. I've searched the knowledge base, exhausted my Google-fu...

 

Thanks for your consideration,

~Dom

----------------------------------------------------------------------------
chown -R us ./base
~J!NX
Developer
rihan007
Posts: 455
Registered: ‎01-14-2009
My Device: Apple iPhone 3GS 16GB

Re: Using SOAP to call ASP.NET method in J2ME

hi .you can either use KSOAP or just create the entire SOAP request as a String and then write it to the output stream.

 

KSOAP code is given below . it might help you

 

 

SoapObject request = new SoapObject("http://www.webserviceX.NET", "GetWeather");       
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    request.addProperty("CityName","London");
    request.addProperty("CountryName",""); 
    System.out.println(request.toString()); 
    envelope.setOutputSoapObject(request); 
    envelope.dotNet = true; 
    ht.call(SOAPAction,envelope);   
    SoapObject result = (SoapObject)envelope.bodyIn;  
    System.out.println(result.toString());
    System.out.println("Name: "+result.getName()+"\nNameSpace: "+result.getNamespace()+"\n Property Count: "
    +result.getPropertyCount()); 
    
    System.out.println(result.toString()); 

 

 

Developer
DAquilina
Posts: 587
Registered: ‎01-19-2010
My Device: BOLD 9700 OS5.0.0.x on Rogers Canada
My Carrier: Rogers

Re: Using SOAP to call ASP.NET method in J2ME

I actually found the same program on my own, and I'm working with a similar example. I'm still a bit apprehensive about including an external library in a commercial application, but I'm hoping including a reference in the source is sufficient. Thanks for the help!

 

~Dom

----------------------------------------------------------------------------
chown -R us ./base
~J!NX