【问题标题】:Web service (asmx) to read in customer's soap message c# - null object errorWeb服务(asmx)读取客户的肥皂消息c# - 空对象错误
【发布时间】:2013-05-31 12:26:48
【问题描述】:

我对 Web 服务和 WSDL 很陌生。

我想做的是构建一个 Web 服务来读取客户的 SOAP 消息并对其进行处理。

发给我的soap消息如下(注意我已经把SOAP消息剪掉了)

<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">
 <soap2:Header>
  <wsa:Action>http://htng.org/PWSWG/2010/12/ReservationSynch_SubmitRequest</wsa:Action> 
  <wsa:ReplyTo>
   <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address> 
  </wsa:ReplyTo>
 </soap2:Header>
 <Body>
  <OTA_HotelResNotifRQ>
   <POS>
     //More tags
   </POS>
   <HotelReservations>
    <HotelReservation RoomStayReservation="true">
     <UniqueID Type="14" ID="59071IC000041" /> 
    </HotelReservation>
   </HotelReservations>
  </OTA_HotelResNotifRQ>
 </Body>
</Envelope>

这是我的 Web 服务 asmx(我再次将其修剪)

[WebMethod]
[SoapDocumentMethodAttribute("http://htng.org/PWSWG/2010/12/ReservationSynch_SubmitRequest", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]

public OTA_HotelResNotifRS ReservationSynch_SubmitRequest(OTA_HotelResNotifRQ OTA_HotelResNotifRQ)
{

}

问题:当消息进入时,方法 ReservationSynch_SubmitRequest 被触发,但 OTA_HotelResNotifRQ 为空。客户给了我 WSDL,就我而言,这个类是正确的。虽然我注意到&lt;Body&gt; 标签而不是&lt;soap2:Body&gt;。这有什么不同吗?

我无法更改客户的消息,我只能更改我的网络服务以阅读他们发送给我的内容。我的 asmx 中是否缺少某些内容?

如果你有兴趣,这里是他们的 WSDL https://interface.synxis.com/interface/ota2010av2/OTA2010A.svc.wsdl

【问题讨论】:

  • 您应该改用 WCF 服务,asmx Web 服务是一项遗留技术。
  • 感谢您的评论。我拥有的唯一知识是构建 asmx Web 服务而不是 WCF。所以最好坚持我目前所知道的..

标签: c# web-services soap


【解决方案1】:

找到问题了!

我更改了几个类的名称空间,这影响了 WSDL 中的模式文件。

【讨论】:

  • 哦!我也在为此挣扎。你能把课程发到网上吗
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-04-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多