• Post Reply Bookmark Topic Watch Topic
  • New Topic

Send Parameters to web service SOAP  RSS feed

 
Harshit Shrivastava
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have made a java application which calls the C# web service. Here is the code.



Result


Expected Result



c# webservice code



WebService1.wsdl



My Client XML



Returned XML



I am clearly passing the values of a & b variable to the web service, but still I am getting the result 0. I also tried creating another function in web service to just return the string sent from this program,, the function is getting called & printed the text which is already returned but it didn't printed the string which I have sent from my java program.

What is wrong with the code ?

 
Tim Moores
Saloon Keeper
Posts: 3512
77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are the parameters correct in the XML? Check by printing out the generated SOAP on the client?

Do they arrive correctly at the server? Check by printing their values in the WS method.
 
g tsuji
Ranch Hand
Posts: 697
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A rough inspection of the definition and the code, you should correct some misreadings.

[1] The element local name is Addweb in the payload, not "Addition" as you wrote.

[2] Then you need to qualify the Addweb and paramters a and b names.

There may have some other little things to take care of, but the main things are the above in order to properly setup the request.
 
Harshit Shrivastava
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the solution. The problem was with dot net side. I need to add



to the called method i.e.

 
g tsuji
Ranch Hand
Posts: 697
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I got the solution. The problem was with dot net side. I need to add
System.Web.Services.Protocols.SoapRpcMethodAttribute("", RequestNamespace="", ResponseNamespace="")]
to the called method...

That is not what I would qualify as solution, more like a distraction; and it gives a wrong impression as if something to do with the service provider written in c#, hence, an interoperability related issue. It is not, not here. If you don't get it, I would explain why.

Normally, a service provider provide a service and a service consummer comply to its definition exposed. It is not something that a consummer writes a client code and tell the provider that it does not work and you have to chance your server code. If the provider changes the server code, hence a different wsdl is thereby resulted, it is not the same service. You had posted a wsdl and the consumer should be able write a proper client code to consume the service.

In your "solution", I bet, and I am sure, the wsdl is no longer the same as you posted before. And that means a "different" web service. It just so happens that you are the service provider yourself (getting some code from a tutorial etc...). therefore you do whatever you like, but that is not a solution in that sense. And in case that you don't get what's wrong with the client code for a service so provided, you miss even the main point of the whole exercise and that is worse.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!