axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pralhad Vernekar (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Commented: (AXIS-2737) Incorrect Validation for optional sequences and choices (in case nillable="false")
Date Mon, 12 Jan 2009 06:28:59 GMT

    [ https://issues.apache.org/jira/browse/AXIS-2737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662892#action_12662892
] 

Pralhad Vernekar commented on AXIS-2737:
----------------------------------------

We faced similar problem recently. To overcome we fixed wsdl2java. AXIS does not create sequences
or choices as some other tools do (e.g. castor). Therefore I do not think I can check in this
code however I can share this code, if someone is still looking for it.

> Incorrect Validation for optional sequences and choices (in case nillable="false")
> ----------------------------------------------------------------------------------
>
>                 Key: AXIS-2737
>                 URL: https://issues.apache.org/jira/browse/AXIS-2737
>             Project: Axis
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: Win32, JDK 1.5
>            Reporter: Ronny Karallus
>            Priority: Blocker
>         Attachments: wsdl.zip
>
>
> The validation inside Axis, checking the conformance of an object before rendering it
to XML, does not work correctly for the following WSDL message parameter constructs:
> 1) A Choice, containing a sequence as one option, for example
> 		<xs:complexType>
> 			<xs:sequence>
> 				<xs:choice>
> 					<xs:sequence>
> 						<xs:element name="country" type="xs:string" default="+49"/>
> 						<xs:element name="short" type="xs:string"/>
> 					</xs:sequence>
> 					<xs:element name="long" type="xs:string"/>
> 				</xs:choice>
> 				<xs:element name="number" type="xs:string"/>
> 			</xs:sequence>
> 		</xs:complexType>
> 2) A sequence, containing an optional sequence, for example:
> 	  <xs:complexType>
> 	    <xs:sequence>
> 	      <xs:sequence>
> 	        <xs:sequence minOccurs="0">
> 	          <xs:element name="country" type="xs:string" default="+49"/>
> 	          <xs:element name="short" type="xs:string"/>
> 	        </xs:sequence>
> 	        <xs:element name="long" type="xs:string" minOccurs="0"/>
> 	      </xs:sequence>
> 	      <xs:element name="number" type="xs:string"/>
> 	    </xs:sequence>
> 	  </xs:complexType>
> To show the problem the Java Stubs are generated using WSDL2Java and the invoke method
is called using the following code:
> 		LesenSoapBindingStub service = (LesenSoapBindingStub) (new LesenServiceLocator()).getLesen(new
java.net.URL("http://localhost:8080/service/Lesen"));
> 		
> 		LesenRequest lesen = new LesenRequest();
> 		lesen.set_long("0000");
> 		lesen.setNumber("0000");
> 		
> 		service.invoke(lesen);
> Obviously this should be possible by the WSDL, because it is the second option of the
choice. Be aware that the code works, if you use the other option, setting country/short and
setting long null. If you use it this way, the following exception is thrown:
> 14.04.2008 16:39:17 org.apache.axis.encoding.ser.BeanSerializer serialize
> SCHWERWIEGEND: Exception:
> java.io.IOException: Non nillable element 'country' is null.
> 	at org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.java:215)
> 	at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1504)
> 	at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:980)
> 	at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:801)
> 	at org.apache.axis.message.RPCParam.serialize(RPCParam.java:208)
> 	at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:433)
> 	at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> 	at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:139)
> 	at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:478)
> 	at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> 	at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
> 	at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
> 	at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
> 	at org.apache.axis.attachments.AttachmentsImpl.getAttachmentCount(AttachmentsImpl.java:554)
> 	at org.apache.axis.Message.getContentType(Message.java:486)
> 	at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:343)
> 	at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
> 	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
> 	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> 	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> 	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
> 	at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
> 	at org.apache.axis.client.Call.invoke(Call.java:2767)
> 	at org.apache.axis.client.Call.invoke(Call.java:2443)
> 	at org.apache.axis.client.Call.invoke(Call.java:2366)
> 	at org.apache.axis.client.Call.invoke(Call.java:1812)
> 	at de.webservice.LesenSoapBindingStub.invoke(LesenSoapBindingStub.java:177)
> 	at Test.main(Test.java:30)
> 14.04.2008 16:39:17 org.apache.axis.attachments.AttachmentsImpl getAttachmentCount
> WARNUNG: Exception:
> AxisFault
>  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
>  faultSubcode: 
>  faultString: java.io.IOException: java.io.IOException: Non nillable element 'country'
is null.
>  faultActor: 
>  faultNode: 
>  faultDetail: 
> 	{http://xml.apache.org/axis/}stackTrace:java.io.IOException: java.io.IOException: Non
nillable element 'country' is null.
> 	at org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.java:275)
> 	at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1504)
> 	at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:980)
> 	at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:801)
> 	at org.apache.axis.message.RPCParam.serialize(RPCParam.java:208)
> 	at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:433)
> 	at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> 	at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:139)
> 	at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:478)
> 	at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> 	at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
> 	at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
> 	at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
> 	at org.apache.axis.attachments.AttachmentsImpl.getAttachmentCount(AttachmentsImpl.java:554)
> 	at org.apache.axis.Message.getContentType(Message.java:486)
> 	at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:343)
> 	at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
> 	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
> 	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> 	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> 	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
> 	at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
> 	at org.apache.axis.client.Call.invoke(Call.java:2767)
> 	at org.apache.axis.client.Call.invoke(Call.java:2443)
> 	at org.apache.axis.client.Call.invoke(Call.java:2366)
> 	at org.apache.axis.client.Call.invoke(Call.java:1812)
> 	at de.webservice.LesenSoapBindingStub.invoke(LesenSoapBindingStub.java:177)
> 	at Test.main(Test.java:30)
> 	{http://xml.apache.org/axis/}hostname:WUM03029
> java.io.IOException: java.io.IOException: Non nillable element 'country' is null.
> 	at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
> 	at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:317)
> 	at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
> 	at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
> 	at org.apache.axis.attachments.AttachmentsImpl.getAttachmentCount(AttachmentsImpl.java:554)
> 	at org.apache.axis.Message.getContentType(Message.java:486)
> 	at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:343)
> 	at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
> 	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
> 	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> 	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> 	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
> 	at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
> 	at org.apache.axis.client.Call.invoke(Call.java:2767)
> 	at org.apache.axis.client.Call.invoke(Call.java:2443)
> 	at org.apache.axis.client.Call.invoke(Call.java:2366)
> 	at org.apache.axis.client.Call.invoke(Call.java:1812)
> 	at de.webservice.LesenSoapBindingStub.invoke(LesenSoapBindingStub.java:177)
> 	at Test.main(Test.java:30)
> Caused by: java.io.IOException: java.io.IOException: Non nillable element 'country' is
null.
> 	at org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.java:275)
> 	at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1504)
> 	at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:980)
> 	at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:801)
> 	at org.apache.axis.message.RPCParam.serialize(RPCParam.java:208)
> 	at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:433)
> 	at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> 	at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:139)
> 	at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:478)
> 	at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> 	at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
> 	... 17 more
> 14.04.2008 16:39:17 org.apache.axis.encoding.ser.BeanSerializer serialize
> SCHWERWIEGEND: Exception:
> java.io.IOException: Non nillable element 'country' is null.
> 	at org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.java:215)
> 	at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1504)
> 	at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:980)
> 	at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:801)
> 	at org.apache.axis.message.RPCParam.serialize(RPCParam.java:208)
> 	at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:433)
> 	at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> 	at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:139)
> 	at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:478)
> 	at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> 	at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
> 	at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
> 	at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
> 	at org.apache.axis.SOAPPart.getContentLength(SOAPPart.java:229)
> 	at org.apache.axis.Message.getContentLength(Message.java:510)
> 	at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:371)
> 	at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
> 	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
> 	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> 	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> 	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
> 	at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
> 	at org.apache.axis.client.Call.invoke(Call.java:2767)
> 	at org.apache.axis.client.Call.invoke(Call.java:2443)
> 	at org.apache.axis.client.Call.invoke(Call.java:2366)
> 	at org.apache.axis.client.Call.invoke(Call.java:1812)
> 	at de.webservice.LesenSoapBindingStub.invoke(LesenSoapBindingStub.java:177)
> 	at Test.main(Test.java:30)
> Exception in thread "main" AxisFault
>  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
>  faultSubcode: 
>  faultString: java.io.IOException: java.io.IOException: Non nillable element 'country'
is null.
>  faultActor: 
>  faultNode: 
>  faultDetail: 
> 	{http://xml.apache.org/axis/}stackTrace:java.io.IOException: java.io.IOException: Non
nillable element 'country' is null.
> 	at org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.java:275)
> 	at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1504)
> 	at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:980)
> 	at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:801)
> 	at org.apache.axis.message.RPCParam.serialize(RPCParam.java:208)
> 	at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:433)
> 	at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> 	at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:139)
> 	at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:478)
> 	at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> 	at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
> 	at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
> 	at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
> 	at org.apache.axis.SOAPPart.getContentLength(SOAPPart.java:229)
> 	at org.apache.axis.Message.getContentLength(Message.java:510)
> 	at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:371)
> 	at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
> 	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
> 	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> 	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> 	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
> 	at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
> 	at org.apache.axis.client.Call.invoke(Call.java:2767)
> 	at org.apache.axis.client.Call.invoke(Call.java:2443)
> 	at org.apache.axis.client.Call.invoke(Call.java:2366)
> 	at org.apache.axis.client.Call.invoke(Call.java:1812)
> 	at de.webservice.LesenSoapBindingStub.invoke(LesenSoapBindingStub.java:177)
> 	at Test.main(Test.java:30)
> 	{http://xml.apache.org/axis/}hostname:WUM03029
> java.io.IOException: java.io.IOException: Non nillable element 'country' is null.
> 	at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
> 	at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:317)
> 	at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
> 	at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
> 	at org.apache.axis.SOAPPart.getContentLength(SOAPPart.java:229)
> 	at org.apache.axis.Message.getContentLength(Message.java:510)
> 	at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:371)
> 	at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
> 	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
> 	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> 	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> 	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
> 	at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
> 	at org.apache.axis.client.Call.invoke(Call.java:2767)
> 	at org.apache.axis.client.Call.invoke(Call.java:2443)
> 	at org.apache.axis.client.Call.invoke(Call.java:2366)
> 	at org.apache.axis.client.Call.invoke(Call.java:1812)
> 	at de.webservice.LesenSoapBindingStub.invoke(LesenSoapBindingStub.java:177)
> 	at Test.main(Test.java:30)
> Caused by: java.io.IOException: java.io.IOException: Non nillable element 'country' is
null.
> 	at org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.java:275)
> 	at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1504)
> 	at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:980)
> 	at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:801)
> 	at org.apache.axis.message.RPCParam.serialize(RPCParam.java:208)
> 	at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:433)
> 	at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> 	at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:139)
> 	at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:478)
> 	at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> 	at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
> 	... 17 more
> Obviously the validation doesn't work correctly here. It seems as if the choice or sequence
tags, telling that short and country do not need to be provided, are ignored on validation
(see the attached example WSDLs).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message