在 axis2 中使用自定义 wsdl 文件 - 使用时出现问题而不是
我正在使用 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 为空。
这是我发送的肥皂请求
使用的代码片段,
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>
to server.
<axis:a>a</axis:a>
<axis:b>b</axis:b>
<axis:c>c</axis:c>
</axis:multiply>
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 ADB 中的一个错误。请参阅https://issues.apache.org/jira/browse/AXIS2-842< /a>
它已被修复,所以我猜您正在使用旧版本。
我已经使用 axis 1.5.1/jdk1.6.0/openSuse 11.2 测试了这个问题。它似乎在 REST 调用和客户端存根方面都能顺利工作。这是我的复杂类型:
该操作应该连接到字符串。 REST URL 如下所示:
响应似乎也正常:
服务实现很简单。所以...它对我来说是固定的:-(
干杯!
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:
The operation is supposed to concat to strings. The REST URL looks like:
The response seems also OK:
The service implementation is trivial. So... it is fixed for me :-(
Cheers!