• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to call web service with parameter  RSS feed

 
sam liya
Ranch Hand
Posts: 1269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
below is method for get data from web service without any parameters.



this is working fine.it returns the xml file.My problem is how to call a web service with parameters?I have already built a web service with paramters.I need to call that web service .
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have built that WS then you should know how it needs the parameters to be passed along, no?
 
sam liya
Ranch Hand
Posts: 1269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually i built using WSO2 dss server.It automatically creates the web service.So i need to call that web service.
below is the i used example

http://docs.wso2.org/display/DSS310/Sample+Queries#SampleQueries-Sample1Usinginputmappingsinaquery
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From a quick look it's not clear to me what kind of WS that would create, or, actually, that it creates any kind of WS. But since you know that it does, wherever you read that would be a good place to resume reading.
 
sam liya
Ranch Hand
Posts: 1269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
below is the complete example.
http://docs.wso2.org/display/DSS301/RDBMS

below is my wsdl file



i have created web service fine,but i need to how to call paramerterize web service ?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A SOAP WS? That's very unusual for a mobile app to call. I strongly advise to use a REST WS instead. Why SOAP?

There used to be a library called ksoap2 that had an android port available; you can use that for SOAP communication if you really want to.
 
sam liya
Ranch Hand
Posts: 1269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1Anyway what is the disadvantage of using SOAP in mobile?

2)I actually use "http://192.168.1.4:9763/services/DataServiceSamples1.HTTPEndpoint/" url.its an HTTP endpoint.does that SOAP one ?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SOAP is more complex to use, especially if you don't have good tooling (which I would guess ksoap2 hasn't). You can read the WebServicesFaq for more about SOAP vs. REST.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyway what is the disadvantage of using SOAP in mobile?


SOAP response messages are:
a. bulky - frequently more XML formatting than content
b. CPU hogs due to having to be parsed
c. memory hogs - also due to having to parse the XML
d. very clumsy for return of any data except text - for example images or audio

SOAP request messages are a pain to create due to all of the above.

REST request messages are:
a. compact
b. make sense when you look at them

REST response messages are;
a. already what you are used to dealing with in HTML
b. can be any resource such as binary

Bill

 
sam liya
Ranch Hand
Posts: 1269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks all.anyway can anyone say below url provide me a rest or soap webservie

 
sam liya
Ranch Hand
Posts: 1269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1)can anyone please tell me that below url provide me REST or SOAP endpoint?



2)If this is a web service without paramerter we can call as below



my problem is if this web service need a paramerter(username) how to call that web service ?
 
sam liya
Ranch Hand
Posts: 1269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried to call this web service as below



Anyway it doesn't work fine.I debug the app and find that it goes to else part.Why it doesn't work?
anyway if i used same code without parameter(?Name=Aruna)it works fine.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you have a StatusLine object, why aren't you examining its status code and the reason phrase if there is an error? That's where you find the information on what's going wrong.

I don't see "LoginOperation" anywhere in what you've posted so far, so there's no basis for speculation on what it might or might not do, or supposed to be doing.
 
sam liya
Ranch Hand
Posts: 1269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a new service.statuscode is 500.

below is my new wsdl file.

 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
500 means server error, so there should be something in the server logs.

And like I said before:
Since you have a StatusLine object, why aren't you examining ... the reason phrase if there is an error?
 
sam liya
Ranch Hand
Posts: 1269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
below is the error in server logs



i can't understand why it gives nulpointer exception.
 
sam liya
Ranch Hand
Posts: 1269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I change the query i used in web serviceBelow is the query.



below is the exception now i am getting in the server.

 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so now you know that that is not the right way to invoke this service. Axis2 has a lot of online documentation; if this was my problem, that's where I would start reading (and also look through the Axis2 examples to see if they include something similar to what you intend to do).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!