如何使用SOAP UI传递DTO

时间:2012-10-13 06:36:36

标签: c# .net web-services soapui dto

我在.NET中有一个Web服务,它接受该参数作为DTO。当我使用SOAP UI传递值时,该对象不会进入.NET Web服务。

我的DTO是一个get,设置了Class,我在我的Web服务方法中使用了这个DTO。

getQuote(RequestDTO requestDTO)

当我使用SOAP UI测试它时,就像下面的请求一样,requestDTO始终以null的方式进入getQuote方法。但是,当我使用调用此Web服务的示例.NET ASPX页面进行测试时,它可以正常工作。

以下是我在SOAP UI中的请求。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<getQuotes>
<requestQuoteDTO>
<SystemID>123</SystemID>
<RequestCircuitID>6012344</RequestCircuitID>
<PriceAllNodes>false</PriceAllNodes>
<siteDTO>
<SiteName>Test SOAPUI</SiteName>
<Street1>5 St Johns Lane</Street1>
<Street2></Street2>
<City>London</City>
<PostCode>EC1M 4BH</PostCode>
<State></State>
<Country>GBR</Country>
<Wirecentre></Wirecentre>
<SitePhoneNumber></SitePhoneNumber>
<Latitude></Latitude>
<Longitude></Longitude>
</siteDTO>
<ProductRef>PIP</ProductRef>
<SpeedRef>4 Mbps</SpeedRef>
<LineTypeRef>Ethernet</LineTypeRef>
<ContractTerm>2</ContractTerm>
</requestQuoteDTO>
</getQuotes>
</soapenv:Body>
</soapenv:Envelope>

1 个答案:

答案 0 :(得分:0)

Soap Request看起来像这样

enter code here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
  <tem:getQuotes>
     <tem:requestQuoteDTO>
        <tem:SystemID>?</tem:SystemID>
        <tem:RequestCircuitID>?</tem:RequestCircuitID>
        <tem:PriceAllNodes>?</tem:PriceAllNodes>
        <tem:siteDTO>
           <tem:SiteName>?</tem:SiteName>
           <tem:Street1>?</tem:Street1>
           <tem:Street2>?</tem:Street2>
           <tem:City>?</tem:City>
           <tem:PostCode>?</tem:PostCode>
           <tem:State>?</tem:State>
           <tem:Country>?</tem:Country>
           <tem:Wirecentre>?</tem:Wirecentre>
           <tem:SitePhoneNumber>?</tem:SitePhoneNumber>
           <tem:Latitude>?</tem:Latitude>
           <tem:Longitude>?</tem:Longitude>
        </tem:siteDTO>
        <tem:ProductRef>?</tem:ProductRef>
        <tem:SpeedRef>?</tem:SpeedRef>
        <tem:LineTypeRef>?</tem:LineTypeRef>
        <tem:ContractTerm>?</tem:ContractTerm>
     </tem:requestQuoteDTO>
  </tem:getQuotes>