Java サーバーでホストされている Web サービスを呼び出そうとしています。Visual Studio で提供される Web サービス作成ツールを使用してクラスを作成しました。メソッドを呼び出すと、有効なデータが返されていることが Fiddler でわかります。ただし、私の C# コードでは、結果は null です。
どんな助けでも大歓迎です。
C# 呼び出しコード:
RuleValidationResponseRule[] ruleResponse = rulesWebService.RuleValidation(ruleData, "LO");
Web サービス生成コード:
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.example.org/LathamInt/RuleValidation",
RequestNamespace="http://www.example.org/LathamInt/",
ResponseNamespace="http://www.example.org/LathamInt/",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlArrayAttribute("ruleValidationResp",
Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
[return: System.Xml.Serialization.XmlArrayItemAttribute("rule",
Form=System.Xml.Schema.XmlSchemaForm.Unqualified,
IsNullable=false)]
public RuleValidationResponseRule[] RuleValidation([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
RuleValidationRuleData ruleData,
[System.Xml.Serialization.XmlAttributeAttribute()] string company) {
object[] results = this.Invoke("RuleValidation", new object[] {
ruleData,
company});
return ((RuleValidationResponseRule[])(results[0]));
}
Web サービスに渡される XML (Fiddler から):
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<RuleValidation company="LO" xmlns="http://www.example.org/LathamInt/">
<ruleData xmlns="">
<rule ruleID="GDSP" />
<varData varName="GuideSpace" varValue="3" />
</ruleData>
</RuleValidation>
</soap:Body>
</soap:Envelope>
サービスから返された XML (Fiddler から):
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:lat="http://www.example.org/LathamInt/">
<soapenv:Header/>
<soapenv:Body>
<RuleValidationResponse>
<ruleValidationResp>
<rule result="0" ruleId="GDSP" status="success">
<expression pre="@GuideSpace > 3" post="3 > 3"/>
</rule>
</ruleValidationResp>
</RuleValidationResponse>
</soapenv:Body>
</soapenv:Envelope>
C# 生成コードでの応答定義:
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.example.org/LathamInt/")]
public partial class RuleValidationResponseRule {
private RuleValidationResponseRuleExpression expressionField;
private string resultField;
private string ruleIdField;
private string statusField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public RuleValidationResponseRuleExpression expression {
get {
return this.expressionField;
}
set {
this.expressionField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string result {
get {
return this.resultField;
}
set {
this.resultField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string ruleId {
get {
return this.ruleIdField;
}
set {
this.ruleIdField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string status {
get {
return this.statusField;
}
set {
this.statusField = value;
}
}
}