如何在WCF中发送已经构造的SOAP消息 [英] how to send a already constructed SOAP message in WCF

查看:70
本文介绍了如何在WCF中发送已经构造的SOAP消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在客户端的字符串中有一条SOAP消息

I have a SOAP message in a string at my client side

string requestMessageString = "<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:inf="http://www.informatica.com/" 
xmlns:wsdl="http://www.informatica.com/wsdl/"> 
    <soapenv:Header> 
       <inf:Security> 
          <UsernameToken> 
             <Username>john</Username> 
             <Password>jhgfsdjgfj</Password> 
          </UsernameToken> 
       </inf:Security> 
    </soapenv:Header> 
    <soapenv:Body> 
       <wsdl:doClient_ws_IbankRequest> 
          <wsdl:doClient_ws_IbankRequestElement> 
             <!--Optional:--> 
             <wsdl:Client_No>00460590</wsdl:Client_No> 
          </wsdl:doClient_ws_IbankRequestElement> 
       </wsdl:doClient_ws_IbankRequest> 
    </soapenv:Body> 
</soapenv:Envelope>"

我正在发送这样的消息

Message requestMsg = Message.CreateMessage(MessageVersion.Soap11, "http://tempuri.org/IService1/IbankClientOperation", requestMessageString );

            Message responseMsg = null;

            BasicHttpBinding binding = new BasicHttpBinding();
            IChannelFactory<IRequestChannel> channelFactory = binding.BuildChannelFactory<IRequestChannel>();
            channelFactory.Open();

            EndpointAddress address = new EndpointAddress(this.Url);
            IRequestChannel channel = channelFactory.CreateChannel(address);
            channel.Open();

            responseMsg = channel.Request(requestMsg);

问题是,通过电线发送的实际消息在SOAP消息内包含SOAP消息...
i以某种方式想要转换将我的RAW消息写入SOAP结构

but the problem is that the actual message which is sent over wire has a SOAP message inside a SOAP message... i somehow want to convert my RAW message into SOAP structure

推荐答案

我从这个问题
wcf肥皂消息反序列化错误

这篇关于如何在WCF中发送已经构造的SOAP消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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