私は、ac# クライアントを使用して使用してきた既存の Axis2 1.5.1 Web サービス用の Java クライアントを作成する任務を負っています。いくつかの場所、特にセッション ハンドルでバイト配列を使用していますが、スタブを作成する際に問題が発生しています。
wsdl2c が byte[] を byte[] として保持する Web サービス スタブを作成している間、Java スタブは byte[] を DataHandler に変換しています。
wsdl2java がマッピングを行う方法を変更する方法はありますか? それとも、ここで大きな何かが欠けていますか。
したがって、今は byte[] -> xs:base64Binary -> DataHandler を取得しています。私が欲しいのは byte[] -> xs:base64Binary -> byte[] です
-uw および -or 引数を使用して、wsdl2java を使用してスタブを生成しました。
wsdl2java -uri http://mycomputer:myport/my-webservices/services/TheServices?wsdl -uw -or
元のJavaメソッドは次のようになります
public byte[] newSession(byte[] domainenc, byte[] userenc, byte[] passenc) throws SOAPException {
wsdlは次のとおりです
<xs:element name="newSession">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="domainenc" nillable="true" type="xs:base64Binary"/>
<xs:element minOccurs="0" name="userenc" nillable="true" type="xs:base64Binary"/>
<xs:element minOccurs="0" name="passenc" nillable="true" type="xs:base64Binary"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="newSessionResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:base64Binary"/>
</xs:sequence>
</xs:complexType>
</xs:element>
C#クライアントの場合、wsdl2Cはパラメーターを運び、型をbyte []として返します。これが私が望む方法です
[return: System.Xml.Serialization.XmlElementAttribute("return", DataType="base64Binary", IsNullable=true)]
public byte[] newSession([System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary", IsNullable=true)] byte[] domainenc, [System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary", IsNullable=true)] byte[] userenc, [System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary", IsNullable=true)] byte[] passenc) {
object[] results = this.Invoke("newSession", new object[] {
domainenc,
userenc,
passenc});
return ((byte[])(results[0]));
}
ただし、wsdl2java を使用すると、base64binary がデータハンドラーとして変換されます。
public javax.activation.DataHandler newSession(javax.activation.DataHandler domainenc18,javax.activation.DataHandler userenc19,javax.activation.DataHandler passenc20) throws java.rmi.RemoteException
どんな助けでも大歓迎です。