aspose file tools*
The moose likes Web Services and the fly likes representing null values in SOAP web services Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "representing null values in SOAP web services" Watch "representing null values in SOAP web services" New topic
Author

representing null values in SOAP web services

manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
Hi All,

I am currently in the process of creating a web service client. For all optional data elements if we don't have values available we don't pass that element in the SOAP request payload and things work fine but for some specific use cases which we cannot control these elements are being passed something like this



which causes the web service to fail. In general what is the correct way to handle this. should we not be passing the elements in the absence of values or should we pass empty elements
().
In the latter two I believe the value the Web service receives is blank ("") hence causes it to fail.

Should the web service be handling blank strings or not passing the element at all is the right way to represent null values.

Let me know your thoughts


Thanks,
Jim Akmer
Ranch Hand

Joined: Jul 06, 2010
Posts: 104
Why is the type of the element encapsulated in the tag send to client?
Are you using RPC encoding?
manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
yes Jim. The web services we are trying to communicate with were created years back and they were generated using RPC based java web service standards.
These web services were created using the bottom-up approach.

My question is more generic is should i not pass the soap request elements at all if there are no values or should I resort to empty elements. What is the right way to deal with missing values in the SOAP based webservices world.


Thanks
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1164
How do you set a null value via (SOAP) Web Services? might help.

Regards,
Dan


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Another link to an article: http://www.ibm.com/developerworks/xml/library/ws-tip-null.html
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: representing null values in SOAP web services
 
Similar Threads
How to retrieve reqd. tag values
Question about passing parameters from a custom tag to a JSP
java.io.IOException: Type {http://lang.java}Exception is referenced but not defined.
Axis client for jboss ejb3 session bean web service
IWAB0398E Error in generating WSDL from Java