开发者

Using custom wsdl file in axis2 - Problem whne using <xs:all> instead of <xs:sequence>

开发者 https://www.devze.com 2023-01-27 20:34 出处:网络
I am using axis2 for my webservices. Todaywhen i tried to use my own wsdl file instead of axis2 default generated i observer unexpected behaviour.Here goes the details.

I am using axis2 for my webservices. Today when i tried to use my own wsdl file instead of axis2 default generated i observer unexpected behaviour.Here goes the details.

This is the original wsdl file part.

     <xs:element name="multiply">
            <xs:complexType>
                <xs:sequence>
                    <xs:element minOccurs="0" name="a" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="b" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="c"开发者_StackOverflow中文版 nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>

   I changed <xs:sequence> to <xs:all> so that i can send elements in any order in soap request.Below is the changed one.
        <xs:element name="multiply">
            <xs:complexType>
                <xs:all>
                    <xs:element minOccurs="0" name="a" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="b" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="c" nillable="true" type="xs:string"/>
                </xs:all>
            </xs:complexType>
        </xs:element>

When I am executing this one I am getting value for a is blanck and for b and c null.

This is the soap request i am sending <axis:multiply> <axis:a>a</axis:a> <axis:b>b</axis:b> <axis:c>c</axis:c> </axis:multiply> to server.

Here is the code snippet i am using at server side

              public String multiply(String a, String b, String c) throws Exception
       {
    LogHelper.info(logger, "Begin - Multiply");
    if (a.trim().equals(""))
        LogHelper.info(logger, "value fo a is a=\"\"");
    if (b == null)
        LogHelper.info(logger, "value fo b is null");
    if (c == null)
        LogHelper.info(logger, "value fo c is null");

    return "Hellow World";
        }

on the console for loggers Iam getting below out put:

            19:47:20,227 INFO  [STDOUT] INFO  [SampleWebService] Begin - Multiply
            19:47:20,227 INFO  [STDOUT] INFO  [SampleWebService] value fo a is a=""
            19:47:20,227 INFO  [STDOUT] INFO  [SampleWebService] value fo b is null
            19:47:20,228 INFO  [STDOUT] INFO  [SampleWebService] value fo c is null

Can any one tell why i am receivng values as black or null even i am supplying values.

Thanks,

Narendra


This is a bug in ADB. Please refer to https://issues.apache.org/jira/browse/AXIS2-842

It has been fixed so I guess that you are using older version.

I have tested this issue with axis 1.5.1/jdk1.6.0/openSuse 11.2. It seems to work smooth both with REST invocation and with the client stub. Here is my complex type:

<xsd:element name="concat">
  <xsd:complexType>
    <xsd:all>
        <xsd:element name="s1" type="xsd:string"/>
        <xsd:element name="s2" type="xsd:string"/>
   </xsd:all>
 </xsd:complexType>
</xsd:element>

The operation is supposed to concat to strings. The REST URL looks like:

http://.../axis2/services/TestService/concat?s2=test2&s1=test1

The response seems also OK:

<ns1:concatResponse xmlns:ns1="..."><r>test1test2</r></ns1:concatResponse>

The service implementation is trivial. So... it is fixed for me :-(

Cheers!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号