Web サービスに axis2 を使用しています。今日、デフォルトで生成された axis2 の代わりに独自の wsdl ファイルを使用しようとすると、オブザーバーの予期しない動作が発生しました。詳細は次のとおりです。
これは元の 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 の値が null になります。
<axis:multiply>
<axis:a>a</axis:a>
<axis:b>b</axis:b>
<axis:c>c</axis:c>
</axis:multiply>
これは、サーバーに送信する SOAP リクエストです。
ここに私がサーバー側で使用しているコードスニペットがあります
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
値を提供しているにもかかわらず、値を黒またはnullとして受け取っている理由を誰でも知ることができますか?
ありがとう、
ナレンドラ