Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#WSDL返回XML响应,但变量仍然为空_C#_Xml_Wsdl - Fatal编程技术网

C#WSDL返回XML响应,但变量仍然为空

C#WSDL返回XML响应,但变量仍然为空,c#,xml,wsdl,C#,Xml,Wsdl,我有一个返回Xml响应的WSDL,但当我尝试将其分配给响应变量时,对象仍然为空 这是我调用web服务并尝试将响应分配给我的变量的代码: CustomerReq request = new CustomerReq(); request.DayPhone = ""; request.OrganizationCode = "JY-US"; request.EmailID = "sampleemail@se.com";

我有一个返回Xml响应的WSDL,但当我尝试将其分配给响应变量时,对象仍然为空

这是我调用web服务并尝试将响应分配给我的变量的代码:

CustomerReq request = new CustomerReq();
            request.DayPhone = "";
            request.OrganizationCode = "JY-US";
            request.EmailID = "sampleemail@se.com";

            getCustomerInfoResponse response = new getCustomerInfoResponse();


            WSA_CUSTOMER_LOOKUP_OMSClient client = new WSA_CUSTOMER_LOOKUP_OMSClient();
            client.Endpoint.EndpointBehaviors.Add(new FaultFormatingBehavior());

            client.Open();

            response.getCustomerInfoResponse1 = client.getCustomerInfo(request);
            client.Close();
这是Xml请求:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005    /05/addressing/none">http://WSA_CUSTOMER_LOOKUP_OMS/getCustomerInfo</Action>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<getCustomerInfo OrganizationCode="JY-US" DayPhone="" EmailID="sampleemail@se.com" xmlns="http://WSA_CUSTOMER_LOOKUP_OMS" />
</s:Body>
</s:Envelope>

我已经通过soapui进行了测试,它工作正常,Xml响应看起来正确,但它不允许我将其分配给响应变量,也不会抛出任何错误。如果您有任何关于如何解决此问题的想法,我们将不胜感激,如果我需要提供更多详细信息,也请告诉我。

存在架构不匹配问题,这已得到解决。

使用
var foo=..
而不是
response.getCustomerineResponse1=>您得到了什么?很抱歉延迟,它被赋予CustomerResp类型和CustomerList属性,但它仍然为空。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" />
<soapenv:Body>
<out:getCustomerInfoResponse xmlns:out="http://WSA_CUSTOMER_LOOKUP_OMS">
<CustomerList TotalNumberOfRecords="1">
<Customer AssignedReps="0" BuyerOrganizationCode="" CanConsumeSupplementalCapacity="N" Createprogid="SterlingHttpTester" Createts="2015-03-04T10:09:49-06:00" Createuserid="CustomerName" CustomerID="100207932" CustomerKey="20150304100950117737467" CustomerType="02" ExternalCustomerID="" Lockid="113" MaxAssignRepsOrTeams="0" MaxModifyTS="2018-04-20T15:36:41-05:00" Modifyprogid=".YRCApp" Modifyts="2018-04-20T15:36:41-05:00" Modifyuserid="CustomerName" OrganizationCode="JY-US" RegisteredDate="2015-03-04T10:09:49-06:00" RootCustomerKey="20150304100950117737467" SendsAsn="N" SendsCommitment="N" SendsFuncAck="N" SlotPreferenceType="NONE" Status="10">
<Extn ExtnAccountAllowed="N" ExtnCustomerCreditRating="N" ExtnCustomerCrossRefItem="N" ExtnDirectMailFlag="Y" ExtnEmplFeed="N" ExtnLastOrdDate="2017-10-13" ExtnPayrollDeductionAllowed="N" ExtnPrepayAllowed="N" ExtnRequiredPONumber="N" ExtnShipComplete="N" ExtnShipToEmpl="N" ExtnSubscrStatus="0" ExtnTotCustValue="0.00" ExtnTotalOrders="0" ExtnWebAccountAllowed="N" ExtnWebCustomerID="CustomerName@genesco.com" ExtnWebEnabled="N" ExtnWebPrepayAllowed="N">
</Extn>
<CustomerContactList>
<CustomerContact Company="" Createprogid="SterlingHttpTester" Createts="2015-03-04T10:09:49-06:00" Createuserid="CustomerName" CustomerContactID="100208103" CustomerContactKey="20150304100950117737468" CustomerKey="20150304100950117737467" DayFaxNo="" DayPhone="5555555555" EmailID="CustomerName@genesco.com" EveningFaxNo="" EveningPhone="" FirstName="A" LastName="T" Lockid="3" MiddleName="" MobilePhone="" Modifyprogid="CreateOrder" Modifyts="2017-04-26T08:25:08-05:00" Modifyuserid="CreateOrder" Title="" UserID="">
<CustomerAdditionalAddressList>
<CustomerAdditionalAddress AddressType="" Createprogid="SterlingHttpTester" Createts="2015-03-04T10:09:50-06:00" Createuserid="CustomerName" CustomerAdditionalAddressID="100238485" CustomerAdditionalAddressKey="20150304100950117737470" CustomerContactKey="20150304100950117737468" CustomerKey="20150304100950117737467" IsBillTo="Y" IsDefaultBillTo="Y" IsDefaultShipTo="Y" IsInherited="N" IsShipTo="Y" Lockid="4" Modifyprogid="CreateOrder" Modifyts="2017-04-26T14:48:05-05:00" Modifyuserid="CreateOrder" PersonInfoKey="20170426082509190364347">
<PersonInfo AddressLine1="1415 Rd Pike" AddressLine2="" AddressLine3="" AddressLine4="" AddressLine5="" AddressLine6="" AlternateEmailID="" Beeper="" City="SomeCity" Company="" Country="US" Createprogid="CreateOrder" Createts="2017-04-26T08:25:08-05:00" Createuserid="CreateOrder" DayFaxNo="" DayPhone="5555555555" Department="" EMailID="CustomerName@genesco.com" ErrorTxt="" EveningFaxNo="" EveningPhone="" FirstName="A" HttpUrl="" JobTitle="" LastName="T" Lockid="0" MiddleName="" MobilePhone="" Modifyprogid="CreateOrder" Modifyts="2017-04-26T08:25:08-05:00" Modifyuserid="CreateOrder" OtherPhone="" PersonID="" PersonInfoKey="20170426082509190364347" PreferredShipAddress="" ShortZipCode="37217" State="TN" Suffix="" Title="" UseCount="0" VerificationStatus="" ZipCode="37217" isHistory="N">
<Extn ExtnNormAddLine1="1415 Rd PIKE" ExtnNormCity="SomeCity" ExtnNormState="TN" ExtnNormZipCode="#####">
</Extn>
</PersonInfo>
</CustomerAdditionalAddress>
</CustomerAdditionalAddressList>
</CustomerContact>
</CustomerContactList>
<CustomerPaymentMethodList>
<CustomerPaymentMethod AvailableAccountBalance="0" Createprogid=".YRCApp" Createts="2015-05-11T14:24:27-05:00" Createuserid="CustomerName" CreditCardExpDate="" CreditCardName="" CreditCardNo=" " CreditCardType="" CustomerAccountNo=" " CustomerContactKey="" CustomerKey="20150304100950117737467" CustomerPaymentMethodKey="20150511142427123647013" DisplayCreditCardNo="" DisplayCustomerAccountNo="" DisplayPaymentReference1="4444" DisplayPrimaryAccountNo="4444" FirstName="" IsDefaultMethod="N" IsInherited="N" LastName="" Lockid="0" MiddleName="" Modifyprogid=".YRCApp" Modifyts="2015-05-11T14:24:27-05:00" Modifyuserid="CustomerName" PaymentReference1="4444" PaymentReference2="60.0" PaymentReference3="" PaymentType="CHECK" PaymentTypeGroup="OTHER" PrimaryAccountNo="4444">
</CustomerPaymentMethod>
</CustomerPaymentMethodList>
</Customer>
<Customer AssignedReps="0" BuyerOrganizationCode="" CanConsumeSupplementalCapacity="N" Createprogid=".YRCApp" Createts="2018-08-03T07:15:00-05:00" Createuserid="CustomerName" CustomerID="100272221" CustomerKey="20180803071500281776624" CustomerType="02" ExternalCustomerID="" Lockid="0" MaxAssignRepsOrTeams="0" MaxModifyTS="2018-08-03T07:15:00-05:00" Modifyprogid=".YRCApp" Modifyts="2018-08-03T07:15:00-05:00" Modifyuserid="CustomerName" OrganizationCode="JY-US" RegisteredDate="2018-08-03T07:15:00-05:00" RootCustomerKey="20180803071500281776624" SendsAsn="N" SendsCommitment="N" SendsFuncAck="N" SlotPreferenceType="NONE" Status="10">
<Extn ExtnAccountAllowed="N" ExtnCustomerCreditRating="N" ExtnCustomerCrossRefItem="N" ExtnDirectMailFlag="N" ExtnEmplFeed="N" ExtnPayrollDeductionAllowed="N" ExtnPrepayAllowed="N" ExtnRequiredPONumber="N" ExtnShipComplete="N" ExtnShipToEmpl="N" ExtnSubscrStatus="0" ExtnTotCustValue="0.00" ExtnTotalOrders="0" ExtnWebAccountAllowed="N" ExtnWebEnabled="N" ExtnWebPrepayAllowed="N">
</Extn>
<CustomerContactList>
<CustomerContact Company="" Createprogid=".YRCApp" Createts="2018-08-03T07:15:00-05:00" Createuserid="CustomerName" CustomerContactID="100272403" CustomerContactKey="20180803071501281776625" CustomerKey="20180803071500281776624" DayFaxNo="" DayPhone="5555555555" EmailID="CustomerName@genesco.com" EveningFaxNo="" EveningPhone="" FirstName="Amber" LastName="T" Lockid="0" MiddleName="" MobilePhone="" Modifyprogid=".YRCApp" Modifyts="2018-08-03T07:15:00-05:00" Modifyuserid="CustomerName" Title="" UserID="">
<CustomerAdditionalAddressList>
<CustomerAdditionalAddress AddressType="" Createprogid=".YRCApp" Createts="2018-08-03T07:15:00-05:00" Createuserid="CustomerName" CustomerAdditionalAddressID="100318471" CustomerAdditionalAddressKey="20180803071501281776627" CustomerContactKey="20180803071501281776625" CustomerKey="20180803071500281776624" IsBillTo="Y" IsDefaultBillTo="Y" IsDefaultShipTo="Y" IsInherited="N" IsShipTo="Y" Lockid="0" Modifyprogid=".YRCApp" Modifyts="2018-08-03T07:15:00-05:00" Modifyuserid="CustomerName" PersonInfoKey="20180803071501281776626">
<PersonInfo AddressLine1="#### Rd Pike" AddressLine2="" AddressLine3="" AddressLine4="" AddressLine5="" AddressLine6="" AlternateEmailID="" Beeper="" City="SomeCity" Company="" Country="US" Createprogid=".YRCApp" Createts="2018-08-03T07:15:00-05:00" Createuserid="CustomerName" DayFaxNo="" DayPhone="5555555555" Department="" EMailID="CustomerName@genesco.com" ErrorTxt="" EveningFaxNo="" EveningPhone="" FirstName="Amber" HttpUrl="" IsCommercialAddress="N" JobTitle="" LastName="T" Lockid="0" MiddleName="" MobilePhone="" Modifyprogid=".YRCApp" Modifyts="2018-08-03T07:15:00-05:00" Modifyuserid="CustomerName" OtherPhone="" PersonID="" PersonInfoKey="20180803071501281776626" PreferredShipAddress="" ShortZipCode="37217" State="TN" Suffix="" Title="" UseCount="0" VerificationStatus="" ZipCode="37217-2829" isHistory="N">
<Extn>
</Extn>
</PersonInfo>
</CustomerAdditionalAddress>
</CustomerAdditionalAddressList>
</CustomerContact>
</CustomerContactList>
<CustomerPaymentMethodList>
</CustomerPaymentMethodList>
</Customer>
</CustomerList>
</out:getCustomerInfoResponse>
</soapenv:Body>
</soapenv:Envelope>
<endpoint address="http://som2:7803/WSA_CUSTOMER_LOOKUP_OMS"
            binding="basicHttpBinding" bindingConfiguration="WSA_CUSTOMER_LOOKUP_OMSHttpBinding"
            contract="OMSCustomerLookup.WSA_CUSTOMER_LOOKUP_OMS" name="WSA_CUSTOMER_LOOKUP_OMSHttpPort" />
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
public partial class getCustomerInfoResponse {

    [System.ServiceModel.MessageBodyMemberAttribute(Name="getCustomerInfoResponse", Namespace="http://WSA_CUSTOMER_LOOKUP_OMS", Order=0)]
    public OMSWebServicesTest.OMSCustomerLookup.CustomerResp getCustomerInfoResponse1;

    public getCustomerInfoResponse() {
    }

    public getCustomerInfoResponse(OMSWebServicesTest.OMSCustomerLookup.CustomerResp getCustomerInfoResponse1) {
        this.getCustomerInfoResponse1 = getCustomerInfoResponse1;
    }
}