2016-09-07 57 views
0

こんにちは私は "複数のルート要素2行目、2行目があります"というエラーが表示されます。エラー。奇妙なことは、これは先週働いていて、コードは変更されていないということです。VB.Net XMLエラー - 複数のルート要素があります

<?xml version="1.0" encoding="UTF-8"?> 
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/" soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> 
    <soap:Body> 
    <OTA_VehAvailRateRQ xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05 OTA_PingRQ.xsd" Target="Test" Version="1.003"> 
     <POS> 
     <Source ISOCurrency="EUR"> 
      <RequestorID ID="######"/> 
     </Source> 
     </POS> 
     <VehAvailRQCore Status="Available"> 
     <VehRentalCore PickUpDateTime="2016-10-10T12:00:00" ReturnDateTime="2016-10-17T12:00:00"> 
      <PickUpLocation LocationCode="71"/> 
      <ReturnLocation LocationCode="71"/> 
     </VehRentalCore> 
     <DriverType Age="25"/> 
     </VehAvailRQCore> 
     <VehAvailRQInfo> 
     <Customer> 
      <Primary> 
      <CitizenCountryName Code="IE"/> 
      </Primary> 
     </Customer> 
     <TPA_Extensions> 
      <ConsumerIP>###.##.###.###</ConsumerIP> 
     </TPA_Extensions> 
     </VehAvailRQInfo> 
    </OTA_VehAvailRateRQ> 
    </soap:Body> 
</soap:Envelope> 

これは送信されない理由はありますか?受信者サーバーまでは到達しません。

ここにXMLを送信する関数があります。 XMLは、文字列「request.request」

Public Function RequestSoapXML(ByVal Request As ALTStructures.ALTXMLStructures.Request) As String 
     RequestSoapXML = "Success" 
     Try 
      Dim webClient As New System.Net.WebClient() 
      webClient.Headers.Add("Content-Type", "text/xml;charset=utf-8") 
      webClient.Headers.Add("SOAPAction", Request.SOAPAction) 
      Dim response = webClient.UploadString(Request.Destination, Request.Request) 
      Dim XMLdate As String = System.DateTime.Now.ToString("yyyyMMddHHmmssfff") 
      Dim XMLDoc As New XmlDocument 
      XMLDoc.LoadXml(response) 
      XMLDoc.Save(Request.XMLFile) 
     Catch webExcp As System.Net.WebException 
      Dim httpResponse As System.Net.HttpWebResponse = CType(webExcp.Response, System.Net.HttpWebResponse) 
      Dim StreamObj As Stream = webExcp.Response.GetResponseStream 
      Dim SR As New StreamReader(StreamObj, Encoding.UTF8) 
      Dim uError As String = SR.ReadToEnd() 
      Dim XMLErr As New XmlDocument 
      XMLErr.LoadXml(uError) 
      XMLErr.Save("###########") 
      Dim Xmlreader As XmlTextReader = New XmlTextReader("##########") 
      Xmlreader.WhitespaceHandling = WhitespaceHandling.Significant 
      Try 
       While Not Xmlreader.EOF 
        Select Case Xmlreader.Name 
         Case "faultstring" 
          RequestSoapXML = Xmlreader.ReadInnerXml 
        End Select 
        Xmlreader.Read() 
       End While 
       Xmlreader.Close() 
      Catch ex As Exception 
       RequestSoapXML = ex.Message 
      End Try 
     Catch ex As Exception 
      RequestSoapXML = ex.Message 
     End Try 
    End Function 

渡されるこの機能は、多くのXML要求を処理し、その誤差はここにあった場合、私は、エラーの多くを期待したいです。

+0

エラーを返すコードを投稿できますか? xml自体は私には良く見えますし、notepad ++のxml syntax checkerにはエラーが表示されません... – DrDonut

+0

これは正しいXMLです。私は間違って最後に別のセクションがタックされているようなものはないと思いますが、そこにはありますか? –

+0

ここにXMLを送信する関数があります。 XMLには文字列 "request.request"が渡されます。 –

答えて

0

問題

は、それが実際に返されるXMLのエラーではなく、私が送信してるXMLだ私を見つけました。

乾杯。

関連する問題