[ 
https://issues.apache.org/jira/browse/AXIS2-4439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12734285#action_12734285
 ] 

Andreas Veithen commented on AXIS2-4439:
----------------------------------------

There are actually two answers to this issue:

1. The intention of the "OriginalMessage" element is to wrap the original 
message, i.e. a single element. This could be better expressed using the 
following schema construct:

<xsd:element name="OriginalMessage" form="unqualified" minOccurs="0">
  <xsd:complexType>
    <xsd:sequence>
      <xsd:any processContents="skip"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>

Indeed, this would constraint the content to be a single element. So if you 
have control over the WSDL, one option is to change that. ADB will then 
generate code that represents the content of OriginalMessage as an OMElement.

2. Up to version 1.3, Axis2 also used OMElement in the case of xsd:anyType. 
Obviously this is not the right solution, at least when the document specifies 
the type explicitly using xsi:type. Therefore this behavior was changed in 
version 1.4, so that ADB maps to the appropriate Java type. The problem is that 
now ADB considers xsi:type as mandatory. There is a comment [1] in AXIS2-3797 
that explains the rationale behind this. Apparently the assumption that has 
been made is that xsd:anyType necessarily refers to any type defined in the 
schema (or any standard schema type). I believe that this is wrong and 
contradicts the XML schema specs [1], specifically section 2.5.4:

"Example

<xsd:element name="anything" type="xsd:anyType"/>

The content of the element declared in this way is unconstrained, so the 
element value may be 423.46, but it may be any other sequence of characters as 
well, or indeed a mixture of characters and elements."

My interpretation is that anyType really means any content you want. Assuming 
that this is the correct interpretation, it means that neither Axis2 1.3 nor 
1.4 handle anyType in the right/appropriate way and that we need to support 
mapping to a Java type as well as mapping to an OMElement (if no xsi:type 
argument is given).

[1] 
https://issues.apache.org/jira/browse/AXIS2-3797?focusedCommentId=12627287&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_12627287
[2] http://www.w3.org/TR/xmlschema-0/

> ADBException: Any type element type has not been given
> ------------------------------------------------------
>
>                 Key: AXIS2-4439
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4439
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: client-api
>    Affects Versions: 1.5
>         Environment: Windows XP Desktop computer
>            Reporter: Anthony Seniunas
>            Priority: Blocker
>   Original Estimate: 0.33h
>  Remaining Estimate: 0.33h
>
> I've developed a web client  using wsdl2java and I'm getting the following 
> exception when obtaining a response from a web service.
> org.apache.axis2.databinding.ADBException: Any type element type has not been 
> given 
> The .wsdl fragment relating to this is:-
>             <xsd:complexType name="DocumentData">
>                 <xsd:sequence>
>                     <xsd:element name="Doc" type="schema:DocType" 
> form="unqualified" minOccurs="0"
>                         maxOccurs="unbounded"/>
>                     <xsd:element name="Result" type="xsd:string" 
> form="unqualified" minOccurs="0"/>
>                     <xsd:element name="SessionId" type="xsd:string" 
> form="unqualified" minOccurs="0"/>
>                     <xsd:element name="OriginalMessage" type="xsd:anyType" 
> form="unqualified" minOccurs="0"/>
>                 </xsd:sequence>
>             </xsd:complexType>
> Note the originalMessage element type - anyType.
> The following is a typical response SOAP message causing the exception:-
> <?xml version = '1.0' encoding = 'UTF-8'?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
>    <soapenv:Body>
>       <call:LoginResponse 
> xmlns:call="http://www.testplc.com/ws/services/dms/interface/kirona/envhealth/";>
>          <call:DocumentData>
>             <Result>SUCCESS</Result>
>             <SessionId>D83D8A42672F08AA6EC9377CB32F6317</SessionId>
>             <OriginalMessage>
>                <ns1:Login 
> xmlns:ns1="http://www.testplc.com/ws/services/dms/interface/kirona/envhealth/";>
>                   
> <ns1:Authorisation>Y29yb25hdXNlcjpjMHIwbjR1czNy</ns1:Authorisation>
>                </ns1:Login>
>             </OriginalMessage>
>          </call:DocumentData>
>       </call:LoginResponse>
>    </soapenv:Body>
> </soapenv:Envelope>
> Its unusual but the web service returns the original message hence the usage 
> of anyType.
> I've come across many articles on problems with anyType and its possible this 
> problem has already been fixed so please can you advise?.

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

Reply via email to