简体   繁体   English

将xml传递到Web服务

[英]passing xml to a webservice

I have a simple web service that will have one method: DoTransactions(xlm) 我有一个简单的Web服务,它将具有一种方法:DoTransactions(xlm)

Now the reason that i am using XML as a parameter is due to the fact that the parameters will often change. 现在,之所以使用XML作为参数,是因为参数经常会更改。 So for example it could be: 因此,例如:

<payload>
 <userId>1234</userid>
 <partnerId>ptn654</partnerId>
</payload>

OR 要么

<payload>
 <partnerId>ptn654</partnerId>
 <items>
  <item1>
   <cost>10</cost>
   <description>This is item 1</description>
  </item1>
 </items>
</payload>

As you can see the XML string will always change (this is due to a client request) 如您所见,XML字符串将始终更改(这是由于客户端请求)

Would it be better to rather pass in a string and parse the XML in the method or should is there a better way to do it. 宁愿传入一个字符串并解析该方法中的XML还是更好的方法呢?

This web service will be used for varios different code languages. 该Web服务将用于各种不同的代码语言。

如果数据永远在变化,那么我将坚持您的工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM