You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Dimuthu Gamage <di...@gmail.com> on 2007/12/04 10:32:53 UTC
Re: WSDL2C Defects
Hi Alastair,
I will fix the defects you mentioned, And thanks for posting them.
Regarding the question you ask, you can set custom headers using
axis2_svc_client_add_header function in your code.
Thanks
Dimuthu
On Nov 30, 2007 6:04 AM, Alastair FETTES <af...@mdacorporation.com> wrote:
> I have a combination question/defect report. These are all in regards
> to StubSourceTemplate.xsl.
>
> ============
>
> Defect 1:
> ---------
> (line 179 of StubSourceTemplate.xsl)
>
> /**
> * auto generated method signature
> * for "<xsl:value-of select="@qname"/>" operation.
> <xsl:for-each select="input/param[@type!='']">* @param _<xsl:value-of
> select="@name"/></xsl:for-each>
> * @return
> */
>
> This produces method headers that look like...
>
> /**
> * auto generated method signature for asynchronous invocations
> * for "MyOperation|http://location.org/wsdl" operation.
>
> * @param myOperationRequest* @param interfaceVersion
> * @param on_complete callback to handle on complete
> * @param on_error callback to handle on error
> */
>
> This code should be changed too...
>
> /**
> * auto generated method signature
> * for "<xsl:value-of select="@qname"/>" operation.
> * <xsl:for-each select="input/param[@type!='']"><xsl:text>
> </xsl:text> * @param _<xsl:value-of select="@name"/></xsl:for-each>
> * @return
> */
>
> This will pretty print your output to correctly show all parameters on
> their own line.
>
> ===========
>
> Defect 2:
> ---------
> (line 190 of StubSourceTemplate.xsl)
>
> axis2_stub_op_<xsl:value-of select="$servicename"/>_<xsl:value-of
> select="@name"/>(
> axis2_stub_t *stub, const axutil_env_t *env<xsl:for-each
> select="input/param[@type!='']">,
> <xsl:variable name="inputtype">
> <xsl:if test="@ours">adb_</xsl:if><xsl:value-of
> select="@type"/><xsl:if test="@ours">_t*</xsl:if>
> </xsl:variable>
> <xsl:if test="position()>1">,</xsl:if><xsl:value-of
> select="$inputtype"/><xsl:text> _</xsl:text><xsl:value-of
> select="@name"/>
> </xsl:for-each>)
>
> This produces code that looks like...
>
> void axis2_stub_MyService_MyOperation_start( axis2_stub_t *stub, const
> axutil_env_t *env,
> ,axiom_node_t*
> myOperationRequest,
> ,axiom_node_t*
> interfaceVersion,
> ,axis2_status_t (
> AXIS2_CALL *on_complete ) (struct axis2_callback *, const axutil_env_t
> *) ,
> ,axis2_status_t (
> AXIS2_CALL *on_error ) (struct axis2_callback *, const axutil_env_t *,
> int ) )
>
> Note the extra comma. The following lines of code should be changed:
>
> axis2_stub_t *stub, const axutil_env_t *env<xsl:for-each
> select="input/param[@type!='']">, <---- remove this comma
> <xsl:variable name="inputtype">
>
> ===========
>
> Defect 3:
> ---------
> (line 214 of StubSourceTemplate.xsl)
>
> <!-- for service client currently suppported only 1 input param -->
> <xsl:for-each select="input/param[@type!='']">
> <xsl:if test="position()=1">
> <xsl:choose>
> <xsl:when test="@ours">
> payload = adb_<xsl:value-of
> select="@type"/>_serialize(_<xsl:value-of select="@name"/>, env, NULL,
> NULL, AXIS2_TRUE, NULL, NULL);
> </xsl:when>
> <xsl:otherwise>
> payload = _<xsl:value-of select="@name"/>;
> </xsl:otherwise>
> </xsl:choose>
> </xsl:if>
> </xsl:for-each>
>
> The for loop is redundant. Change this code to be the following:
>
> <xsl:variable name="firstParam" select="input/param[1]"/>
> <xsl:if test="$firstParam/@type!=''">
> <xsl:choose>
> <xsl:when test="$firstParam/@ours">
> payload = adb_<xsl:value-of
> select="$firstParam/@type"/>_serialize(_<xsl:value-of
> select="$firstParam/@name"/>, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
> </xsl:when>
> <xsl:otherwise>
> payload = _<xsl:value-of select="$firstParam/@name"/>;
> </xsl:otherwise>
> </xsl:choose>
> </xsl:if>
>
> ===========
>
> Defect 4:
> ---------
> (lines 179 to 285 of StubSourceTemplate.xsl)
>
> This code adds in the parameters for the header (<xsl:for-each
> select="input/param[@type!='']">) but only the first parameter is ever
> referenced. Read: The elements explicitly specified as headers in the
> WSDL are not used and thus not added to the service call.
>
> Here is the sample WSDL that can be used to reproduce these errors.
>
> <wsdl:definitions targetNamespace="http://location.org/wsdl"
> xmlns:tns="http://location.org/wsdl"
> xmlns:msg="http://location.org/messages"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
> xmlns:wsi="http://ws-i.org/schemas/conformanceClaim/">
>
> <wsdl:types>
> <xs:schema targetNamespace="http://location.org/wsdl">
> <xs:element name="InterfaceVersion" type="xs:string"/>
> <xs:element name="MyOperationRequest" type="xs:string"/>
> <xs:element name="MyOperationResponse" type="xs:string"/>
> <xs:element name="MyException" type="xs:string"/>
> </xs:schema>
> </wsdl:types>
>
> <wsdl:message name="InterfaceVersion">
> <wsdl:part element="msg:InterfaceVersion" name="header"/>
> </wsdl:message>
>
> <wsdl:message name="MyOperationRequest">
> <wsdl:part name="body" element="msg:MyOperationRequest"/>
> </wsdl:message>
>
> <wsdl:message name="MyOperationResponse">
> <wsdl:part name="body" element="msg:MyOperationResponse"/>
> </wsdl:message>
>
> <wsdl:message name="MyException">
> <wsdl:part name="body" element="msg:MyException"/>
> </wsdl:message>
>
> <wsdl:portType name="MyPortType">
>
> <!-- MyOperation -->
> <wsdl:operation name="MyOperation">
> <wsdl:input message="tns:MyOperationRequest"/>
> <wsdl:output message="tns:MyOperationResponse"/>
> <wsdl:fault message="tns:MyException" name="MyException"/>
> </wsdl:operation>
> </wsdl:portType>
>
> <wsdl:binding name="MyPortBinding" type="tns:MyPortType">
> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
> style="document"/>
> <wsdl:operation name="MyOperation">
> <soap12:operation
> soapAction="http://location.org/services/MyOperation"
> soapActionRequired="true"
> style="document"/>
> <wsdl:input>
> <soap12:header part="header" use="literal"
> message="tns:InterfaceVersion"/>
> <soap12:body parts="body" use="literal"/>
> </wsdl:input>
> <wsdl:output>
> <soap12:body parts="body" use="literal"/>
> </wsdl:output>
> <wsdl:fault name="MyException">
> <soap12:body use="literal"/>
> </wsdl:fault>
> </wsdl:operation>
> </wsdl:binding>
>
> <wsdl:service name="MyService">
> <wsdl:port name="MySoapPort" binding="tns:MyPortBinding">
> <wsdl:documentation>
> <wsi:Claim
> conformsTo="http://ws-i.org/profiles/basic/1.0" />
> </wsdl:documentation>
> <soap12:address location="http://location.org/"/>
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
>
> ===========
>
> Also note that I believe these same mistakes are made in all three
> versions of this function that are created dependent upon if it is asyn,
> sync or mep only.
>
> The question is now since the stub generation does not use the header
> parameters supplied, where abouts can I find an example of setting
> custom headers on the client side? I.e. I need to add my interface
> version to the SOAP header but do not know how to do this.
>
> Thanks in advance.
>
> Alastair Fettes
> MacDonald, Dettwiler and Associates
>
> This e-mail and any attachments are intended solely for the use of the
> intended recipient(s) and may contain legally privileged, proprietary
> and/or confidential information. Any use, disclosure, dissemination,
> distribution or copying of this e-mail and any attachments for any
> purposes that have not been specifically authorized by the sender is
> strictly prohibited. If you are not the intended recipient, please
> immediately notify the sender by reply e-mail and permanently delete all
> copies and attachments.
>
> The entire content of this e-mail is for "information purposes" only and
> should not be relied upon by the recipient in any way unless otherwise
> confirmed in writing by way of letter or facsimile.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>