0

I am new to blackberry app development and was wondering if someone could point me in the right direction(and may be a sample application) of how to consume web service in native apps. I'm using Blackberry JDE plugin for Eclipse.

I am able to consume a restful webservice, but now I want to consume a SOAP service. I am new to eclipse , so I would require in detail information.

Thanks,

Anand
  • 14,545
  • 8
  • 32
  • 44

2 Answers2

1

I followed this none-ksoap2 route and it worked well for me:

http://www.johnwargo.com/index.php/blackberry/dbja2.html

This series of articles explains how to utilise the support the BlackBerry Platform has built in for JSR 172, the J2ME Web Services Specification, by creating a java stub class through the use of a utility in the Sun Java Wireless Toolkit for CLDC and the wsdl for your web service.

The articles give a very thorough and detailed explanation of the steps required to achieve the objective, so I would not wish to repeat them here in full, nor paraphrase them at the risk of my debased shorter version being quoted later. I understand the risk of answering in this way, and I realise that my short explanation above will in no way compensate should the original articles disappear from the internet.

paulkayuk
  • 1,052
  • 1
  • 8
  • 15
  • I tried it. Downloaded Sun Java Wireless kit, used stub generator, specified wsdl url and out put location. When it finishes I go to Output location, no stubs generated.... – Anand Mar 21 '12 at 15:30
  • I have currently hosted it on visual studio server. Could be a reason ? – Anand Mar 21 '12 at 15:33
  • Do you have some very simple wsdl you could test the procedure with first? – paulkayuk Mar 21 '12 at 15:47
  • I'm wrong about the URL, (previous comment deleted), did you take a look at Part 2 of the article where he goes through some of the problems you may encounter, that may help. http://www.johnwargo.com/index.php/blackberry/dbja2.html – paulkayuk Mar 21 '12 at 16:39
  • Sorry, I meant Part 2.5: http://www.johnwargo.com/index.php/Miscellaneous/bbdja25.html – paulkayuk Mar 21 '12 at 16:46
  • While this may theoretically answer the question, [it would be preferable](http://meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Bill the Lizard Mar 23 '12 at 11:47
  • @BtL thank you for the guidance, I will bear that in mind for future answers – paulkayuk Mar 23 '12 at 13:05
0

Hey thanks for all the help. Figured it out. The problem was wcf service. When I tried with a simple web service(.asmx), it worked like charm and all the stubs were generated correctly. Probably wcf uses Soap 1.2 default and asmx service SOAP 1.1.

I even tried using KSOAP2 for calling wcf service with little success. Again switching back to asmx instead of wcf, solved the issue.

Now I have problem of plenty, which method to use(KSOAP or Stub) :)

I am all for non KSOAP method, but the only thing that is stopping me is I have to generated stub files everytime a introduce a new method. Anyways +1 for all the help

Anand
  • 14,545
  • 8
  • 32
  • 44
  • I would look at the direction your development is likely to go. The Stub method will be good for BlackBerry and other j2me devices - Nokias and Samsung java devices for example. Which I ported my BlackBerry stub code to quite simply. However if you are likely to develop for Android devices, you won't be able to use this stub method, but you will be able to use (or port) your ksoap2 code. the Re-generation every time you add a new method is a pain, but the process is quick and the generated code just plugs back into your application. – paulkayuk Mar 22 '12 at 08:55