3

JBoss で動作する Axis 1.4 Web サービスがあります。要求は問題ありませんが、Windows 8 ストア アプリで c# を使用して軸からの応答を逆シリアル化できません。null のオブジェクト myMethodRespone を取得します。VS で addServiceReference を介してサービスを追加するだけです。これが私のWSDLです(重要なコードスニペットのみ):

<xsd:complexType name="ArrayOf_xsd_string">
    <xsd:sequence>
      <xsd:element minOccurs="0" maxOccurs="unbounded" name="item" type="xsd:string" />
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="ArrayOf_tns1_AlternativeTransferable">
    <xsd:sequence>
      <xsd:element minOccurs="0" maxOccurs="unbounded" name="item" type="tns1:MyTransferable" />
    </xsd:sequence>
  </xsd:complexType>
<xsd:complexType name="AlternativeTransferable">
    <xsd:sequence>
      <xsd:element name="alternativeList" nillable="true" type="impl:ArrayOf_xsd_string" />
    </xsd:sequence>
  </xsd:complexType>
<xsd:complexType name="MyTransferable">
    <xsd:sequence>
      <xsd:element name="alternatives" nillable="true"type="impl:ArrayOf_tns1_AlternativeTransferable" />
      <xsd:element name="mod" nillable="true" type="impl:ArrayOf_xsd_string" />
      <xsd:element name="msnList" nillable="true" type="impl:ArrayOf_xsd_string" />
    </xsd:sequence>
  </xsd:complexType>
  <wsdl:operation name="myMethod" parameterOrder="msnList epacCodes">
  <wsdl:input name="myMethodRequest" message="impl:myMethodRequest" />
  <wsdl:output name="myMethodResponse" message="impl:myMethodResponse" />
  <wsdl:fault name="WebServiceRequestException" message="impl:WebServiceRequestException" />
</wsdl:operation>
  <wsdl:message name="myMethodResultResponse">
<wsdl:part name="myMethodReturn" type="tns1:MyTransferable" />
</wsdl:message>

Visual Studio から生成されたプロキシは次のようになります。

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="myMethodResponse", WrapperNamespace="http://localhost:8080/H970live/services/Configuration", IsWrapped=true)]
public partial class myMethodResponse {

    [System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)]
    public MyProject.Model.MyTransferable myMethodReturn;

    public myMethodResponse() {
    }

    public myMethodResponse(MyProject.Model.MyTransferable myMethodReturn) {
        this.myMethodReturn = myMethodReturn;
    }
}
  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.18213")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://entity.webservice.server.de")]
public partial class MyTransferable : object, System.ComponentModel.INotifyPropertyChanged {

    private AlternativeTransferable[] alternativesField;

    private string[] modField;

    private string[] msnListField;

    /// <remarks/>
    [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true, Order=0)]
    [System.Xml.Serialization.XmlArrayItemAttribute("item", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
    public AlternativeTransferable[] alternatives {
        get {
            return this.alternativesField;
        }
        set {
            this.alternativesField = value;
            this.RaisePropertyChanged("alternatives");
        }
    }

    /// <remarks/>
    [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true, Order=1)]
    [System.Xml.Serialization.XmlArrayItemAttribute("item", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
    public string[] mod {
        get {
            return this.modField;
        }
        set {
            this.modField = value;
            this.RaisePropertyChanged("mod");
        }
    }

    /// <remarks/>
    [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true, Order=2)]
    [System.Xml.Serialization.XmlArrayItemAttribute("item", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
    public string[] msnList {
        get {
            return this.msnListField;
        }
        set {
            this.msnListField = value;
            this.RaisePropertyChanged("msnList");
        }
    }

    public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

    protected void RaisePropertyChanged(string propertyName) {
        System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
        if ((propertyChanged != null)) {
            propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
        }
    }

     [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.18213")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://entity.webservice.server.de")]
public partial class AlternativeTransferable : object, System.ComponentModel.INotifyPropertyChanged {

    private string[] alternativeList;

    /// <remarks/>
    [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true, Order=0)]
    [System.Xml.Serialization.XmlArrayItemAttribute("item", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
    public string[] epacTdus {
        get {
            return this.alternativeList;
        }
        set {
            this.alternativeList = value;
            this.RaisePropertyChanged("epacTdus");
        }
    }

    public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

    protected void RaisePropertyChanged(string propertyName) {
        System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
        if ((propertyChanged != null)) {
            propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
        }
    }
}
}

そして、これは svcmap ファイル内の私のクライアント オプションです。

<ClientOptions>
<GenerateAsynchronousMethods>false</GenerateAsynchronousMethods>
<GenerateTaskBasedAsynchronousMethod>true</GenerateTaskBasedAsynchronousMethod>
<EnableDataBinding>true</EnableDataBinding>
<ExcludedTypes />
<ImportXmlTypes>false</ImportXmlTypes>
<GenerateInternalTypes>false</GenerateInternalTypes>
<GenerateMessageContracts>false</GenerateMessageContracts>
<NamespaceMappings />
<CollectionMappings>
  <CollectionMapping TypeName="System.Collections.ObjectModel.ObservableCollection`1" Category="List" />
</CollectionMappings>
<GenerateSerializableTypes>false</GenerateSerializableTypes>
<Serializer>Auto</Serializer>
<UseSerializerForFaults>false</UseSerializerForFaults>
<ReferenceAllAssemblies>true</ReferenceAllAssemblies>
<ReferencedAssemblies />
<ReferencedDataContractTypes />
<ServiceContractMappings />

応答は次のようになります。

     <?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<myMethodResponse xmlns="http://webservice.server.de">
<myMethodReturn>
<alternatives>
    <alternatives>
        <alternativeList/>
    </alternatives>
</alternatives>
<mod>
    <mod>CN22.00.998-01</mod>
</mod>
<msnList>
<msnList>N-2228</msnList>
<msnList>N-2456</msnList>
<msnList>N-2213</msnList>
<msnList>N-2716</msnList>
<msnList>N-3065</msnList>
</msnList>
</myMethodReturn>
</myMethodResponse>
</soapenv:Body></soapenv:Envelope>

誰でも私を助けることができますか?

4

0 に答える 0