File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to send a SOAP request properly designed using SAAJ

 
Kumar Raja
Ranch Hand
Posts: 547
2
Hibernate Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I'm trying to experiment by sending a SAAJ built SOAP request to my webservice. My service is designed as below



and my service is running at http://localhost:8080/Calculator/CalculatorService

My SAAJ client is as follows


as you can see, I'm printing out the both the request and response and those are as below


I tested my service using SOAP UI and I get the result 9 as expected, but with the above code I get the response as "0"

Also, from the debug statement in service, I see the incoming values as 0 and 0 which explains why my result was 0.

But why are the values which I set as 5 and 4 are converted to 0 when it was received by service. Is there any mistake I'm making here in making my SOAP request.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Can you post the request generated by soapUI and the request from your client in one and the same post?
If you have time, do compare the two requests for differences.
A common problem when a web service fails to extract parameter values from a request is that element(s) are not in the correct namespace(s).
JAXB fails silently when encountering this kind of problems - in fact, it does not "see" the data since it is not in the expected namespace.
Best wishes!
 
Kumar Raja
Ranch Hand
Posts: 547
2
Hibernate Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ivan,

You are right. I used wrong element names param1 and param2 in SAAJ client, instead of arg0 and arg1. My bad
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic