开发者

How can I prevent the following nested soap request?

I have a WCF Operation that is defined like this:

[OperationContract(Name="GetColorsRQ")]
GetColorsRS GetColors(GetColorsRQ rq);

Where GetColorsRS will hold the response and GetColorsRQ holds the request. When I run this, it creates the following soap request (I am only including the beginning of the 开发者_如何转开发request)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
                  xmlns:ns="http://www.abc.com">
<soapenv:Header/>
<soapenv:Body>
      <ns:GetColorsRQ>
      <ns:rq Target="Test" Version="0">
      ....

When I was using the same request from an asmx service, it would not nest the request, it would do it like the following:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
                  xmlns:ns="http://www.abc.com">
<soapenv:Header/>
<soapenv:Body>
      <ns:GetColorsRQ Target="Test" Version="0">
      ....

Notice, now there is no ns:rq and the attributes have been placed on the ns:GetColorsRQ node.


After researching, I have determined that I must use MessageContract instead of DataContract to have more control over the Message.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜