在 axis2 中使用自定义 wsdl 文件 - 使用时出现问题而不是

发布于 2024-10-05 05:08:33 字数 2483 浏览 1 评论 0原文

我正在使用 axis2 作为我的网络服务。今天,当我尝试使用自己的 wsdl 文件而不是 axis2 默认生成的文件时,我观察到了意外的行为。详细信息如下。

这是原始 wsdl 文件部分。

     <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" 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>

当我执行这个时,我得到的值为 a 为空白,而 b 和 c 为空。

这是我发送的肥皂请求 ; <轴:a>a <轴:b>b <轴:c>c 到服务器。

使用的代码片段,

              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";
        }

这是我在服务器端的记录器控制台上

            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

我得到以下输出:任何人都可以告诉我为什么即使我提供值,我也会收到黑色或空值。

谢谢,
纳伦德拉

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" 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

在梵高的星空下 2024-10-12 05:08:33

这是 ADB 中的一个错误。请参阅https://issues.apache.org/jira/browse/AXIS2-842< /a>

它已被修复,所以我猜您正在使用旧版本。

我已经使用 axis 1.5.1/jdk1.6.0/openSuse 11.2 测试了这个问题。它似乎在 REST 调用和客户端存根方面都能顺利工作。这是我的复杂类型:

<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>

该操作应该连接到字符串。 REST URL 如下所示:

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

响应似乎也正常:

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

服务实现很简单。所以...它对我来说是固定的:-(

干杯!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文