[ 
https://issues.apache.org/jira/browse/AXIS2C-1579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13190019#comment-13190019
 ] 

Hengli Wang commented on AXIS2C-1579:
-------------------------------------

Here is a patch that I used (the line numbers may be off as I have other 
patches).

--- 
./modules/codegen/src/org/apache/axis2/wsdl/template/c/StubSourceTemplate.xsl   
    2012-01-12 14:06:44.000000000 -0500
+++ 
./modules/codegen/src/org/apache/axis2/wsdl/template/c/StubSourceTemplate.xsl   
    2012-01-12 14:06:38.000000000 -0500
@@ -356,9 +356,11 @@
             if (NULL == soap_act)
             {
               is_soap_act_set = AXIS2_FALSE;
+              <xsl:if test="$soapAction != '' and $soapAction != 
'&quot;&quot;' and $soapAction != '\&quot;\&quot;'">
               soap_action = "<xsl:value-of select="$soapAction"/>";
               soap_act = axutil_string_create(env, "<xsl:value-of 
select="$soapAction"/>");
               axis2_options_set_soap_action(options, env, soap_act);    
+              </xsl:if>
             }
 
             <xsl:choose>
@@ -1090,9 +1092,11 @@
             if (NULL == soap_act)
             {
               is_soap_act_set = AXIS2_FALSE;
+              <xsl:if test="$soapAction != '' and $soapAction != 
'&quot;&quot;' and $soapAction != '\&quot;\&quot;'">
               soap_action = "<xsl:value-of select="$soapAction"/>";
               soap_act = axutil_string_create(env, "<xsl:value-of 
select="$soapAction"/>");
               axis2_options_set_soap_action(options, env, soap_act);
+              </xsl:if>
             }
             <xsl:choose>
              <xsl:when 
test="$soapVersion='http://www.w3.org/2003/05/soap-envelope'">
@@ -1246,9 +1250,11 @@
             soap_act = axis2_options_get_soap_action ( options, env );
             if ( NULL == soap_act )
             {
+              <xsl:if test="$soapAction != '' and $soapAction != 
'&quot;&quot;' and $soapAction != '\&quot;\&quot;'">
               soap_action = "<xsl:value-of select="$soapAction"/>";
               soap_act = axutil_string_create(env, "<xsl:value-of 
select="$soapAction"/>");
               axis2_options_set_soap_action(options, env, soap_act);    
+              </xsl:if>
             }
             <xsl:choose>
              <xsl:when 
test="$soapVersion='http://www.w3.org/2003/05/soap-envelope'">


With the patch, the new response looks like,

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
  <soapenv:Body>
    <n:get_configurationResponse xmlns:n="urn:any" 
                                 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
                                 xsi:type="n:get_configurationResponse">
      <n:return xsi:type="n:MyConfiguration">
        <n:name>me</n:name>
        <n:policy xsi:type="n:MyPolicyConfiguration">
            <n:percent>100</n:percent>
          </n:policy>
        </n:return>
    </n:get_configurationResponse>
  </soapenv:Body>
</soapenv:Envelope>

                
> Wrong xsi:type in the response
> ------------------------------
>
>                 Key: AXIS2C-1579
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-1579
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: wsdl2c tool
>    Affects Versions: 1.6.0
>            Reporter: Hengli Wang
>
> I use axis2-1.6.1, and the responses created by the generated code has wrong 
> xsi:type. There are a few issues,
> 1. The xmlns:xsi is set to the target namespace of the last complex structure 
> in the response.
> 2. The top level xsi:type is set to the type of the last complex structure in 
> the response, with no prefix.
> Example WSDL,
> <wsdl:definitions>
>     <wsdl:types>
>         <xs:schema attributeFormDefault="qualified" 
> elementFormDefault="qualified" targetNamespace="urn:any">
>             <xs:complexType name="MyConfiguration">
>                 <xs:sequence>
>                     <xs:element name="name" type="xs:string"/>
>                     <xs:element minOccurs="0" name="policy" 
> type="tns:MyPolicyConfiguration"/>
>                 </xs:sequence>
>             </xs:complexType>
>             <xs:complexType name="MyPolicyConfiguration">
>                 <xs:sequence>
>                     <xs:element minOccurs="0" name="percent" 
> type="xs:boolean"/>
>                 </xs:sequence>
>             </xs:complexType>
>             <xs:element name="get_configurationResponse">
>                 <xs:complexType>
>                     <xs:sequence>
>                         <xs:element maxOccurs="unbounded" minOccurs="0" 
> name="return" type="tns:MyConfiguration"/>
>                     </xs:sequence>
>                 </xs:complexType>
>             </xs:element>
>         </xs:schema>
>     </wsdl:types>
>     <wsdl:message name="get_configurationRequest">
>         <wsdl:part name="parameters" element="tns:get_configuration"/>
>     </wsdl:message>
>     <wsdl:message name="get_configurationResponse">
>         <wsdl:part name="parameters" element="tns:get_configurationResponse"/>
>     </wsdl:message>
>     ...
> </wsdl:definitions>
> The response is,
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
>   <soapenv:Body>
>     <n:get_configurationResponse xmlns:n="urn:any"
>                                  xmlns:xsi="urn:any"
>                                  xsi:type="MyPolicyConfiguration">
>       <n:return xsi:type="ARXShareConfiguration">
>         <n:name>me</n:name>
>         <n:policy xsi:type="ARXSharePolicyConfiguration">
>           <n:percent>100</n:percent>
>         </n:policy>
>       </n:return>
>     </n:get_configurationResponse>
>   </soapenv:Body>
> </soapenv:Envelope>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to