2010-11-23 7 views
0

私はジュニア開発者であり、SOAP Webサービスを使用するアプリケーションを作成しようとしています。XMLとして書き込む方法をオブジェクトとして受け取るソープサービスを消費しますか?

Web参照を使用して簡単にSoap WebサーバーのWebメソッドを呼び出すことができますが、問題はサーバーがオブジェクトを返すことです(UBL XMLオブジェクトと思います)。そして私はその個々の要素/ノードにXMLオブジェクトとしてアクセスできます。しかし、出力をXMLファイル/オブジェクトに出力したいのであれば、どうすればいいのですか?おそらくオブジェクトをXMLオブジェクトとして出力するのは簡単な作業ですが、どこから開始するのかはわかりません。私は、返されたオブジェクトの単純な呼び出しToString()がうまくいかないことを試みました。私はHTTP POSTをSOAPヘッダーと本文を送信し、レスポンスストリームを解釈してXMLテキストとしてレスポンスを返すようにレベルを下げる必要がありますか?

/// <summary> 
/// Used by supplier to check Order 
/// </summary> 
/// <param name="sender"></param> 
/// <param name="e"></param> 
private void btnRequestPO_Click(object sender, EventArgs e) 
{ 
    string t_return; 
    SupplierServices supplierServices = new SupplierServices(); 

    LoginDetails lgDetails = new LoginDetails(); 
    lgDetails.UserName = "user"; 
    lgDetails.Password = "password"; 
    supplierServices.LoginDetailsValue = lgDetails; 

    RequestPurchaseOrder requestPO = new RequestPurchaseOrder(); 
    requestPO.SupplierCode = "1234"; 
    try 
    { 
     Order returned_order = supplierServices.SupplierRequestPO(requestPO); 
     if (returned_order != null) 
     { 
      //Simply call the ToString wouldn't work, it will return a 
      //class name instead. 
      t_return = returned_order.ToString(); 
      MessageBox.Show(t_return); 
     } 
     else 
      MessageBox.Show("Returned order is empty!"); 
    } 
    catch (Exception ex) 
    { 
     String responseFromServer = ex.Message.ToString() + " "; 
     if (ex!= null) 
     { 
      MessageBox.Show(responseFromServer); 
     } 
    } 

そして、ここでは、私が取得する必要SOAPレスポンスです:

これは私がUBLを取得するために使用されるコードは、XMLオブジェクトをフォーマットさである

HTTP/1.1 200 OK 
Content-Type: text/xml; charset=utf-8 
Content-Length: length 

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Body> 
    <SupplierRequestPOResponse xmlns="https://extranet.thewarehouse.co.nz/ElectronicCommerce/"> 
     <Order xmlns="urn:oasis:names:specification:ubl:schema:xsd:Order-2"> 
     <ID xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
     <CopyIndicator xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
     <IssueDate xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
     <Note xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
     <Note xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
     <DocumentCurrencyCode xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
     <CustomerReference xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
     <LineCountNumeric xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
     <ValidityPeriod xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"> 
      <StartDate xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <EndDate xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Description xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Description xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
     </ValidityPeriod> 
     <ValidityPeriod xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"> 
      <StartDate xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <EndDate xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Description xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Description xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
     </ValidityPeriod> 
     <BuyerCustomerParty xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"> 
      <CustomerAssignedAccountID xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Party> 
      <EndpointID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <PartyName xsi:nil="true" /> 
      <PartyName xsi:nil="true" /> 
      <PostalAddress xsi:nil="true" /> 
      <PhysicalLocation xsi:nil="true" /> 
      <PartyTaxScheme xsi:nil="true" /> 
      <PartyTaxScheme xsi:nil="true" /> 
      </Party> 
      <BuyerContact> 
      <ID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Name xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Telephone xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Telefax xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      </BuyerContact> 
     </BuyerCustomerParty> 
     <SellerSupplierParty xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"> 
      <CustomerAssignedAccountID xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Party> 
      <EndpointID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <PartyName xsi:nil="true" /> 
      <PartyName xsi:nil="true" /> 
      <PostalAddress xsi:nil="true" /> 
      <PhysicalLocation xsi:nil="true" /> 
      <PartyTaxScheme xsi:nil="true" /> 
      <PartyTaxScheme xsi:nil="true" /> 
      </Party> 
     </SellerSupplierParty> 
     <ManufacturerParty xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"> 
      <EndpointID xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <PartyName> 
      <Name xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      </PartyName> 
      <PartyName> 
      <Name xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      </PartyName> 
      <PostalAddress> 
      <StreetName xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <AdditionalStreetName xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <CitySubdivisionName xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <CityName xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Country xsi:nil="true" /> 
      </PostalAddress> 
      <PhysicalLocation> 
      <Address xsi:nil="true" /> 
      </PhysicalLocation> 
      <PartyTaxScheme> 
      <RegistrationName xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <CompanyID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <TaxScheme xsi:nil="true" /> 
      </PartyTaxScheme> 
      <PartyTaxScheme> 
      <RegistrationName xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <CompanyID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <TaxScheme xsi:nil="true" /> 
      </PartyTaxScheme> 
     </ManufacturerParty> 
     <Delivery xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"> 
      <Quantity xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <TrackingID xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <DeliveryParty> 
      <EndpointID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <PartyName xsi:nil="true" /> 
      <PartyName xsi:nil="true" /> 
      <PostalAddress xsi:nil="true" /> 
      <PhysicalLocation xsi:nil="true" /> 
      <PartyTaxScheme xsi:nil="true" /> 
      <PartyTaxScheme xsi:nil="true" /> 
      </DeliveryParty> 
     </Delivery> 
     <Delivery xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"> 
      <Quantity xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <TrackingID xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <DeliveryParty> 
      <EndpointID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <PartyName xsi:nil="true" /> 
      <PartyName xsi:nil="true" /> 
      <PostalAddress xsi:nil="true" /> 
      <PhysicalLocation xsi:nil="true" /> 
      <PartyTaxScheme xsi:nil="true" /> 
      <PartyTaxScheme xsi:nil="true" /> 
      </DeliveryParty> 
     </Delivery> 
     <TransactionConditions xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"> 
      <ID xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <ActionCode xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Description xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Description xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <DocumentReference> 
      <ID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <CopyIndicator xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <UUID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <IssueDate xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <DocumentTypeCode xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <DocumentType xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <XPath xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <XPath xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Attachment xsi:nil="true" /> 
      </DocumentReference> 
      <DocumentReference> 
      <ID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <CopyIndicator xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <UUID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <IssueDate xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <DocumentTypeCode xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <DocumentType xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <XPath xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <XPath xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Attachment xsi:nil="true" /> 
      </DocumentReference> 
     </TransactionConditions> 
     <TaxTotal xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"> 
      <TaxAmount xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
     </TaxTotal> 
     <TaxTotal xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"> 
      <TaxAmount xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
     </TaxTotal> 
     <AnticipatedMonetaryTotal xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"> 
      <LineExtensionAmount xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <AllowanceTotalAmount xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <PayableAmount xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
     </AnticipatedMonetaryTotal> 
     <OrderLine xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"> 
      <Note xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <LineItem> 
      <ID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Note xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <LineStatusCode xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Quantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <LineExtensionAmount xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <TotalTaxAmount xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <MinimumQuantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <MaximumBackorderQuantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <PartialDeliveryIndicator xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <BackOrderAllowedIndicator xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Delivery xsi:nil="true" /> 
      <Delivery xsi:nil="true" /> 
      <PricingReference xsi:nil="true" /> 
      <Price xsi:nil="true" /> 
      <Item xsi:nil="true" /> 
      </LineItem> 
      <BuyerProposedSubstituteLineItem> 
      <ID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Note xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <LineStatusCode xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Quantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <LineExtensionAmount xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <TotalTaxAmount xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <MinimumQuantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <MaximumBackorderQuantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <PartialDeliveryIndicator xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <BackOrderAllowedIndicator xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Delivery xsi:nil="true" /> 
      <Delivery xsi:nil="true" /> 
      <PricingReference xsi:nil="true" /> 
      <Price xsi:nil="true" /> 
      <Item xsi:nil="true" /> 
      </BuyerProposedSubstituteLineItem> 
      <BuyerProposedSubstituteLineItem> 
      <ID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Note xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <LineStatusCode xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Quantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <LineExtensionAmount xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <TotalTaxAmount xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <MinimumQuantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <MaximumBackorderQuantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <PartialDeliveryIndicator xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <BackOrderAllowedIndicator xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Delivery xsi:nil="true" /> 
      <Delivery xsi:nil="true" /> 
      <PricingReference xsi:nil="true" /> 
      <Price xsi:nil="true" /> 
      <Item xsi:nil="true" /> 
      </BuyerProposedSubstituteLineItem> 
     </OrderLine> 
     <OrderLine xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"> 
      <Note xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <LineItem> 
      <ID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Note xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <LineStatusCode xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Quantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <LineExtensionAmount xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <TotalTaxAmount xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <MinimumQuantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <MaximumBackorderQuantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <PartialDeliveryIndicator xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <BackOrderAllowedIndicator xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Delivery xsi:nil="true" /> 
      <Delivery xsi:nil="true" /> 
      <PricingReference xsi:nil="true" /> 
      <Price xsi:nil="true" /> 
      <Item xsi:nil="true" /> 
      </LineItem> 
      <BuyerProposedSubstituteLineItem> 
      <ID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Note xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <LineStatusCode xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Quantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <LineExtensionAmount xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <TotalTaxAmount xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <MinimumQuantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <MaximumBackorderQuantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <PartialDeliveryIndicator xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <BackOrderAllowedIndicator xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Delivery xsi:nil="true" /> 
      <Delivery xsi:nil="true" /> 
      <PricingReference xsi:nil="true" /> 
      <Price xsi:nil="true" /> 
      <Item xsi:nil="true" /> 
      </BuyerProposedSubstituteLineItem> 
      <BuyerProposedSubstituteLineItem> 
      <ID xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Note xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <LineStatusCode xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Quantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <LineExtensionAmount xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <TotalTaxAmount xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <MinimumQuantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <MaximumBackorderQuantity xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <PartialDeliveryIndicator xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <BackOrderAllowedIndicator xsi:nil="true" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /> 
      <Delivery xsi:nil="true" /> 
      <Delivery xsi:nil="true" /> 
      <PricingReference xsi:nil="true" /> 
      <Price xsi:nil="true" /> 
      <Item xsi:nil="true" /> 
      </BuyerProposedSubstituteLineItem> 
     </OrderLine> 
     </Order> 
    </SupplierRequestPOResponse> 
    </soap:Body> 
</soap:Envelope> 

答えて

0

あなたがXmlSerializerを使用することができます。

と同じようにreturned_orderを渡してください:

MessageBox.Show(Serialize(returned_order)); 
+0

マークありがとう、シリアライゼーションは私が必要とするものです。しかし、何らかの理由でMessageBox.Showは、おそらくサイズのために返されたSerialized結果を表示しませんでしたか?結果のXMLファイルは600Ksですか?私はそれを直接テキストに書かせて、私が望むならRichTextとして表示できるはずです。 –

+0

ええ、MessageBoxが表示できるサイズに制限があるかもしれませんが、私が作ったのは、私が提供したSerializeメソッドが文字列を返すということでした。その時点で、あなたは何をしてください。お役に立てて嬉しいです。 –

0

Mark Aveniusは、オブジェクトをXMLに変換する方法の良い例を提供しています。それがあなたがしようとしているすべてのものなら、彼の答えはあなたのニーズに完全に合っています。

ただし、SOAP応答自体を検証しようとしているように聞こえます.XmlSerializerでは、これを許可しません。その代わりに、オブジェクトを、XMLでどのようなオブジェクトがどのように表示されるべきかという独自のアイデアに変換しています。

実際にSOAP応答を検証しようとしている場合は、すばらしいツールFiddlerを使用することをお勧めします。 SOAPを含むあらゆる種類のWebリクエストを手作りし、受け取った正確な応答を分析することができます。 .NET Web開発にとって非常に貴重です。

+0

Benありがとう、私はまだSOAP応答を検証することを考えていません。しかし、あなたが言及して以来、私は、サーバーからの応答を確認する必要がある場合は、Fiddlerを覚えておきます。 –

関連する問題