Advertisement

05.14.2008 at 02:38PM PDT, ID: 23403268 | Points: 500
[x]
Attachment Details

Returning boolean with JAX-RPC Web Service

Tags: Java
Hello -

I'm fairly new to web services, so this seems like an easy question, but I can't find the answer. I've converted an existing web service from Axis to JAX-RPC using IBM's WDSC development environment. It's a simple service, it has one method that accepts a String and returns a boolean. When I intercept the SOAP envelope, the boolean return value gets converted to a 0/1. I realize those are technically valid values but the agency that communicates with our service already has a client expecing a true/false value and we don't want any code changes from their side. When I had the service in Axis, it returned a true/false.

So, my question is - is there a way I can force it to translate the Java boolean to true/false, rather than 0/1? I've look at the JAX RPC mapping file and think it might be in there somewhere, but I can't figure it out.

You might need more details to fully understand the question, but here's the snippet for that mapping file:

    <java-xml-type-mapping>
        <java-type>boolean</java-type>
        <root-type-qname xmlns:rtq="http://www.w3.org/2001/XMLSchema">rtq:boolean</root-type-qname>
        <qname-scope>simpleType</qname-scope>
    </java-xml-type-mapping>
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: BergJC
Question Asked On: 05.14.2008
Participating Experts: 1
Points: 500
Views: 0
Translate:
Loading Advertisement...
05.14.2008 at 04:31PM PDT, ID: 21569547

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.14.2008 at 08:11PM PDT, ID: 21570430

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.14.2008 at 08:12PM PDT, ID: 21570438

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 04:19AM PDT, ID: 21572324

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 06:40AM PDT, ID: 21573486

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 07:03AM PDT, ID: 21573717

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 07:55AM PDT, ID: 21574301

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 08:06AM PDT, ID: 21574441

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 10:13AM PDT, ID: 21575967

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 06:17PM PDT, ID: 21579149

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 06:57PM PDT, ID: 21579321

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 07:01PM PDT, ID: 21579337

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 08:47AM PDT, ID: 21607322

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 09:10AM PDT, ID: 21607611

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 01:09PM PDT, ID: 21609885

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 01:26PM PDT, ID: 21610032

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 02:16PM PDT, ID: 21610444

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 04:09PM PDT, ID: 21611053

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • Automotive
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Displays / Monitors
  • Handhelds / PDAs
  • Components
  • Peripherals
  • Laptops/Notebooks
  • Servers
  • Misc
  • Apple
  • Embedded Hardware
  • Networking Hardware
  • Storage
  • Desktops
  • New Users
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMware
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Virtualization
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • Web Computing
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Consulting
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMware
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Automation
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Web Services
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Web Computing
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Lounge
  • Business Travel
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
  • Automotive
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.14.2008 at 04:31PM PDT, ID: 21569547

Rank: Master

>> I can force it to translate the Java boolean to true/false,

By Default Java Boolean is true or false how can it accept 0/1 ? can you please show the server side method because even the mapping shows the java type as boolean.
 
05.14.2008 at 08:11PM PDT, ID: 21570430
The web service method doesn't accept 0/1. It accepts true/false. And as you can see, the RPC mapping says it is a boolean. But somewhere in the translation from the java boolean to the SOAP envelope, it gets converted to a 0/1. These values are technically correct because an xsd:boolean can in fact be true/false or 0/1. Both are valid. But this JAX-RPC service is somehow changing it to a 0/1.

The web service implementation looks as simple as this:

public boolean updateAttorney(String input) {
   boolean returnValue;
  ...some code...
  return returnValue;
}

If you want more information, please just let me know. I'm really stuck on this one.
 
05.14.2008 at 08:12PM PDT, ID: 21570438
Also, I am at home but tomorrow, if it helps, I can post the SOAP envelope to show you what I am talking about.
 
05.15.2008 at 04:19AM PDT, ID: 21572324

Rank: Master

Try changing it to
public Boolean updateAttorney(String input) {
   boolean returnValue;
  ...some code...
  return newBoolean( returnValue);
}

That may fix it because they seem to go to different seralizers check this

http://www.ibm.com/developerworks/webservices/library/ws-soapmap1/
 
05.15.2008 at 06:40AM PDT, ID: 21573486
Thanks, shivaspk. I did try that too, wondering if it was translated differently, but they both translate to a 0/1 value.

Here's my test case.

Implementation class:

public class TestImpl {
         public Boolean testMethod(String xml) {
                  return true (or false);
         }
         public boolean testMethod2(String xml) {
                  return true (or false);
         }
}

RPC Mapping:
         <wsdl-return-value-mapping>
                <method-return-value>boolean</method-return-value>
                <wsdl-message xmlns:wrvm="http://webservice">wrvm:testMethod2Response</wsdl-message>
                <wsdl-message-part-name>testMethod2Return</wsdl-message-part-name>
            </wsdl-return-value-mapping>
            <wsdl-return-value-mapping>
                <method-return-value>java.lang.Boolean</method-return-value>
                <wsdl-message xmlns:wrvm="http://webservice">wrvm:testMethodResponse</wsdl-message>
                <wsdl-message-part-name>testMethodReturn</wsdl-message-part-name>
            </wsdl-return-value-mapping>

SOAP Envelope:
<soapenv:Body>
     <p477:testMethodResponse xmlns:p477="http://webservice">
        <testMethodReturn>0</testMethodReturn>
     </p477:testMethodResponse>
</soapenv:Body>

<soapenv:Body>
    <p477:testMethod2Response xmlns:p477="http://webservice">
       <testMethod2Return>0</testMethod2Return>
    </p477:testMethod2Response>
</soapenv:Body>
 
05.15.2008 at 07:03AM PDT, ID: 21573717

Rank: Master

BergJC: where exactly did u capture the SOAP response??

<soapenv:Body>
    <p477:testMethod2Response xmlns:p477="http://webservice">
       <testMethod2Return>0</testMethod2Return>
    </p477:testMethod2Response>
</soapenv:Body>

Are you sure conversion is not happening at the client side right??
 
05.15.2008 at 07:55AM PDT, ID: 21574301
I'm using the Web Services Explorer within WDSC to capture the SOAP response (it's really quite easy, see screen shot), so I'm not even using a client (well, it's a client, but I'm not using a self-coded client). Again, I'm not an expert at web services, but if the SOAP response has that value in it, I guess I assume it can't be the client.
 
Web Services Explorer
Web Services Explorer
 
 
05.15.2008 at 08:06AM PDT, ID: 21574441

Rank: Master

This is my favorite tool too ;) and its based on axis only so this is what your clients will see also, let me see if there is way to force JaxRpc to send "true" instead of "1".
 
05.15.2008 at 10:13AM PDT, ID: 21575967
Thanks! I think this question is worth more than 500 points to me. If I can change it, I will. I'm just totally stumped.
 
05.15.2008 at 06:17PM PDT, ID: 21579149
FYI - I am out of the office Friday and Monday, so if I don't respond in the next few days, that is why. I will absolutely get back to you on Tuesday. Thanks for helping me with this!
 
05.15.2008 at 06:57PM PDT, ID: 21579321

Rank: Master

Hey one sec which WSDC are you using ??  can you show the server side test class you are using ? Because even that uses axis for creating the web service, please check if it is axis if axis just see if you can eliminate the mapping file completely else you may have to do manual override the return types from code.
 
05.15.2008 at 07:01PM PDT, ID: 21579337

Rank: Master

Please see if this is the same way you are generating the service then you are using axis 1.0

ftp://ftp.software.ibm.com/as400/products/ad/wdt400/v512/presentations/WebServicesprintversion.pdf
 
05.20.2008 at 08:47AM PDT, ID: 21607322
I'm using Websphere Development Studio Client Advanced Edition for iSeries v7.0. I'm not completely sure I know what you're asking me with the 21579321 post, but I checked out your link and while it is close, that wizard has changed quite a bit since that PDF was created. I attached a snapshot of what it looks like. I'm generating JAX-RPC, not Axis (although from what I'm getting, it still uses Axis behind the scenes?).

If I have to override the return types, how would I go about doing that? I'm pretty unsure about anything beyond the wizards (which is unfortunate, but if I touch something...it breaks!).

Thanks very much for all of the help with this!
 
WDSC Snapshot
WDSC Snapshot
 
 
05.20.2008 at 09:10AM PDT, ID: 21607611

Rank: Master

Can you click the web service runtime link in the above wizard and provide the screen shot of what it displays because if  it is AXIS 1.x then we can try forcing a type on it I believe, lets try it.
 
05.20.2008 at 01:09PM PDT, ID: 21609885
Here's the screen shot. My service uses the IBM WebSphere JAX-RPC runtime (which you know). The screen shot doesn't show the Axis version but I dug through the help file and it said the following:

"The level of Axis currently supported is 1.0. For more information on Axis, refer to http://xml.apache.org/axis. The User's Guide available on this site provides more in-depth information about using Web services with Apache Axis. The Reading Guide lists several documents to further your understanding of Axis."

So it seems you are correct...
 
Web service runtimes
Web service runtimes
 
 
05.20.2008 at 01:26PM PDT, ID: 21610032

Rank: Master

before going any further can you try one last silly thing

try returning a Boolean.FALSE  or Boolean.TRUE and check the behavior once else we can go with the other approach of trying to override the return type.
 
05.20.2008 at 02:16PM PDT, ID: 21610444
No suggestion is silly to me at this point. I tried it and it returned the same results. By the way, I've got this recreated in a very simple web service, so if you need me to attach it so you can actually see it for yourself, just let me know. Thanks again!
 
05.20.2008 at 04:09PM PDT, ID: 21611053

Rank: Master

Please do that :)

mail me at shivaspk.siva@gmail.com I will try my best to resolve it :)
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628