• Post Reply Bookmark Topic Watch Topic
  • New Topic

Web Service call returns : Cannot parse '1' as a boolean (must be "true" or "false")  RSS feed

 
Des cham
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

My web service client is generated from a WSDL. The WSDL has a field of type boolean. While invoking the webservices (WS), the WS returns SOAP error saying that it cannot parse 1 to boolean type of true or false. I checked to ensure and confirmed that the field in the java generated object from the WSDL is of type Boolean. After some debugging, I found that the boolean value is translated to 1 or 0 by jax-rpc in the SOAP message.

Have anyone encountered this problem before and what's the workaround or solution for this? I appreciated the response!

Error message is as below.

; nested exception is:
javax.xml.rpc.soap.SOAPFaultException: VEN-FORMATTER-1011: Cannot parse '1' as a boolean (must be "true" or "false")
VEN-FORMATTER-1011: Cannot parse '1' as a boolean (must be "true" or "false")
VEN-FORMATTER-1011: Cannot parse '1' as a boolean (must be "true" or "false")
; nested exception is: VEN-FORMATTER-1011: Cannot parse '1' as a boolean (must be "true" or "false")
VEN-FORMATTER-1011: Cannot parse '1' as a boolean (must be "true" or "false")
VEN-FORMATTER-1011: Cannot parse '1' as a boolean (must be "true" or "false")

WSDL snippet:

<xsd:element minOccurs="0" name="Comp1Question" type="xsd:boolean" />

 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
If you cannot modify the code that generates the (faulty) SOAP message, have you considered using a handler to modify SOAP messages immediately before they are sent out?
Best wishes!
 
Des cham
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ivan,

Thanks for the reply. The java objects are generated from a WSDL. Do I have to change the code eveytime there is a new updated WSDL?
Do you happen to have a sample on how that can be done?

Thanks,
Des


 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Des cham wrote:Do I have to change the code every time there is a new updated WSDL?

No, not if you use a handler.

Do you happen to have a sample on how that can be done?

No, but the handler should be programmed to retrieve the value of the field(s) that contain boolean values.
If such a value is 1, it should be replaced by true and if it is 0 it should be replaced by false.
If it is already true or false, then no need to take action.

I suspect you are using JAX-RPC, so perhaps this article is of interest to you: http://www.ibm.com/developerworks/webservices/library/ws-tipjax2.html
Best wishes!
 
Des cham
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. I appreciated!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!