wsdl中每个节点中的d4p1 [英] d4p1 in each node in wsdl

查看:133
本文介绍了wsdl中每个节点中的d4p1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在写一个简单的WCF服务。以下是wsdl创建的几行。



Hi,

I am writing a simple WCF service. Below is the few lines from the wsdl created.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IEhelplineService/Open</Action>
  </s:Header>
  <s:Body>
    <Open xmlns="http://tempuri.org/">
      <header xmlns:d4p1="http://schemas.datacontract.org/2004/07/eHelplineESBService" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        <d4p1:dstApplicationID i:nil="true" />
        <d4p1:messageID i:nil="true" />
        <d4p1:srcApplicationID i:nil="true" />
      </header>
      <calldata xmlns:d4p1="http://schemas.datacontract.org/2004/07/eHelplineESBService" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        <d4p1:Item i:nil="true" />
        <d4p1:Organisation i:nil="true" />
        <d4p1:Solution i:nil="true" />
        <d4p1:Source i:nil="true" />
        <d4p1:additionalAttribute i:nil="true" />
        <d4p1:agent i:nil="true" />





每个标签都有这是< d4p1:添加,我想用ajt替换它。我该怎么做以及从哪里添加这个标签?



in each tag there is this "<d4p1:" getting added, i want to replace it with "ajt". How do i do it and from where is this tag getting added?

推荐答案

如果您自己编写文件,可以轻松完成。真的很容易。如果你真的需要它,我可以找到并解释它;我真的在我的工作中这样做,可能与你做同样的目的:通过添加语义合理的前缀,更好的人类可读性。



然而,我打赌你不要自己做:数据合同为你做,更确切地说, DataContractSerializer

< a href =http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractserializer.aspx> http://msdn.microsoft.com/en-us/library/system.runtime .serialization.datacontractserializer.aspx [ ^ ]。



据我所知,你无法控制前缀。它根本不会影响任何东西(尝试用任何有效的唯一XML名称替换它,你会看到相同的软件以完全相同的方式解析文件/流),所以它不是一个选项。



一般来说,这个序列化程序的一个小问题是:它不是那么简洁,所以你可能希望它具有人类可读性。你想知道我的解决方案是什么吗?我正在为替换版本的序列化程序而工作;第一个版本已经部署到客户端。但这确实非常困难。由于使用了 System.Reflection.Emit (否则性能会太糟糕,我知道我的旧版本的类似技术是我发明的,当Data Contact不是Microsoft提供的时候),它很难调试,需要很好的CIL知识。我不确定你是不是只想修一个小前缀。



-SA
You can easily do it if you write the file by yourself. Really easily. If you really need it, I can find out and explain it; I really do it in my work, probably for the same purpose as you do: better readability for a human, via adding semantically sensible prefix.

However, I bet you don't do it by yourself: the Data Contract does it for you, more exactly, DataContractSerializer:
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractserializer.aspx[^].

And, as far as I know, you don't have control over the prefix. It affects nothing at all (try to replace it with any valid unique XML name and you will see that same software parses the file/stream exactly the same way), so it is not an option.

Generally, one little problem with this serializer is: it is not so laconic and so human-readable as you probably would like it to be. Do you want to know what's my solution? I'm working for alternative version of the serializer used to replace the one from Microsoft; the first version is already deployed to customers. But this is really, really hard job. As System.Reflection.Emit is used (otherwise performance would be too bad, I know that from my old version of similar technology I invented when Data Contact was not yes available from Microsoft), it is really hard to debug and requires good knowledge of CIL. I'm not sure you want to bite a bullet just for fixing a small prefix.

—SA

这篇关于wsdl中每个节点中的d4p1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆